|
1 | | -#![deny(clippy::option_option)] |
2 | | -#![allow(clippy::unnecessary_wraps, clippy::manual_unwrap_or_default)] |
| 1 | +#![warn(clippy::option_option)] |
| 2 | +#![expect(clippy::unnecessary_wraps)] |
3 | 3 |
|
4 | 4 | const C: Option<Option<i32>> = None; |
5 | | -//~^ ERROR: consider using `Option<T>` instead of `Option<Option<T>>` or a custom enum if |
| 5 | +//~^ option_option |
6 | 6 | static S: Option<Option<i32>> = None; |
7 | | -//~^ ERROR: consider using `Option<T>` instead of `Option<Option<T>>` or a custom enum if |
| 7 | +//~^ option_option |
8 | 8 |
|
9 | 9 | fn input(_: Option<Option<u8>>) {} |
10 | | -//~^ ERROR: consider using `Option<T>` instead of `Option<Option<T>>` or a custom enum if |
| 10 | +//~^ option_option |
11 | 11 |
|
12 | 12 | fn output() -> Option<Option<u8>> { |
13 | | - //~^ ERROR: consider using `Option<T>` instead of `Option<Option<T>>` or a custom enum if |
| 13 | + //~^ option_option |
14 | 14 | None |
15 | 15 | } |
16 | 16 |
|
17 | 17 | fn output_nested() -> Vec<Option<Option<u8>>> { |
18 | | - //~^ ERROR: consider using `Option<T>` instead of `Option<Option<T>>` or a custom enum if |
| 18 | + //~^ option_option |
19 | 19 | vec![None] |
20 | 20 | } |
21 | 21 |
|
22 | 22 | // The lint only generates one warning for this |
23 | 23 | fn output_nested_nested() -> Option<Option<Option<u8>>> { |
24 | | - //~^ ERROR: consider using `Option<T>` instead of `Option<Option<T>>` or a custom enum if |
| 24 | + //~^ option_option |
25 | 25 | None |
26 | 26 | } |
27 | 27 |
|
28 | 28 | struct Struct { |
29 | 29 | x: Option<Option<u8>>, |
30 | | - //~^ ERROR: consider using `Option<T>` instead of `Option<Option<T>>` or a custom enum |
| 30 | + //~^ option_option |
31 | 31 | } |
32 | 32 |
|
33 | 33 | impl Struct { |
34 | 34 | fn struct_fn() -> Option<Option<u8>> { |
35 | | - //~^ ERROR: consider using `Option<T>` instead of `Option<Option<T>>` or a custom enum |
| 35 | + //~^ option_option |
36 | 36 | None |
37 | 37 | } |
38 | 38 | } |
39 | 39 |
|
40 | 40 | trait Trait { |
41 | 41 | fn trait_fn() -> Option<Option<u8>>; |
42 | | - //~^ ERROR: consider using `Option<T>` instead of `Option<Option<T>>` or a custom enum |
| 42 | + //~^ option_option |
43 | 43 | } |
44 | 44 |
|
45 | 45 | enum Enum { |
46 | 46 | Tuple(Option<Option<u8>>), |
47 | | - //~^ ERROR: consider using `Option<T>` instead of `Option<Option<T>>` or a custom enum |
| 47 | + //~^ option_option |
48 | 48 | Struct { x: Option<Option<u8>> }, |
49 | | - //~^ ERROR: consider using `Option<T>` instead of `Option<Option<T>>` or a custom enum |
| 49 | + //~^ option_option |
50 | 50 | } |
51 | 51 |
|
52 | 52 | // The lint allows this |
@@ -88,7 +88,7 @@ mod issue_4298 { |
88 | 88 | #[serde(default)] |
89 | 89 | #[serde(borrow)] |
90 | 90 | foo: Option<Option<Cow<'a, str>>>, |
91 | | - //~^ ERROR: consider using `Option<T>` instead of `Option<Option<T>>` or a custom |
| 91 | + //~^ option_option |
92 | 92 | } |
93 | 93 |
|
94 | 94 | #[allow(clippy::option_option)] |
|
0 commit comments