blob: 33f9f56a5bbc87fb3c84d1d52672350b6142a60b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
// revisions: normal lint
// Test that putting the lint level on a match arm emits a warning, as this was previously
// meaningful and is no longer.
#![feature(non_exhaustive_omitted_patterns_lint)]
// aux-build:enums.rs
extern crate enums;
use enums::NonExhaustiveEnum;
fn main() {
let val = NonExhaustiveEnum::Unit;
#[deny(non_exhaustive_omitted_patterns)]
match val {
//~^ ERROR some variants are not matched explicitly
NonExhaustiveEnum::Unit => {}
NonExhaustiveEnum::Tuple(_) => {}
_ => {}
}
#[cfg_attr(lint, deny(non_exhaustive_omitted_patterns))]
match val {
//[lint]~^ ERROR some variants are not matched explicitly
NonExhaustiveEnum::Unit => {}
NonExhaustiveEnum::Tuple(_) => {}
_ => {}
}
match val {
NonExhaustiveEnum::Unit => {}
NonExhaustiveEnum::Tuple(_) => {}
#[deny(non_exhaustive_omitted_patterns)]
_ => {}
}
//~^^ WARN lint level must be set on the whole match
match val {
NonExhaustiveEnum::Unit => {}
NonExhaustiveEnum::Tuple(_) => {}
#[cfg_attr(lint, deny(non_exhaustive_omitted_patterns))]
_ => {}
}
//[lint]~^^ WARN lint level must be set on the whole match
match val {
NonExhaustiveEnum::Unit => {}
NonExhaustiveEnum::Tuple(_) => {}
#[cfg_attr(lint, warn(non_exhaustive_omitted_patterns))]
_ => {}
}
//[lint]~^^ WARN lint level must be set on the whole match
}
|