From cc13e29f725f37f0474de0e156e6ee63b4996540 Mon Sep 17 00:00:00 2001 From: Nathaniel McCallum Date: Mon, 11 Apr 2022 11:02:11 -0400 Subject: [PATCH] test: add and fix some additional lints Signed-off-by: Nathaniel McCallum --- src/address.rs | 3 +++ src/lib.rs | 12 +++++++++--- src/register.rs | 16 ++++++++-------- 3 files changed, 20 insertions(+), 11 deletions(-) diff --git a/src/address.rs b/src/address.rs index ac1b082..27f3446 100644 --- a/src/address.rs +++ b/src/address.rs @@ -366,7 +366,10 @@ where #[cfg(test)] mod test { + extern crate std; + use super::*; + use std::println; #[test] fn align() { diff --git a/src/lib.rs b/src/lib.rs index 4f847ac..ff04c6c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -6,9 +6,15 @@ //! * Offsets //! * Pages -#![cfg_attr(not(test), no_std)] -#![deny(clippy::all)] -#![deny(missing_docs)] +#![no_std] +#![forbid(clippy::expect_used, clippy::panic)] +#![deny( + rust_2018_idioms, + unused_lifetimes, + unused_qualifications, + clippy::all, + missing_docs +)] #[cfg(feature = "alloc")] extern crate alloc; diff --git a/src/register.rs b/src/register.rs index b12ac30..81b1dbe 100644 --- a/src/register.rs +++ b/src/register.rs @@ -35,50 +35,50 @@ macro_rules! implfrom { (@try $attr:meta Register<$f:ident> => Register<$t:ident>) => { #[$attr] - impl core::convert::TryFrom> for Register<$t> { + impl TryFrom> for Register<$t> { type Error = core::num::TryFromIntError; #[inline] fn try_from(value: Register<$f>) -> Result, Self::Error> { - Ok(Self(core::convert::TryFrom::try_from(value.0)?)) + Ok(Self(TryFrom::try_from(value.0)?)) } } }; (@try $attr:meta Register<$f:ident> => $t:ident) => { #[$attr] - impl core::convert::TryFrom> for $t { + impl TryFrom> for $t { type Error = core::num::TryFromIntError; #[inline] fn try_from(value: Register<$f>) -> Result { - core::convert::TryFrom::try_from(value.0) + TryFrom::try_from(value.0) } } }; (@try $attr:meta Register<$f:ident> via Register<$s:ident> => Register<$t:ident>) => { #[$attr] - impl core::convert::TryFrom> for Register<$t> { + impl TryFrom> for Register<$t> { type Error = core::num::TryFromIntError; #[inline] fn try_from(value: Register<$f>) -> Result, Self::Error> { let s: Register<$s> = value.into(); - Ok(Self(core::convert::TryFrom::try_from(s.0)?)) + Ok(Self(TryFrom::try_from(s.0)?)) } } }; (@try $attr:meta Register<$f:ident> via Register<$s:ident> => $t:ident) => { #[$attr] - impl core::convert::TryFrom> for $t { + impl TryFrom> for $t { type Error = core::num::TryFromIntError; #[inline] fn try_from(value: Register<$f>) -> Result { let s: Register<$s> = value.into(); - core::convert::TryFrom::try_from(s.0) + TryFrom::try_from(s.0) } } };