Skip to content

Commit

Permalink
test: add and fix some additional lints
Browse files Browse the repository at this point in the history
Signed-off-by: Nathaniel McCallum <nathaniel@profian.com>
  • Loading branch information
npmccallum committed Apr 11, 2022
1 parent fb2d765 commit cc13e29
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 11 deletions.
3 changes: 3 additions & 0 deletions src/address.rs
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,10 @@ where

#[cfg(test)]
mod test {
extern crate std;

use super::*;
use std::println;

#[test]
fn align() {
Expand Down
12 changes: 9 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
16 changes: 8 additions & 8 deletions src/register.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,50 +35,50 @@ macro_rules! implfrom {

(@try $attr:meta Register<$f:ident> => Register<$t:ident>) => {
#[$attr]
impl core::convert::TryFrom<Register<$f>> for Register<$t> {
impl TryFrom<Register<$f>> for Register<$t> {
type Error = core::num::TryFromIntError;

#[inline]
fn try_from(value: Register<$f>) -> Result<Register<$t>, 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<Register<$f>> for $t {
impl TryFrom<Register<$f>> for $t {
type Error = core::num::TryFromIntError;

#[inline]
fn try_from(value: Register<$f>) -> Result<Self, Self::Error> {
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<Register<$f>> for Register<$t> {
impl TryFrom<Register<$f>> for Register<$t> {
type Error = core::num::TryFromIntError;

#[inline]
fn try_from(value: Register<$f>) -> Result<Register<$t>, 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<Register<$f>> for $t {
impl TryFrom<Register<$f>> for $t {
type Error = core::num::TryFromIntError;

#[inline]
fn try_from(value: Register<$f>) -> Result<Self, Self::Error> {
let s: Register<$s> = value.into();
core::convert::TryFrom::try_from(s.0)
TryFrom::try_from(s.0)
}
}
};
Expand Down

0 comments on commit cc13e29

Please sign in to comment.