Skip to content

Commit 22c66b6

Browse files
authored
Deny more Clippy lints (#65)
Closes #50
1 parent 7a1617a commit 22c66b6

File tree

2 files changed

+146
-60
lines changed

2 files changed

+146
-60
lines changed

src/byteorder.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -511,8 +511,13 @@ mod tests {
511511
macro_rules! impl_traits {
512512
($name:ident, $native:ident, $bytes:expr, $sign:ident) => {
513513
impl Native for $native {
514+
// For some types, `0 as _` is required (for example, when
515+
// `$native` is a floating-point type; `0` is an integer), but
516+
// for other types, it's a trivial cast. In all cases, Clippy
517+
// thinks it's dangerous.
518+
#[allow(trivial_numeric_casts, clippy::as_conversions)]
514519
const ZERO: $native = 0 as _;
515-
const MAX_VALUE: $native = ::core::$native::MAX;
520+
const MAX_VALUE: $native = $native::MAX;
516521

517522
fn rand() -> $native {
518523
rand::random()
@@ -586,9 +591,9 @@ mod tests {
586591
}
587592

588593
#[cfg(target_endian = "big")]
589-
type NonNativeEndian = byteorder::LittleEndian;
594+
type NonNativeEndian = LittleEndian;
590595
#[cfg(target_endian = "little")]
591-
type NonNativeEndian = byteorder::BigEndian;
596+
type NonNativeEndian = BigEndian;
592597

593598
#[test]
594599
fn test_zero() {

0 commit comments

Comments
 (0)