Skip to content

Commit 3e1f862

Browse files
committed
clean-up tests
1 parent 35f8bff commit 3e1f862

File tree

2 files changed

+16
-19
lines changed

2 files changed

+16
-19
lines changed

tests/ui/option_option.rs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,52 @@
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)]
33

44
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
66
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
88

99
fn input(_: Option<Option<u8>>) {}
10-
//~^ ERROR: consider using `Option<T>` instead of `Option<Option<T>>` or a custom enum if
10+
//~^ option_option
1111

1212
fn output() -> Option<Option<u8>> {
13-
//~^ ERROR: consider using `Option<T>` instead of `Option<Option<T>>` or a custom enum if
13+
//~^ option_option
1414
None
1515
}
1616

1717
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
1919
vec![None]
2020
}
2121

2222
// The lint only generates one warning for this
2323
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
2525
None
2626
}
2727

2828
struct Struct {
2929
x: Option<Option<u8>>,
30-
//~^ ERROR: consider using `Option<T>` instead of `Option<Option<T>>` or a custom enum
30+
//~^ option_option
3131
}
3232

3333
impl Struct {
3434
fn struct_fn() -> Option<Option<u8>> {
35-
//~^ ERROR: consider using `Option<T>` instead of `Option<Option<T>>` or a custom enum
35+
//~^ option_option
3636
None
3737
}
3838
}
3939

4040
trait Trait {
4141
fn trait_fn() -> Option<Option<u8>>;
42-
//~^ ERROR: consider using `Option<T>` instead of `Option<Option<T>>` or a custom enum
42+
//~^ option_option
4343
}
4444

4545
enum Enum {
4646
Tuple(Option<Option<u8>>),
47-
//~^ ERROR: consider using `Option<T>` instead of `Option<Option<T>>` or a custom enum
47+
//~^ option_option
4848
Struct { x: Option<Option<u8>> },
49-
//~^ ERROR: consider using `Option<T>` instead of `Option<Option<T>>` or a custom enum
49+
//~^ option_option
5050
}
5151

5252
// The lint allows this
@@ -88,7 +88,7 @@ mod issue_4298 {
8888
#[serde(default)]
8989
#[serde(borrow)]
9090
foo: Option<Option<Cow<'a, str>>>,
91-
//~^ ERROR: consider using `Option<T>` instead of `Option<Option<T>>` or a custom
91+
//~^ option_option
9292
}
9393

9494
#[allow(clippy::option_option)]

tests/ui/option_option.stderr

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,8 @@ error: consider using `Option<T>` instead of `Option<Option<T>>` or a custom enu
44
LL | const C: Option<Option<i32>> = None;
55
| ^^^^^^^^^^^^^^^^^^^
66
|
7-
note: the lint level is defined here
8-
--> tests/ui/option_option.rs:1:9
9-
|
10-
LL | #![deny(clippy::option_option)]
11-
| ^^^^^^^^^^^^^^^^^^^^^
7+
= note: `-D clippy::option-option` implied by `-D warnings`
8+
= help: to override `-D warnings` add `#[allow(clippy::option_option)]`
129

1310
error: consider using `Option<T>` instead of `Option<Option<T>>` or a custom enum if you need to distinguish all 3 cases
1411
--> tests/ui/option_option.rs:6:11

0 commit comments

Comments
 (0)