put parentheses around neg_multiply suggestion if needed
This commit is contained in:
parent
93c6f9ebed
commit
6fc84d4da3
4 changed files with 27 additions and 2 deletions
|
|
@ -38,6 +38,9 @@ fn main() {
|
|||
|
||||
0xcafe | -0xff00;
|
||||
|
||||
-(3_usize as i32);
|
||||
-(3_usize as i32);
|
||||
|
||||
-1 * -1; // should be ok
|
||||
|
||||
X * -1; // should be ok
|
||||
|
|
|
|||
|
|
@ -38,6 +38,9 @@ fn main() {
|
|||
|
||||
0xcafe | 0xff00 * -1;
|
||||
|
||||
3_usize as i32 * -1;
|
||||
(3_usize as i32) * -1;
|
||||
|
||||
-1 * -1; // should be ok
|
||||
|
||||
X * -1; // should be ok
|
||||
|
|
|
|||
|
|
@ -36,5 +36,17 @@ error: this multiplication by -1 can be written more succinctly
|
|||
LL | 0xcafe | 0xff00 * -1;
|
||||
| ^^^^^^^^^^^ help: consider using: `-0xff00`
|
||||
|
||||
error: aborting due to 6 previous errors
|
||||
error: this multiplication by -1 can be written more succinctly
|
||||
--> $DIR/neg_multiply.rs:41:5
|
||||
|
|
||||
LL | 3_usize as i32 * -1;
|
||||
| ^^^^^^^^^^^^^^^^^^^ help: consider using: `-(3_usize as i32)`
|
||||
|
||||
error: this multiplication by -1 can be written more succinctly
|
||||
--> $DIR/neg_multiply.rs:42:5
|
||||
|
|
||||
LL | (3_usize as i32) * -1;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^ help: consider using: `-(3_usize as i32)`
|
||||
|
||||
error: aborting due to 8 previous errors
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue