Skip to content

Commit

Permalink
Deny more Clippy lints (#65)
Browse files Browse the repository at this point in the history
Closes #50
  • Loading branch information
joshlf authored Oct 15, 2022
1 parent 7a1617a commit 22c66b6
Show file tree
Hide file tree
Showing 2 changed files with 146 additions and 60 deletions.
11 changes: 8 additions & 3 deletions src/byteorder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -511,8 +511,13 @@ mod tests {
macro_rules! impl_traits {
($name:ident, $native:ident, $bytes:expr, $sign:ident) => {
impl Native for $native {
// For some types, `0 as _` is required (for example, when
// `$native` is a floating-point type; `0` is an integer), but
// for other types, it's a trivial cast. In all cases, Clippy
// thinks it's dangerous.
#[allow(trivial_numeric_casts, clippy::as_conversions)]
const ZERO: $native = 0 as _;
const MAX_VALUE: $native = ::core::$native::MAX;
const MAX_VALUE: $native = $native::MAX;

fn rand() -> $native {
rand::random()
Expand Down Expand Up @@ -586,9 +591,9 @@ mod tests {
}

#[cfg(target_endian = "big")]
type NonNativeEndian = byteorder::LittleEndian;
type NonNativeEndian = LittleEndian;
#[cfg(target_endian = "little")]
type NonNativeEndian = byteorder::BigEndian;
type NonNativeEndian = BigEndian;

#[test]
fn test_zero() {
Expand Down
Loading

0 comments on commit 22c66b6

Please # to comment.