@@ -40,7 +40,7 @@ declare_clippy_lint! {
40
40
/// i = i.saturating_sub(1);
41
41
/// ```
42
42
#[ clippy:: version = "1.44.0" ]
43
- pub IMPLICIT_SATURATING_SUB ,
43
+ pub MANUAL_SATURATING_SUB ,
44
44
style,
45
45
"Perform saturating subtraction instead of implicitly checking lower bound of data type"
46
46
}
@@ -70,24 +70,24 @@ declare_clippy_lint! {
70
70
/// let result = a.saturating_sub(b);
71
71
/// ```
72
72
#[ clippy:: version = "1.83.0" ]
73
- pub INVERTED_SATURATING_SUB ,
73
+ pub ALMOST_SATURATING_SUB ,
74
74
correctness,
75
75
"Check if a variable is smaller than another one and still subtract from it even if smaller"
76
76
}
77
77
78
- pub struct ImplicitSaturatingSub {
78
+ pub struct ManualSaturatingSub {
79
79
msrv : Msrv ,
80
80
}
81
81
82
- impl_lint_pass ! ( ImplicitSaturatingSub => [ IMPLICIT_SATURATING_SUB , INVERTED_SATURATING_SUB ] ) ;
82
+ impl_lint_pass ! ( ManualSaturatingSub => [ MANUAL_SATURATING_SUB , ALMOST_SATURATING_SUB ] ) ;
83
83
84
- impl ImplicitSaturatingSub {
84
+ impl ManualSaturatingSub {
85
85
pub fn new ( conf : & ' static Conf ) -> Self {
86
86
Self { msrv : conf. msrv }
87
87
}
88
88
}
89
89
90
- impl < ' tcx > LateLintPass < ' tcx > for ImplicitSaturatingSub {
90
+ impl < ' tcx > LateLintPass < ' tcx > for ManualSaturatingSub {
91
91
fn check_expr ( & mut self , cx : & LateContext < ' tcx > , expr : & ' tcx Expr < ' tcx > ) {
92
92
if expr. span . from_expansion ( ) {
93
93
return ;
@@ -249,7 +249,7 @@ fn check_subtraction(
249
249
) ;
250
250
span_lint_and_sugg (
251
251
cx,
252
- IMPLICIT_SATURATING_SUB ,
252
+ MANUAL_SATURATING_SUB ,
253
253
expr_span,
254
254
"manual arithmetic check found" ,
255
255
"replace it with" ,
@@ -265,7 +265,7 @@ fn check_subtraction(
265
265
let sugg = make_binop ( BinOpKind :: Sub , & big_expr_sugg, & little_expr_sugg) ;
266
266
span_lint_and_then (
267
267
cx,
268
- INVERTED_SATURATING_SUB ,
268
+ ALMOST_SATURATING_SUB ,
269
269
condition_span,
270
270
"inverted arithmetic check before subtraction" ,
271
271
|diag| {
@@ -386,7 +386,7 @@ fn subtracts_one<'a>(cx: &LateContext<'_>, expr: &'a Expr<'a>) -> Option<&'a Exp
386
386
fn print_lint_and_sugg ( cx : & LateContext < ' _ > , var_name : Symbol , expr : & Expr < ' _ > ) {
387
387
span_lint_and_sugg (
388
388
cx,
389
- IMPLICIT_SATURATING_SUB ,
389
+ MANUAL_SATURATING_SUB ,
390
390
expr. span ,
391
391
"implicitly performing saturating subtraction" ,
392
392
"try" ,
0 commit comments