From 60df9e0d38994509a595710a52d71baab1d7c28c Mon Sep 17 00:00:00 2001 From: Dario Nieuwenhuis Date: Sat, 9 Jan 2021 00:51:07 +0100 Subject: [PATCH] Add non_exhaustive attrs. --- embassy/src/flash.rs | 3 +-- embassy/src/io/error.rs | 23 +---------------------- 2 files changed, 2 insertions(+), 24 deletions(-) diff --git a/embassy/src/flash.rs b/embassy/src/flash.rs index ca9fb5952..5866fdf05 100644 --- a/embassy/src/flash.rs +++ b/embassy/src/flash.rs @@ -2,12 +2,11 @@ use core::future::Future; #[derive(Copy, Clone, Debug, Eq, PartialEq)] #[cfg_attr(feature = "defmt", derive(defmt::Format))] +#[non_exhaustive] pub enum Error { Failed, AddressMisaligned, BufferMisaligned, - - _NonExhaustive, } pub trait Flash { diff --git a/embassy/src/io/error.rs b/embassy/src/io/error.rs index 8bad0cdb1..2092c0d18 100644 --- a/embassy/src/io/error.rs +++ b/embassy/src/io/error.rs @@ -1,9 +1,7 @@ /// Categories of errors that can occur. -/// -/// This list is intended to grow over time and it is not recommended to -/// exhaustively match against it. #[derive(Debug, Clone, Copy, PartialEq, Eq)] #[cfg_attr(feature = "defmt", derive(defmt::Format))] +#[non_exhaustive] pub enum Error { /// An entity was not found, often a file. NotFound, @@ -142,22 +140,3 @@ impl core::fmt::Display for Error { #[cfg(feature = "std")] impl std::error::Error for Error {} - -/* -impl From for Error { - fn from(err: smoltcp::Error) -> Error { - match err { - smoltcp::Error::Exhausted => Error::Exhausted, - smoltcp::Error::Illegal => Error::Illegal, - smoltcp::Error::Unaddressable => Error::Unaddressable, - smoltcp::Error::Truncated => Error::Truncated, - smoltcp::Error::Checksum => Error::Checksum, - smoltcp::Error::Unrecognized => Error::Unrecognized, - smoltcp::Error::Fragmented => Error::Fragmented, - smoltcp::Error::Malformed => Error::Malformed, - smoltcp::Error::Dropped => Error::Dropped, - _ => Error::Other, - } - } -} -*/