mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-23 21:23:56 +00:00
38d4ac7cea
Discussion previously happened in https://github.com/rust-lang/rust/pull/43498
128 lines
3.8 KiB
Text
128 lines
3.8 KiB
Text
error: statement can be reduced
|
|
--> $DIR/unnecessary_operation.rs:45:5
|
|
|
|
|
LL | Tuple(get_number());
|
|
| ^^^^^^^^^^^^^^^^^^^^ help: replace it with: `get_number();`
|
|
|
|
|
= note: `-D clippy::unnecessary-operation` implied by `-D warnings`
|
|
|
|
error: statement can be reduced
|
|
--> $DIR/unnecessary_operation.rs:46:5
|
|
|
|
|
LL | Struct { field: get_number() };
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `get_number();`
|
|
|
|
error: statement can be reduced
|
|
--> $DIR/unnecessary_operation.rs:47:5
|
|
|
|
|
LL | Struct { ..get_struct() };
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `get_struct();`
|
|
|
|
error: statement can be reduced
|
|
--> $DIR/unnecessary_operation.rs:48:5
|
|
|
|
|
LL | Enum::Tuple(get_number());
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `get_number();`
|
|
|
|
error: statement can be reduced
|
|
--> $DIR/unnecessary_operation.rs:49:5
|
|
|
|
|
LL | Enum::Struct { field: get_number() };
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `get_number();`
|
|
|
|
error: statement can be reduced
|
|
--> $DIR/unnecessary_operation.rs:50:5
|
|
|
|
|
LL | 5 + get_number();
|
|
| ^^^^^^^^^^^^^^^^^ help: replace it with: `5;get_number();`
|
|
|
|
error: statement can be reduced
|
|
--> $DIR/unnecessary_operation.rs:51:5
|
|
|
|
|
LL | *&get_number();
|
|
| ^^^^^^^^^^^^^^^ help: replace it with: `get_number();`
|
|
|
|
error: statement can be reduced
|
|
--> $DIR/unnecessary_operation.rs:52:5
|
|
|
|
|
LL | &get_number();
|
|
| ^^^^^^^^^^^^^^ help: replace it with: `get_number();`
|
|
|
|
error: statement can be reduced
|
|
--> $DIR/unnecessary_operation.rs:53:5
|
|
|
|
|
LL | (5, 6, get_number());
|
|
| ^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `5;6;get_number();`
|
|
|
|
error: statement can be reduced
|
|
--> $DIR/unnecessary_operation.rs:54:5
|
|
|
|
|
LL | box get_number();
|
|
| ^^^^^^^^^^^^^^^^^ help: replace it with: `get_number();`
|
|
|
|
error: statement can be reduced
|
|
--> $DIR/unnecessary_operation.rs:55:5
|
|
|
|
|
LL | get_number()..;
|
|
| ^^^^^^^^^^^^^^^ help: replace it with: `get_number();`
|
|
|
|
error: statement can be reduced
|
|
--> $DIR/unnecessary_operation.rs:56:5
|
|
|
|
|
LL | ..get_number();
|
|
| ^^^^^^^^^^^^^^^ help: replace it with: `get_number();`
|
|
|
|
error: statement can be reduced
|
|
--> $DIR/unnecessary_operation.rs:57:5
|
|
|
|
|
LL | 5..get_number();
|
|
| ^^^^^^^^^^^^^^^^ help: replace it with: `5;get_number();`
|
|
|
|
error: statement can be reduced
|
|
--> $DIR/unnecessary_operation.rs:58:5
|
|
|
|
|
LL | [42, get_number()];
|
|
| ^^^^^^^^^^^^^^^^^^^ help: replace it with: `42;get_number();`
|
|
|
|
error: statement can be reduced
|
|
--> $DIR/unnecessary_operation.rs:59:5
|
|
|
|
|
LL | [42, 55][get_number() as usize];
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `[42, 55];get_number() as usize;`
|
|
|
|
error: statement can be reduced
|
|
--> $DIR/unnecessary_operation.rs:60:5
|
|
|
|
|
LL | (42, get_number()).1;
|
|
| ^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `42;get_number();`
|
|
|
|
error: statement can be reduced
|
|
--> $DIR/unnecessary_operation.rs:61:5
|
|
|
|
|
LL | [get_number(); 55];
|
|
| ^^^^^^^^^^^^^^^^^^^ help: replace it with: `get_number();`
|
|
|
|
error: statement can be reduced
|
|
--> $DIR/unnecessary_operation.rs:62:5
|
|
|
|
|
LL | [42; 55][get_number() as usize];
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `[42; 55];get_number() as usize;`
|
|
|
|
error: statement can be reduced
|
|
--> $DIR/unnecessary_operation.rs:63:5
|
|
|
|
|
LL | / {
|
|
LL | | get_number()
|
|
LL | | };
|
|
| |______^ help: replace it with: `get_number();`
|
|
|
|
error: statement can be reduced
|
|
--> $DIR/unnecessary_operation.rs:66:5
|
|
|
|
|
LL | / FooString {
|
|
LL | | s: String::from("blah"),
|
|
LL | | };
|
|
| |______^ help: replace it with: `String::from("blah");`
|
|
|
|
error: aborting due to 20 previous errors
|
|
|