2017-02-07 20:05:30 +00:00
|
|
|
error: `if _ { .. } else { .. }` is an expression
|
2018-12-10 05:27:19 +00:00
|
|
|
--> $DIR/let_if_seq.rs:72:5
|
2017-02-07 20:05:30 +00:00
|
|
|
|
|
2018-12-10 05:27:19 +00:00
|
|
|
72 | / let mut foo = 0;
|
|
|
|
73 | | if f() {
|
|
|
|
74 | | foo = 42;
|
|
|
|
75 | | }
|
2017-07-21 08:40:23 +00:00
|
|
|
| |_____^ help: it is more idiomatic to write: `let <mut> foo = if f() { 42 } else { 0 };`
|
2017-02-07 20:05:30 +00:00
|
|
|
|
|
2018-08-01 14:30:44 +00:00
|
|
|
= note: `-D clippy::useless-let-if-seq` implied by `-D warnings`
|
2017-02-07 20:05:30 +00:00
|
|
|
= note: you might not need `mut` at all
|
|
|
|
|
|
|
|
error: `if _ { .. } else { .. }` is an expression
|
2018-12-10 05:27:19 +00:00
|
|
|
--> $DIR/let_if_seq.rs:77:5
|
2017-02-07 20:05:30 +00:00
|
|
|
|
|
2018-12-10 05:27:19 +00:00
|
|
|
77 | / let mut bar = 0;
|
|
|
|
78 | | if f() {
|
|
|
|
79 | | f();
|
|
|
|
80 | | bar = 42;
|
|
|
|
81 | | } else {
|
|
|
|
82 | | f();
|
|
|
|
83 | | }
|
2017-07-21 08:40:23 +00:00
|
|
|
| |_____^ help: it is more idiomatic to write: `let <mut> bar = if f() { ..; 42 } else { ..; 0 };`
|
2017-02-07 20:05:30 +00:00
|
|
|
|
|
|
|
|
= note: you might not need `mut` at all
|
|
|
|
|
|
|
|
error: `if _ { .. } else { .. }` is an expression
|
2018-12-10 05:27:19 +00:00
|
|
|
--> $DIR/let_if_seq.rs:85:5
|
2017-02-07 20:05:30 +00:00
|
|
|
|
|
2018-12-10 05:27:19 +00:00
|
|
|
85 | / let quz;
|
|
|
|
86 | | if f() {
|
|
|
|
87 | | quz = 42;
|
|
|
|
88 | | } else {
|
|
|
|
89 | | quz = 0;
|
|
|
|
90 | | }
|
2017-07-21 08:40:23 +00:00
|
|
|
| |_____^ help: it is more idiomatic to write: `let quz = if f() { 42 } else { 0 };`
|
2017-02-07 20:05:30 +00:00
|
|
|
|
|
|
|
error: `if _ { .. } else { .. }` is an expression
|
2018-12-10 05:27:19 +00:00
|
|
|
--> $DIR/let_if_seq.rs:114:5
|
2017-02-07 20:05:30 +00:00
|
|
|
|
|
2018-12-10 05:27:19 +00:00
|
|
|
114 | / let mut baz = 0;
|
|
|
|
115 | | if f() {
|
|
|
|
116 | | baz = 42;
|
|
|
|
117 | | }
|
2017-07-21 08:40:23 +00:00
|
|
|
| |_____^ help: it is more idiomatic to write: `let <mut> baz = if f() { 42 } else { 0 };`
|
2017-02-07 20:05:30 +00:00
|
|
|
|
|
|
|
|
= note: you might not need `mut` at all
|
|
|
|
|
2018-01-16 16:06:27 +00:00
|
|
|
error: aborting due to 4 previous errors
|
|
|
|
|