mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-24 05:33:27 +00:00
50 lines
1.4 KiB
Text
50 lines
1.4 KiB
Text
error: `if _ { .. } else { .. }` is an expression
|
|
--> $DIR/let_if_seq.rs:72:5
|
|
|
|
|
72 | / let mut foo = 0;
|
|
73 | | if f() {
|
|
74 | | foo = 42;
|
|
75 | | }
|
|
| |_____^ help: it is more idiomatic to write: `let <mut> foo = if f() { 42 } else { 0 };`
|
|
|
|
|
= note: `-D clippy::useless-let-if-seq` implied by `-D warnings`
|
|
= note: you might not need `mut` at all
|
|
|
|
error: `if _ { .. } else { .. }` is an expression
|
|
--> $DIR/let_if_seq.rs:77:5
|
|
|
|
|
77 | / let mut bar = 0;
|
|
78 | | if f() {
|
|
79 | | f();
|
|
80 | | bar = 42;
|
|
81 | | } else {
|
|
82 | | f();
|
|
83 | | }
|
|
| |_____^ help: it is more idiomatic to write: `let <mut> bar = if f() { ..; 42 } else { ..; 0 };`
|
|
|
|
|
= note: you might not need `mut` at all
|
|
|
|
error: `if _ { .. } else { .. }` is an expression
|
|
--> $DIR/let_if_seq.rs:85:5
|
|
|
|
|
85 | / let quz;
|
|
86 | | if f() {
|
|
87 | | quz = 42;
|
|
88 | | } else {
|
|
89 | | quz = 0;
|
|
90 | | }
|
|
| |_____^ help: it is more idiomatic to write: `let quz = if f() { 42 } else { 0 };`
|
|
|
|
error: `if _ { .. } else { .. }` is an expression
|
|
--> $DIR/let_if_seq.rs:114:5
|
|
|
|
|
114 | / let mut baz = 0;
|
|
115 | | if f() {
|
|
116 | | baz = 42;
|
|
117 | | }
|
|
| |_____^ help: it is more idiomatic to write: `let <mut> baz = if f() { 42 } else { 0 };`
|
|
|
|
|
= note: you might not need `mut` at all
|
|
|
|
error: aborting due to 4 previous errors
|
|
|