Skip to content

Commit c5fc61c

Browse files
committed
[arithmetic_side_effect]: allow different rhs type
1 parent 3be3fb7 commit c5fc61c

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

clippy_lints/src/operators/arithmetic_side_effects.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ use rustc_span::{
1919
const HARD_CODED_ALLOWED_BINARY: &[[&str; 2]] = &[
2020
["f32", "f32"],
2121
["f64", "f64"],
22-
["std::num::Saturating", "std::num::Saturating"],
23-
["std::num::Wrapping", "std::num::Wrapping"],
22+
["std::num::Saturating", "*"],
23+
["std::num::Wrapping", "*"],
2424
["std::string::String", "str"],
2525
];
2626
const HARD_CODED_ALLOWED_UNARY: &[&str] = &["f32", "f64", "std::num::Saturating", "std::num::Wrapping"];

tests/ui/arithmetic_side_effects.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -481,4 +481,9 @@ pub fn issue_10792() {
481481
let _ = 10 / TWO.c;
482482
}
483483

484+
pub fn issue_11145() {
485+
let mut x: Wrapping<u32> = Wrapping(0_u32);
486+
x += 1;
487+
}
488+
484489
fn main() {}

0 commit comments

Comments
 (0)