]> git.lizzy.rs Git - rust.git/blob - src/test/ui/rfc-2497-if-let-chains/irrefutable-lets.disallowed.stderr
Rollup merge of #105758 - Nilstrieb:typeck-results-mod, r=compiler-errors
[rust.git] / src / test / ui / rfc-2497-if-let-chains / irrefutable-lets.disallowed.stderr
1 error: leading irrefutable pattern in let chain
2   --> $DIR/irrefutable-lets.rs:13:8
3    |
4 LL |     if let first = &opt && let Some(ref second) = first && let None = second.start {}
5    |        ^^^^^^^^^^^^^^^^
6    |
7    = note: this pattern will always match
8    = help: consider moving it outside of the construct
9 note: the lint level is defined here
10   --> $DIR/irrefutable-lets.rs:6:30
11    |
12 LL | #![cfg_attr(disallowed, deny(irrefutable_let_patterns))]
13    |                              ^^^^^^^^^^^^^^^^^^^^^^^^
14
15 error: irrefutable `if let` patterns
16   --> $DIR/irrefutable-lets.rs:19:8
17    |
18 LL |     if let first = &opt && let (a, b) = (1, 2) {}
19    |        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
20    |
21    = note: these patterns will always match, so the `if let` is useless
22    = help: consider replacing the `if let` with a `let`
23
24 error: leading irrefutable pattern in let chain
25   --> $DIR/irrefutable-lets.rs:22:8
26    |
27 LL |     if let first = &opt && let Some(ref second) = first && let None = second.start && let v = 0 {}
28    |        ^^^^^^^^^^^^^^^^
29    |
30    = note: this pattern will always match
31    = help: consider moving it outside of the construct
32
33 error: trailing irrefutable pattern in let chain
34   --> $DIR/irrefutable-lets.rs:22:87
35    |
36 LL |     if let first = &opt && let Some(ref second) = first && let None = second.start && let v = 0 {}
37    |                                                                                       ^^^^^^^^^
38    |
39    = note: this pattern will always match
40    = help: consider moving it into the body
41
42 error: trailing irrefutable patterns in let chain
43   --> $DIR/irrefutable-lets.rs:26:37
44    |
45 LL |     if let Some(ref first) = opt && let second = first && let _third = second {}
46    |                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
47    |
48    = note: these patterns will always match
49    = help: consider moving them into the body
50
51 error: leading irrefutable pattern in let chain
52   --> $DIR/irrefutable-lets.rs:29:8
53    |
54 LL |     if let Range { start: local_start, end: _ } = (None..Some(1)) && let None = local_start {}
55    |        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
56    |
57    = note: this pattern will always match
58    = help: consider moving it outside of the construct
59
60 error: leading irrefutable pattern in let chain
61   --> $DIR/irrefutable-lets.rs:32:8
62    |
63 LL |     if let (a, b, c) = (Some(1), Some(1), Some(1)) && let None = Some(1) {}
64    |        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
65    |
66    = note: this pattern will always match
67    = help: consider moving it outside of the construct
68
69 error: leading irrefutable pattern in let chain
70   --> $DIR/irrefutable-lets.rs:35:8
71    |
72 LL |     if let first = &opt && let None = Some(1) {}
73    |        ^^^^^^^^^^^^^^^^
74    |
75    = note: this pattern will always match
76    = help: consider moving it outside of the construct
77
78 error: irrefutable `if let` guard patterns
79   --> $DIR/irrefutable-lets.rs:44:28
80    |
81 LL |         Some(ref first) if let second = first && let _third = second && let v = 4 + 4 => {},
82    |                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
83    |
84    = note: these patterns will always match, so the guard is useless
85    = help: consider removing the guard and adding a `let` inside the match arm
86
87 error: trailing irrefutable patterns in let chain
88   --> $DIR/irrefutable-lets.rs:59:16
89    |
90 LL |             && let v = local_end && let w = v => {},
91    |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
92    |
93    = note: these patterns will always match
94    = help: consider moving them into the body
95
96 error: irrefutable `while let` patterns
97   --> $DIR/irrefutable-lets.rs:68:11
98    |
99 LL |     while let first = &opt && let (a, b) = (1, 2) {}
100    |           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
101    |
102    = note: these patterns will always match, so the loop will never exit
103    = help: consider instead using a `loop { ... }` with a `let` inside it
104
105 error: trailing irrefutable patterns in let chain
106   --> $DIR/irrefutable-lets.rs:71:40
107    |
108 LL |     while let Some(ref first) = opt && let second = first && let _third = second {}
109    |                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
110    |
111    = note: these patterns will always match
112    = help: consider moving them into the body
113
114 error: aborting due to 12 previous errors
115