Auto merge of #12692 - c410-f3r:arrrr, r=Manishearth
[arithmetic_side_effects] Fix #12318 Fix #12318 changelog: [arithmetic_side_effects]: Consider method calls that correspond to arithmetic symbols
This commit is contained in:
commit
7fcaa60efd
3 changed files with 61 additions and 16 deletions
|
|
@ -521,4 +521,14 @@ pub fn issue_11393() {
|
|||
example_rem(x, maybe_zero);
|
||||
}
|
||||
|
||||
pub fn issue_12318() {
|
||||
use core::ops::{AddAssign, DivAssign, MulAssign, RemAssign, SubAssign};
|
||||
let mut one: i32 = 1;
|
||||
one.add_assign(1);
|
||||
one.div_assign(1);
|
||||
one.mul_assign(1);
|
||||
one.rem_assign(1);
|
||||
one.sub_assign(1);
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
|
|
|||
|
|
@ -715,5 +715,17 @@ error: arithmetic operation that can potentially result in unexpected side-effec
|
|||
LL | x % maybe_zero
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to 119 previous errors
|
||||
error: arithmetic operation that can potentially result in unexpected side-effects
|
||||
--> tests/ui/arithmetic_side_effects.rs:527:5
|
||||
|
|
||||
LL | one.add_assign(1);
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: arithmetic operation that can potentially result in unexpected side-effects
|
||||
--> tests/ui/arithmetic_side_effects.rs:531:5
|
||||
|
|
||||
LL | one.sub_assign(1);
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to 121 previous errors
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue