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) {
803
803
#[ inline]
804
804
#[ stable( feature = "mem_take" , since = "1.40.0" ) ]
805
805
pub fn take < T : Default > ( dest : & mut T ) -> T {
806
+ #[ allow( clippy:: mem_replace_with_default) ] // exempt by being the one true definition
806
807
replace ( dest, T :: default ( ) )
807
808
}
808
809
Original file line number Diff line number Diff line change @@ -58,6 +58,7 @@ impl Decimal {
58
58
// of the x87 FPU stack to be changed so that it directly rounds to 64/32 bit.
59
59
// The `set_precision` function takes care of setting the precision on architectures which
60
60
// require setting it by changing the global state (like the control word of the x87 FPU).
61
+ #[ allow( clippy:: let_unit_value) ]
61
62
let _cw = set_precision :: < F > ( ) ;
62
63
63
64
if !self . can_use_fast_path :: < F > ( ) {
Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ pub struct Fp {
21
21
22
22
impl Fp {
23
23
/// Returns a correctly rounded product of itself and `other`.
24
+ #[ allow( clippy:: should_implement_trait) ]
24
25
pub fn mul ( self , other : Self ) -> Self {
25
26
let ( lo, hi) = self . f . widening_mul ( other. f ) ;
26
27
let f = hi + ( lo >> 63 ) /* round */ ;
Original file line number Diff line number Diff line change 10
10
//! defined directly on the `f32` type.
11
11
12
12
#![ stable( feature = "rust1" , since = "1.0.0" ) ]
13
+ #![ allow( clippy:: excessive_precision) ]
13
14
14
15
use crate :: convert:: FloatToInt ;
15
16
use crate :: num:: FpCategory ;
@@ -491,13 +492,15 @@ impl f32 {
491
492
/// The concrete bit pattern may change across Rust versions and target platforms.
492
493
#[ stable( feature = "assoc_int_consts" , since = "1.43.0" ) ]
493
494
#[ rustc_diagnostic_item = "f32_nan" ]
494
- #[ allow( clippy:: eq_op) ]
495
+ #[ allow( clippy:: eq_op, clippy :: zero_divided_by_zero ) ]
495
496
pub const NAN : f32 = 0.0_f32 / 0.0_f32 ;
496
497
/// Infinity (∞).
497
498
#[ stable( feature = "assoc_int_consts" , since = "1.43.0" ) ]
499
+ #[ allow( clippy:: zero_divided_by_zero) ]
498
500
pub const INFINITY : f32 = 1.0_f32 / 0.0_f32 ;
499
501
/// Negative infinity (−∞).
500
502
#[ stable( feature = "assoc_int_consts" , since = "1.43.0" ) ]
503
+ #[ allow( clippy:: zero_divided_by_zero) ]
501
504
pub const NEG_INFINITY : f32 = -1.0_f32 / 0.0_f32 ;
502
505
503
506
/// Sign bit
Original file line number Diff line number Diff line change 10
10
//! defined directly on the `f64` type.
11
11
12
12
#![ stable( feature = "rust1" , since = "1.0.0" ) ]
13
+ #![ allow( clippy:: excessive_precision) ]
13
14
14
15
use crate :: convert:: FloatToInt ;
15
16
use crate :: num:: FpCategory ;
@@ -490,13 +491,15 @@ impl f64 {
490
491
/// The concrete bit pattern may change across Rust versions and target platforms.
491
492
#[ rustc_diagnostic_item = "f64_nan" ]
492
493
#[ stable( feature = "assoc_int_consts" , since = "1.43.0" ) ]
493
- #[ allow( clippy:: eq_op) ]
494
+ #[ allow( clippy:: eq_op, clippy :: zero_divided_by_zero ) ]
494
495
pub const NAN : f64 = 0.0_f64 / 0.0_f64 ;
495
496
/// Infinity (∞).
496
497
#[ stable( feature = "assoc_int_consts" , since = "1.43.0" ) ]
498
+ #[ allow( clippy:: zero_divided_by_zero) ]
497
499
pub const INFINITY : f64 = 1.0_f64 / 0.0_f64 ;
498
500
/// Negative infinity (−∞).
499
501
#[ stable( feature = "assoc_int_consts" , since = "1.43.0" ) ]
502
+ #[ allow( clippy:: zero_divided_by_zero) ]
500
503
pub const NEG_INFINITY : f64 = -1.0_f64 / 0.0_f64 ;
501
504
502
505
/// 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) {
142
142
const X2 : u32 = 100 ;
143
143
const X1 : u32 = 10 ;
144
144
145
+ #[ allow( clippy:: collapsible_else_if) ]
145
146
if x < X4 {
146
147
if x < X2 {
147
148
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> {
19
19
20
20
impl < ' a > Part < ' a > {
21
21
/// Returns the exact byte length of given part.
22
+ #[ allow( clippy:: len_without_is_empty) ]
22
23
pub fn len ( & self ) -> usize {
23
24
match * self {
24
25
Part :: Zero ( nzeroes) => nzeroes,
@@ -31,8 +32,10 @@ impl<'a> Part<'a> {
31
32
} else {
32
33
3
33
34
}
35
+ } else if v < 10_000 {
36
+ 4
34
37
} else {
35
- if v < 10_000 { 4 } else { 5 }
38
+ 5
36
39
}
37
40
}
38
41
Part :: Copy ( buf) => buf. len ( ) ,
@@ -81,6 +84,7 @@ pub struct Formatted<'a> {
81
84
82
85
impl < ' a > Formatted < ' a > {
83
86
/// Returns the exact byte length of combined formatted result.
87
+ #[ allow( clippy:: len_without_is_empty) ]
84
88
pub fn len ( & self ) -> usize {
85
89
let mut len = self . sign . len ( ) ;
86
90
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 {
1412
1412
/// ```
1413
1413
#[ inline]
1414
1414
fn from_str( src: & str ) -> Result <$int_ty, ParseIntError > {
1415
+ #[ allow( clippy:: from_str_radix_10) ]
1415
1416
<$int_ty>:: from_str_radix( src, 10 )
1416
1417
}
1417
1418
}
Original file line number Diff line number Diff line change @@ -1158,6 +1158,7 @@ macro_rules! nonzero_integer {
1158
1158
impl FromStr for NonZero <$Int> {
1159
1159
type Err = ParseIntError ;
1160
1160
fn from_str( src: & str ) -> Result <Self , Self :: Err > {
1161
+ #[ allow( clippy:: from_str_radix_10) ]
1161
1162
Self :: new( <$Int>:: from_str_radix( src, 10 ) ?)
1162
1163
. ok_or( ParseIntError {
1163
1164
kind: IntErrorKind :: Zero
You can’t perform that action at this time.
0 commit comments