]> git.lizzy.rs Git - rust.git/blob - tests/ui/let_if_seq.stderr
rustup and compile-fail -> ui test move
[rust.git] / tests / ui / let_if_seq.stderr
1 error: `if _ { .. } else { .. }` is an expression
2   --> $DIR/let_if_seq.rs:57:5
3    |
4 57 |       let mut foo = 0;
5    |  _____^ starting here...
6 58 | |     //~^ ERROR `if _ { .. } else { .. }` is an expression
7 59 | |     //~| HELP more idiomatic
8 60 | |     //~| SUGGESTION let <mut> foo = if f() { 42 } else { 0 };
9 61 | |     if f() {
10 62 | |         foo = 42;
11 63 | |     }
12    | |_____^ ...ending here
13    |
14 note: lint level defined here
15   --> $DIR/let_if_seq.rs:5:9
16    |
17 5  | #![deny(useless_let_if_seq)]
18    |         ^^^^^^^^^^^^^^^^^^
19 help: it is more idiomatic to write
20    |     let <mut> foo = if f() { 42 } else { 0 };
21    = note: you might not need `mut` at all
22
23 error: `if _ { .. } else { .. }` is an expression
24   --> $DIR/let_if_seq.rs:65:5
25    |
26 65 |     let mut bar = 0;
27    |     ^
28    |
29 help: it is more idiomatic to write
30    |     let <mut> bar = if f() { ..; 42 } else { ..; 0 };
31    = note: you might not need `mut` at all
32
33 error: `if _ { .. } else { .. }` is an expression
34   --> $DIR/let_if_seq.rs:77:5
35    |
36 77 |     let quz;
37    |     ^
38    |
39 help: it is more idiomatic to write
40    |     let quz = if f() { 42 } else { 0 };
41
42 error: `if _ { .. } else { .. }` is an expression
43    --> $DIR/let_if_seq.rs:111:5
44     |
45 111 |       let mut baz = 0;
46     |  _____^ starting here...
47 112 | |     //~^ ERROR `if _ { .. } else { .. }` is an expression
48 113 | |     //~| HELP more idiomatic
49 114 | |     //~| SUGGESTION let <mut> baz = if f() { 42 } else { 0 };
50 115 | |     if f() {
51 116 | |         baz = 42;
52 117 | |     }
53     | |_____^ ...ending here
54     |
55 help: it is more idiomatic to write
56     |     let <mut> baz = if f() { 42 } else { 0 };
57     = note: you might not need `mut` at all
58
59 error: aborting due to 4 previous errors
60