Skip to content

Commit 97868e3

Browse files
committed
Allow this lint on lint tests
1 parent 8be8a1e commit 97868e3

40 files changed

+183
-159
lines changed

tests/ui/derive_ord_xor_partial_ord.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#![warn(clippy::derive_ord_xor_partial_ord)]
2+
#![allow(clippy::unnecessary_wrap)]
23

34
use std::cmp::Ordering;
45

tests/ui/derive_ord_xor_partial_ord.stderr

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
error: you are deriving `Ord` but have implemented `PartialOrd` explicitly
2-
--> $DIR/derive_ord_xor_partial_ord.rs:20:10
2+
--> $DIR/derive_ord_xor_partial_ord.rs:21:10
33
|
44
LL | #[derive(Ord, PartialEq, Eq)]
55
| ^^^
66
|
77
= note: `-D clippy::derive-ord-xor-partial-ord` implied by `-D warnings`
88
note: `PartialOrd` implemented here
9-
--> $DIR/derive_ord_xor_partial_ord.rs:23:1
9+
--> $DIR/derive_ord_xor_partial_ord.rs:24:1
1010
|
1111
LL | / impl PartialOrd for DeriveOrd {
1212
LL | | fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
@@ -17,13 +17,13 @@ LL | | }
1717
= note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
1818

1919
error: you are deriving `Ord` but have implemented `PartialOrd` explicitly
20-
--> $DIR/derive_ord_xor_partial_ord.rs:29:10
20+
--> $DIR/derive_ord_xor_partial_ord.rs:30:10
2121
|
2222
LL | #[derive(Ord, PartialEq, Eq)]
2323
| ^^^
2424
|
2525
note: `PartialOrd` implemented here
26-
--> $DIR/derive_ord_xor_partial_ord.rs:32:1
26+
--> $DIR/derive_ord_xor_partial_ord.rs:33:1
2727
|
2828
LL | / impl PartialOrd<DeriveOrdWithExplicitTypeVariable> for DeriveOrdWithExplicitTypeVariable {
2929
LL | | fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
@@ -34,7 +34,7 @@ LL | | }
3434
= note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
3535

3636
error: you are implementing `Ord` explicitly but have derived `PartialOrd`
37-
--> $DIR/derive_ord_xor_partial_ord.rs:41:1
37+
--> $DIR/derive_ord_xor_partial_ord.rs:42:1
3838
|
3939
LL | / impl std::cmp::Ord for DerivePartialOrd {
4040
LL | | fn cmp(&self, other: &Self) -> Ordering {
@@ -44,14 +44,14 @@ LL | | }
4444
| |_^
4545
|
4646
note: `PartialOrd` implemented here
47-
--> $DIR/derive_ord_xor_partial_ord.rs:38:10
47+
--> $DIR/derive_ord_xor_partial_ord.rs:39:10
4848
|
4949
LL | #[derive(PartialOrd, PartialEq, Eq)]
5050
| ^^^^^^^^^^
5151
= note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
5252

5353
error: you are implementing `Ord` explicitly but have derived `PartialOrd`
54-
--> $DIR/derive_ord_xor_partial_ord.rs:61:5
54+
--> $DIR/derive_ord_xor_partial_ord.rs:62:5
5555
|
5656
LL | / impl Ord for DerivePartialOrdInUseOrd {
5757
LL | | fn cmp(&self, other: &Self) -> Ordering {
@@ -61,7 +61,7 @@ LL | | }
6161
| |_____^
6262
|
6363
note: `PartialOrd` implemented here
64-
--> $DIR/derive_ord_xor_partial_ord.rs:58:14
64+
--> $DIR/derive_ord_xor_partial_ord.rs:59:14
6565
|
6666
LL | #[derive(PartialOrd, PartialEq, Eq)]
6767
| ^^^^^^^^^^

tests/ui/doc_errors.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// edition:2018
22
#![warn(clippy::missing_errors_doc)]
33
#![allow(clippy::result_unit_err)]
4+
#![allow(clippy::unnecessary_wrap)]
45

56
use std::io;
67

tests/ui/drop_ref.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#![warn(clippy::drop_ref)]
22
#![allow(clippy::toplevel_ref_arg)]
33
#![allow(clippy::map_err_ignore)]
4+
#![allow(clippy::unnecessary_wrap)]
45

56
use std::mem::drop;
67

tests/ui/forget_ref.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#![warn(clippy::forget_ref)]
22
#![allow(clippy::toplevel_ref_arg)]
3+
#![allow(clippy::unnecessary_wrap)]
34

45
use std::mem::forget;
56

tests/ui/forget_ref.stderr

+18-18
Original file line numberDiff line numberDiff line change
@@ -1,108 +1,108 @@
11
error: calls to `std::mem::forget` with a reference instead of an owned value. Forgetting a reference does nothing.
2-
--> $DIR/forget_ref.rs:9:5
2+
--> $DIR/forget_ref.rs:10:5
33
|
44
LL | forget(&SomeStruct);
55
| ^^^^^^^^^^^^^^^^^^^
66
|
77
= note: `-D clippy::forget-ref` implied by `-D warnings`
88
note: argument has type `&SomeStruct`
9-
--> $DIR/forget_ref.rs:9:12
9+
--> $DIR/forget_ref.rs:10:12
1010
|
1111
LL | forget(&SomeStruct);
1212
| ^^^^^^^^^^^
1313

1414
error: calls to `std::mem::forget` with a reference instead of an owned value. Forgetting a reference does nothing.
15-
--> $DIR/forget_ref.rs:12:5
15+
--> $DIR/forget_ref.rs:13:5
1616
|
1717
LL | forget(&owned);
1818
| ^^^^^^^^^^^^^^
1919
|
2020
note: argument has type `&SomeStruct`
21-
--> $DIR/forget_ref.rs:12:12
21+
--> $DIR/forget_ref.rs:13:12
2222
|
2323
LL | forget(&owned);
2424
| ^^^^^^
2525

2626
error: calls to `std::mem::forget` with a reference instead of an owned value. Forgetting a reference does nothing.
27-
--> $DIR/forget_ref.rs:13:5
27+
--> $DIR/forget_ref.rs:14:5
2828
|
2929
LL | forget(&&owned);
3030
| ^^^^^^^^^^^^^^^
3131
|
3232
note: argument has type `&&SomeStruct`
33-
--> $DIR/forget_ref.rs:13:12
33+
--> $DIR/forget_ref.rs:14:12
3434
|
3535
LL | forget(&&owned);
3636
| ^^^^^^^
3737

3838
error: calls to `std::mem::forget` with a reference instead of an owned value. Forgetting a reference does nothing.
39-
--> $DIR/forget_ref.rs:14:5
39+
--> $DIR/forget_ref.rs:15:5
4040
|
4141
LL | forget(&mut owned);
4242
| ^^^^^^^^^^^^^^^^^^
4343
|
4444
note: argument has type `&mut SomeStruct`
45-
--> $DIR/forget_ref.rs:14:12
45+
--> $DIR/forget_ref.rs:15:12
4646
|
4747
LL | forget(&mut owned);
4848
| ^^^^^^^^^^
4949

5050
error: calls to `std::mem::forget` with a reference instead of an owned value. Forgetting a reference does nothing.
51-
--> $DIR/forget_ref.rs:18:5
51+
--> $DIR/forget_ref.rs:19:5
5252
|
5353
LL | forget(&*reference1);
5454
| ^^^^^^^^^^^^^^^^^^^^
5555
|
5656
note: argument has type `&SomeStruct`
57-
--> $DIR/forget_ref.rs:18:12
57+
--> $DIR/forget_ref.rs:19:12
5858
|
5959
LL | forget(&*reference1);
6060
| ^^^^^^^^^^^^
6161

6262
error: calls to `std::mem::forget` with a reference instead of an owned value. Forgetting a reference does nothing.
63-
--> $DIR/forget_ref.rs:21:5
63+
--> $DIR/forget_ref.rs:22:5
6464
|
6565
LL | forget(reference2);
6666
| ^^^^^^^^^^^^^^^^^^
6767
|
6868
note: argument has type `&mut SomeStruct`
69-
--> $DIR/forget_ref.rs:21:12
69+
--> $DIR/forget_ref.rs:22:12
7070
|
7171
LL | forget(reference2);
7272
| ^^^^^^^^^^
7373

7474
error: calls to `std::mem::forget` with a reference instead of an owned value. Forgetting a reference does nothing.
75-
--> $DIR/forget_ref.rs:24:5
75+
--> $DIR/forget_ref.rs:25:5
7676
|
7777
LL | forget(reference3);
7878
| ^^^^^^^^^^^^^^^^^^
7979
|
8080
note: argument has type `&SomeStruct`
81-
--> $DIR/forget_ref.rs:24:12
81+
--> $DIR/forget_ref.rs:25:12
8282
|
8383
LL | forget(reference3);
8484
| ^^^^^^^^^^
8585

8686
error: calls to `std::mem::forget` with a reference instead of an owned value. Forgetting a reference does nothing.
87-
--> $DIR/forget_ref.rs:29:5
87+
--> $DIR/forget_ref.rs:30:5
8888
|
8989
LL | forget(&val);
9090
| ^^^^^^^^^^^^
9191
|
9292
note: argument has type `&T`
93-
--> $DIR/forget_ref.rs:29:12
93+
--> $DIR/forget_ref.rs:30:12
9494
|
9595
LL | forget(&val);
9696
| ^^^^
9797

9898
error: calls to `std::mem::forget` with a reference instead of an owned value. Forgetting a reference does nothing.
99-
--> $DIR/forget_ref.rs:37:5
99+
--> $DIR/forget_ref.rs:38:5
100100
|
101101
LL | std::mem::forget(&SomeStruct);
102102
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
103103
|
104104
note: argument has type `&SomeStruct`
105-
--> $DIR/forget_ref.rs:37:22
105+
--> $DIR/forget_ref.rs:38:22
106106
|
107107
LL | std::mem::forget(&SomeStruct);
108108
| ^^^^^^^^^^^

tests/ui/let_underscore_must_use.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#![warn(clippy::let_underscore_must_use)]
2+
#![allow(clippy::unnecessary_wrap)]
23

34
// Debug implementations can fire this lint,
45
// so we shouldn't lint external macros

tests/ui/let_underscore_must_use.stderr

+12-12
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: non-binding let on a result of a `#[must_use]` function
2-
--> $DIR/let_underscore_must_use.rs:66:5
2+
--> $DIR/let_underscore_must_use.rs:67:5
33
|
44
LL | let _ = f();
55
| ^^^^^^^^^^^^
@@ -8,87 +8,87 @@ LL | let _ = f();
88
= help: consider explicitly using function result
99

1010
error: non-binding let on an expression with `#[must_use]` type
11-
--> $DIR/let_underscore_must_use.rs:67:5
11+
--> $DIR/let_underscore_must_use.rs:68:5
1212
|
1313
LL | let _ = g();
1414
| ^^^^^^^^^^^^
1515
|
1616
= help: consider explicitly using expression value
1717

1818
error: non-binding let on a result of a `#[must_use]` function
19-
--> $DIR/let_underscore_must_use.rs:69:5
19+
--> $DIR/let_underscore_must_use.rs:70:5
2020
|
2121
LL | let _ = l(0_u32);
2222
| ^^^^^^^^^^^^^^^^^
2323
|
2424
= help: consider explicitly using function result
2525

2626
error: non-binding let on a result of a `#[must_use]` function
27-
--> $DIR/let_underscore_must_use.rs:73:5
27+
--> $DIR/let_underscore_must_use.rs:74:5
2828
|
2929
LL | let _ = s.f();
3030
| ^^^^^^^^^^^^^^
3131
|
3232
= help: consider explicitly using function result
3333

3434
error: non-binding let on an expression with `#[must_use]` type
35-
--> $DIR/let_underscore_must_use.rs:74:5
35+
--> $DIR/let_underscore_must_use.rs:75:5
3636
|
3737
LL | let _ = s.g();
3838
| ^^^^^^^^^^^^^^
3939
|
4040
= help: consider explicitly using expression value
4141

4242
error: non-binding let on a result of a `#[must_use]` function
43-
--> $DIR/let_underscore_must_use.rs:77:5
43+
--> $DIR/let_underscore_must_use.rs:78:5
4444
|
4545
LL | let _ = S::h();
4646
| ^^^^^^^^^^^^^^^
4747
|
4848
= help: consider explicitly using function result
4949

5050
error: non-binding let on an expression with `#[must_use]` type
51-
--> $DIR/let_underscore_must_use.rs:78:5
51+
--> $DIR/let_underscore_must_use.rs:79:5
5252
|
5353
LL | let _ = S::p();
5454
| ^^^^^^^^^^^^^^^
5555
|
5656
= help: consider explicitly using expression value
5757

5858
error: non-binding let on a result of a `#[must_use]` function
59-
--> $DIR/let_underscore_must_use.rs:80:5
59+
--> $DIR/let_underscore_must_use.rs:81:5
6060
|
6161
LL | let _ = S::a();
6262
| ^^^^^^^^^^^^^^^
6363
|
6464
= help: consider explicitly using function result
6565

6666
error: non-binding let on an expression with `#[must_use]` type
67-
--> $DIR/let_underscore_must_use.rs:82:5
67+
--> $DIR/let_underscore_must_use.rs:83:5
6868
|
6969
LL | let _ = if true { Ok(()) } else { Err(()) };
7070
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
7171
|
7272
= help: consider explicitly using expression value
7373

7474
error: non-binding let on a result of a `#[must_use]` function
75-
--> $DIR/let_underscore_must_use.rs:86:5
75+
--> $DIR/let_underscore_must_use.rs:87:5
7676
|
7777
LL | let _ = a.is_ok();
7878
| ^^^^^^^^^^^^^^^^^^
7979
|
8080
= help: consider explicitly using function result
8181

8282
error: non-binding let on an expression with `#[must_use]` type
83-
--> $DIR/let_underscore_must_use.rs:88:5
83+
--> $DIR/let_underscore_must_use.rs:89:5
8484
|
8585
LL | let _ = a.map(|_| ());
8686
| ^^^^^^^^^^^^^^^^^^^^^^
8787
|
8888
= help: consider explicitly using expression value
8989

9090
error: non-binding let on an expression with `#[must_use]` type
91-
--> $DIR/let_underscore_must_use.rs:90:5
91+
--> $DIR/let_underscore_must_use.rs:91:5
9292
|
9393
LL | let _ = a;
9494
| ^^^^^^^^^^

tests/ui/map_flatten.fixed

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#![warn(clippy::all, clippy::pedantic)]
44
#![allow(clippy::missing_docs_in_private_items)]
55
#![allow(clippy::map_identity)]
6+
#![allow(clippy::unnecessary_wrap)]
67

78
fn main() {
89
// mapping to Option on Iterator

tests/ui/map_flatten.rs

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#![warn(clippy::all, clippy::pedantic)]
44
#![allow(clippy::missing_docs_in_private_items)]
55
#![allow(clippy::map_identity)]
6+
#![allow(clippy::unnecessary_wrap)]
67

78
fn main() {
89
// mapping to Option on Iterator

tests/ui/map_flatten.stderr

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,37 @@
11
error: called `map(..).flatten()` on an `Iterator`
2-
--> $DIR/map_flatten.rs:14:46
2+
--> $DIR/map_flatten.rs:15:46
33
|
44
LL | let _: Vec<_> = vec![5_i8; 6].into_iter().map(option_id).flatten().collect();
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using `filter_map` instead: `.filter_map(option_id)`
66
|
77
= note: `-D clippy::map-flatten` implied by `-D warnings`
88

99
error: called `map(..).flatten()` on an `Iterator`
10-
--> $DIR/map_flatten.rs:15:46
10+
--> $DIR/map_flatten.rs:16:46
1111
|
1212
LL | let _: Vec<_> = vec![5_i8; 6].into_iter().map(option_id_ref).flatten().collect();
1313
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using `filter_map` instead: `.filter_map(option_id_ref)`
1414

1515
error: called `map(..).flatten()` on an `Iterator`
16-
--> $DIR/map_flatten.rs:16:46
16+
--> $DIR/map_flatten.rs:17:46
1717
|
1818
LL | let _: Vec<_> = vec![5_i8; 6].into_iter().map(option_id_closure).flatten().collect();
1919
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using `filter_map` instead: `.filter_map(option_id_closure)`
2020

2121
error: called `map(..).flatten()` on an `Iterator`
22-
--> $DIR/map_flatten.rs:17:46
22+
--> $DIR/map_flatten.rs:18:46
2323
|
2424
LL | let _: Vec<_> = vec![5_i8; 6].into_iter().map(|x| x.checked_add(1)).flatten().collect();
2525
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using `filter_map` instead: `.filter_map(|x| x.checked_add(1))`
2626

2727
error: called `map(..).flatten()` on an `Iterator`
28-
--> $DIR/map_flatten.rs:20:46
28+
--> $DIR/map_flatten.rs:21:46
2929
|
3030
LL | let _: Vec<_> = vec![5_i8; 6].into_iter().map(|x| 0..x).flatten().collect();
3131
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: try using `flat_map` instead: `.flat_map(|x| 0..x)`
3232

3333
error: called `map(..).flatten()` on an `Option`
34-
--> $DIR/map_flatten.rs:23:39
34+
--> $DIR/map_flatten.rs:24:39
3535
|
3636
LL | let _: Option<_> = (Some(Some(1))).map(|x| x).flatten();
3737
| ^^^^^^^^^^^^^^^^^^^^^ help: try using `and_then` instead: `.and_then(|x| x)`

0 commit comments

Comments
 (0)