File tree Expand file tree Collapse file tree 9 files changed +19
-3
lines changed Expand file tree Collapse file tree 9 files changed +19
-3
lines changed Original file line number Diff line number Diff line change @@ -803,6 +803,7 @@ pub const fn swap<T>(x: &mut T, y: &mut T) {
803803#[ inline]
804804#[ stable( feature = "mem_take" , since = "1.40.0" ) ]
805805pub fn take < T : Default > ( dest : & mut T ) -> T {
806+ #[ allow( clippy:: mem_replace_with_default) ] // exempt by being the one true definition
806807 replace ( dest, T :: default ( ) )
807808}
808809
Original file line number Diff line number Diff line change @@ -58,6 +58,7 @@ impl Decimal {
5858 // of the x87 FPU stack to be changed so that it directly rounds to 64/32 bit.
5959 // The `set_precision` function takes care of setting the precision on architectures which
6060 // require setting it by changing the global state (like the control word of the x87 FPU).
61+ #[ allow( clippy:: let_unit_value) ]
6162 let _cw = set_precision :: < F > ( ) ;
6263
6364 if !self . can_use_fast_path :: < F > ( ) {
Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ pub struct Fp {
2121
2222impl Fp {
2323 /// Returns a correctly rounded product of itself and `other`.
24+ #[ allow( clippy:: should_implement_trait) ]
2425 pub fn mul ( self , other : Self ) -> Self {
2526 let ( lo, hi) = self . f . widening_mul ( other. f ) ;
2627 let f = hi + ( lo >> 63 ) /* round */ ;
Original file line number Diff line number Diff line change 1010//! defined directly on the `f32` type.
1111
1212#![ stable( feature = "rust1" , since = "1.0.0" ) ]
13+ #![ allow( clippy:: excessive_precision) ]
1314
1415use crate :: convert:: FloatToInt ;
1516use crate :: num:: FpCategory ;
@@ -491,13 +492,15 @@ impl f32 {
491492 /// The concrete bit pattern may change across Rust versions and target platforms.
492493 #[ stable( feature = "assoc_int_consts" , since = "1.43.0" ) ]
493494 #[ rustc_diagnostic_item = "f32_nan" ]
494- #[ allow( clippy:: eq_op) ]
495+ #[ allow( clippy:: eq_op, clippy :: zero_divided_by_zero ) ]
495496 pub const NAN : f32 = 0.0_f32 / 0.0_f32 ;
496497 /// Infinity (∞).
497498 #[ stable( feature = "assoc_int_consts" , since = "1.43.0" ) ]
499+ #[ allow( clippy:: zero_divided_by_zero) ]
498500 pub const INFINITY : f32 = 1.0_f32 / 0.0_f32 ;
499501 /// Negative infinity (−∞).
500502 #[ stable( feature = "assoc_int_consts" , since = "1.43.0" ) ]
503+ #[ allow( clippy:: zero_divided_by_zero) ]
501504 pub const NEG_INFINITY : f32 = -1.0_f32 / 0.0_f32 ;
502505
503506 /// Sign bit
Original file line number Diff line number Diff line change 1010//! defined directly on the `f64` type.
1111
1212#![ stable( feature = "rust1" , since = "1.0.0" ) ]
13+ #![ allow( clippy:: excessive_precision) ]
1314
1415use crate :: convert:: FloatToInt ;
1516use crate :: num:: FpCategory ;
@@ -490,13 +491,15 @@ impl f64 {
490491 /// The concrete bit pattern may change across Rust versions and target platforms.
491492 #[ rustc_diagnostic_item = "f64_nan" ]
492493 #[ stable( feature = "assoc_int_consts" , since = "1.43.0" ) ]
493- #[ allow( clippy:: eq_op) ]
494+ #[ allow( clippy:: eq_op, clippy :: zero_divided_by_zero ) ]
494495 pub const NAN : f64 = 0.0_f64 / 0.0_f64 ;
495496 /// Infinity (∞).
496497 #[ stable( feature = "assoc_int_consts" , since = "1.43.0" ) ]
498+ #[ allow( clippy:: zero_divided_by_zero) ]
497499 pub const INFINITY : f64 = 1.0_f64 / 0.0_f64 ;
498500 /// Negative infinity (−∞).
499501 #[ stable( feature = "assoc_int_consts" , since = "1.43.0" ) ]
502+ #[ allow( clippy:: zero_divided_by_zero) ]
500503 pub const NEG_INFINITY : f64 = -1.0_f64 / 0.0_f64 ;
501504
502505 /// Sign bit
Original file line number Diff line number Diff line change @@ -142,6 +142,7 @@ pub fn max_pow10_no_more_than(x: u32) -> (u8, u32) {
142142 const X2 : u32 = 100 ;
143143 const X1 : u32 = 10 ;
144144
145+ #[ allow( clippy:: collapsible_else_if) ]
145146 if x < X4 {
146147 if x < X2 {
147148 if x < X1 { ( 0 , 1 ) } else { ( 1 , X1 ) }
Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ pub enum Part<'a> {
1919
2020impl < ' a > Part < ' a > {
2121 /// Returns the exact byte length of given part.
22+ #[ allow( clippy:: len_without_is_empty) ]
2223 pub fn len ( & self ) -> usize {
2324 match * self {
2425 Part :: Zero ( nzeroes) => nzeroes,
@@ -31,8 +32,10 @@ impl<'a> Part<'a> {
3132 } else {
3233 3
3334 }
35+ } else if v < 10_000 {
36+ 4
3437 } else {
35- if v < 10_000 { 4 } else { 5 }
38+ 5
3639 }
3740 }
3841 Part :: Copy ( buf) => buf. len ( ) ,
@@ -81,6 +84,7 @@ pub struct Formatted<'a> {
8184
8285impl < ' a > Formatted < ' a > {
8386 /// Returns the exact byte length of combined formatted result.
87+ #[ allow( clippy:: len_without_is_empty) ]
8488 pub fn len ( & self ) -> usize {
8589 let mut len = self . sign . len ( ) ;
8690 for part in self . parts {
Original file line number Diff line number Diff line change @@ -1412,6 +1412,7 @@ macro_rules! from_str_int_impl {
14121412 /// ```
14131413 #[ inline]
14141414 fn from_str( src: & str ) -> Result <$int_ty, ParseIntError > {
1415+ #[ allow( clippy:: from_str_radix_10) ]
14151416 <$int_ty>:: from_str_radix( src, 10 )
14161417 }
14171418 }
Original file line number Diff line number Diff line change @@ -1158,6 +1158,7 @@ macro_rules! nonzero_integer {
11581158 impl FromStr for NonZero <$Int> {
11591159 type Err = ParseIntError ;
11601160 fn from_str( src: & str ) -> Result <Self , Self :: Err > {
1161+ #[ allow( clippy:: from_str_radix_10) ]
11611162 Self :: new( <$Int>:: from_str_radix( src, 10 ) ?)
11621163 . ok_or( ParseIntError {
11631164 kind: IntErrorKind :: Zero
You can’t perform that action at this time.
0 commit comments