mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-12-22 02:53:20 +00:00
56 lines
1.5 KiB
Text
56 lines
1.5 KiB
Text
error: `if _ { .. } else { .. }` is an expression
|
|
--> tests/ui/let_if_seq.rs:77:5
|
|
|
|
|
LL | / let mut foo = 0;
|
|
LL | |
|
|
LL | |
|
|
LL | | if f() {
|
|
LL | | foo = 42;
|
|
LL | | }
|
|
| |_____^ help: it is more idiomatic to write: `let <mut> foo = if f() { 42 } else { 0 };`
|
|
|
|
|
= note: you might not need `mut` at all
|
|
= note: `-D clippy::useless-let-if-seq` implied by `-D warnings`
|
|
= help: to override `-D warnings` add `#[allow(clippy::useless_let_if_seq)]`
|
|
|
|
error: `if _ { .. } else { .. }` is an expression
|
|
--> tests/ui/let_if_seq.rs:84:5
|
|
|
|
|
LL | / let mut bar = 0;
|
|
LL | |
|
|
LL | |
|
|
LL | | if f() {
|
|
... |
|
|
LL | | f();
|
|
LL | | }
|
|
| |_____^ 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
|
|
--> tests/ui/let_if_seq.rs:94:5
|
|
|
|
|
LL | / let quz;
|
|
LL | |
|
|
LL | | if f() {
|
|
LL | | quz = 42;
|
|
LL | | } else {
|
|
LL | | quz = 0;
|
|
LL | | }
|
|
| |_____^ help: it is more idiomatic to write: `let quz = if f() { 42 } else { 0 };`
|
|
|
|
error: `if _ { .. } else { .. }` is an expression
|
|
--> tests/ui/let_if_seq.rs:124:5
|
|
|
|
|
LL | / let mut baz = 0;
|
|
LL | |
|
|
LL | |
|
|
LL | | if f() {
|
|
LL | | baz = 42;
|
|
LL | | }
|
|
| |_____^ 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
|
|
|