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