mirror of
https://github.com/rust-lang/rust.git
synced 2025-09-28 21:55:31 +00:00

When encountering a typo in a pattern that gets interpreted as an unused binding, look for unit struct/variant of the same type as the binding: ``` error: unused variable: `Non` --> $DIR/binding-typo-2.rs:36:9 | LL | Non => {} | ^^^ | help: if this is intentional, prefix it with an underscore | LL | _Non => {} | + help: you might have meant to pattern match on the similarly named variant `None` | LL - Non => {} LL + std::prelude::v1::None => {} | ```
32 lines
969 B
Plaintext
32 lines
969 B
Plaintext
error[E0408]: variable `Ban` is not bound in all patterns
|
|
--> $DIR/binding-typo.rs:12:9
|
|
|
|
|
LL | (Foo, Bar) | (Ban, Foo) => {}
|
|
| ^^^^^^^^^^ --- variable not in all patterns
|
|
| |
|
|
| pattern doesn't bind `Ban`
|
|
|
|
|
help: you might have meant to use the similarly named previously used binding `Bar`
|
|
|
|
|
LL - (Foo, Bar) | (Ban, Foo) => {}
|
|
LL + (Foo, Bar) | (Bar, Foo) => {}
|
|
|
|
|
|
|
error[E0408]: variable `Ban` is not bound in all patterns
|
|
--> $DIR/binding-typo.rs:20:9
|
|
|
|
|
LL | (Foo, _) | (Ban, Foo) => {}
|
|
| ^^^^^^^^ --- variable not in all patterns
|
|
| |
|
|
| pattern doesn't bind `Ban`
|
|
|
|
|
help: you might have meant to use the similarly named unit variant `Bar`
|
|
|
|
|
LL - (Foo, _) | (Ban, Foo) => {}
|
|
LL + (Foo, _) | (Bar, Foo) => {}
|
|
|
|
|
|
|
error: aborting due to 2 previous errors
|
|
|
|
For more information about this error, try `rustc --explain E0408`.
|