From 4699c6fa2ddd31fb2a8fd26bda18addb5b93df91 Mon Sep 17 00:00:00 2001 From: doinkythederp Date: Sat, 23 Dec 2023 21:00:30 -0800 Subject: [PATCH] feat: use snafu error implementations --- pros/Cargo.toml | 1 + pros/src/error.rs | 1 - pros/src/lcd/mod.rs | 1 - pros/src/link.rs | 1 - pros/src/motor.rs | 1 - pros/src/sensors/gps.rs | 1 - pros/src/sensors/vision.rs | 1 - 7 files changed, 1 insertion(+), 6 deletions(-) diff --git a/pros/Cargo.toml b/pros/Cargo.toml index 811e0c32..94d5d75c 100644 --- a/pros/Cargo.toml +++ b/pros/Cargo.toml @@ -17,6 +17,7 @@ spin = "0.9.8" pros-sys = { version = "0.4", path = "../pros-sys", features = ["xapi"] } snafu = { version = "0.7.5", default-features = false, features = [ "rust_1_61", + "unstable-core-error", ] } no_std_io = { version = "0.6.0", features = ["alloc"] } futures = { version = "0.3.28", default-features = false, features = ["alloc"] } diff --git a/pros/src/error.rs b/pros/src/error.rs index 11ecf92a..dd994191 100644 --- a/pros/src/error.rs +++ b/pros/src/error.rs @@ -90,7 +90,6 @@ pub enum PortError { ))] PortCannotBeConfigured, } -impl core::error::Error for PortError {} map_errno!(PortError { ENXIO => Self::PortOutOfRange, diff --git a/pros/src/lcd/mod.rs b/pros/src/lcd/mod.rs index 182b665f..2e646710 100644 --- a/pros/src/lcd/mod.rs +++ b/pros/src/lcd/mod.rs @@ -37,4 +37,3 @@ pub enum LcdError { #[snafu(display("LCD not initialized"))] NotInitialized, } -impl core::error::Error for LcdError {} diff --git a/pros/src/link.rs b/pros/src/link.rs index 7bc296e6..98adff89 100644 --- a/pros/src/link.rs +++ b/pros/src/link.rs @@ -178,7 +178,6 @@ pub enum LinkError { #[snafu(display("{source}"), context(false))] Port { source: PortError }, } -impl core::error::Error for LinkError {} map_errno! { LinkError { diff --git a/pros/src/motor.rs b/pros/src/motor.rs index b3875b88..bbfc1741 100644 --- a/pros/src/motor.rs +++ b/pros/src/motor.rs @@ -305,7 +305,6 @@ pub enum MotorError { #[snafu(display("{source}"), context(false))] Port { source: PortError }, } -impl core::error::Error for MotorError {} map_errno! { MotorError {} diff --git a/pros/src/sensors/gps.rs b/pros/src/sensors/gps.rs index 93b72772..aa93e204 100644 --- a/pros/src/sensors/gps.rs +++ b/pros/src/sensors/gps.rs @@ -80,7 +80,6 @@ pub enum GpsError { #[snafu(display("{source}"), context(false))] Port { source: PortError }, } -impl core::error::Error for GpsError {} map_errno! { GpsError { diff --git a/pros/src/sensors/vision.rs b/pros/src/sensors/vision.rs index e12d05ba..a914a367 100644 --- a/pros/src/sensors/vision.rs +++ b/pros/src/sensors/vision.rs @@ -221,7 +221,6 @@ pub enum VisionError { #[snafu(display("{source}"), context(false))] Port { source: PortError }, } -impl core::error::Error for VisionError {} map_errno! { VisionError {