diff options
| author | y21 <30553356+y21@users.noreply.github.com> | 2023-07-13 00:24:10 +0200 |
|---|---|---|
| committer | y21 <30553356+y21@users.noreply.github.com> | 2023-07-13 00:24:10 +0200 |
| commit | c5fc61ca9485d8ccf1e0865ed675edfacddd5d57 (patch) | |
| tree | eb0e25d49da522c81576023b470676aa86ee1d79 | |
| parent | 3be3fb7231677e043317ef026989584ba9a23e37 (diff) | |
| download | rust-c5fc61ca9485d8ccf1e0865ed675edfacddd5d57.tar.gz rust-c5fc61ca9485d8ccf1e0865ed675edfacddd5d57.zip | |
[`arithmetic_side_effect`]: allow different rhs type
| -rw-r--r-- | clippy_lints/src/operators/arithmetic_side_effects.rs | 4 | ||||
| -rw-r--r-- | tests/ui/arithmetic_side_effects.rs | 5 |
2 files changed, 7 insertions, 2 deletions
diff --git a/clippy_lints/src/operators/arithmetic_side_effects.rs b/clippy_lints/src/operators/arithmetic_side_effects.rs index 5c240276b76..47873f3b071 100644 --- a/clippy_lints/src/operators/arithmetic_side_effects.rs +++ b/clippy_lints/src/operators/arithmetic_side_effects.rs @@ -19,8 +19,8 @@ use rustc_span::{ const HARD_CODED_ALLOWED_BINARY: &[[&str; 2]] = &[ ["f32", "f32"], ["f64", "f64"], - ["std::num::Saturating", "std::num::Saturating"], - ["std::num::Wrapping", "std::num::Wrapping"], + ["std::num::Saturating", "*"], + ["std::num::Wrapping", "*"], ["std::string::String", "str"], ]; const HARD_CODED_ALLOWED_UNARY: &[&str] = &["f32", "f64", "std::num::Saturating", "std::num::Wrapping"]; diff --git a/tests/ui/arithmetic_side_effects.rs b/tests/ui/arithmetic_side_effects.rs index 4f38e50c81d..ed75acee8a2 100644 --- a/tests/ui/arithmetic_side_effects.rs +++ b/tests/ui/arithmetic_side_effects.rs @@ -481,4 +481,9 @@ pub fn issue_10792() { let _ = 10 / TWO.c; } +pub fn issue_11145() { + let mut x: Wrapping<u32> = Wrapping(0_u32); + x += 1; +} + fn main() {} |
