Skip to content

Commit 2b35edb

Browse files
Update other UI tests as well
1 parent 8dfb3ec commit 2b35edb

File tree

9 files changed

+48
-43
lines changed

9 files changed

+48
-43
lines changed

tests/ui/auxiliary/option_helpers.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![allow(dead_code, unused_variables)]
1+
#![allow(dead_code, unused_variables, clippy::return_self_not_must_use)]
22

33
/// Utility macro to test linting behavior in `option_methods()`
44
/// The lints included in `option_methods()` should not lint if the call to map is partially

tests/ui/deref_addrof.fixed

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// run-rustfix
2+
#![allow(clippy::return_self_not_must_use)]
23
#![warn(clippy::deref_addrof)]
34

45
fn get_number() -> usize {

tests/ui/deref_addrof.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// run-rustfix
2+
#![allow(clippy::return_self_not_must_use)]
23
#![warn(clippy::deref_addrof)]
34

45
fn get_number() -> usize {

tests/ui/deref_addrof.stderr

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,55 @@
11
error: immediately dereferencing a reference
2-
--> $DIR/deref_addrof.rs:18:13
2+
--> $DIR/deref_addrof.rs:19:13
33
|
44
LL | let b = *&a;
55
| ^^^ help: try this: `a`
66
|
77
= note: `-D clippy::deref-addrof` implied by `-D warnings`
88

99
error: immediately dereferencing a reference
10-
--> $DIR/deref_addrof.rs:20:13
10+
--> $DIR/deref_addrof.rs:21:13
1111
|
1212
LL | let b = *&get_number();
1313
| ^^^^^^^^^^^^^^ help: try this: `get_number()`
1414

1515
error: immediately dereferencing a reference
16-
--> $DIR/deref_addrof.rs:25:13
16+
--> $DIR/deref_addrof.rs:26:13
1717
|
1818
LL | let b = *&bytes[1..2][0];
1919
| ^^^^^^^^^^^^^^^^ help: try this: `bytes[1..2][0]`
2020

2121
error: immediately dereferencing a reference
22-
--> $DIR/deref_addrof.rs:29:13
22+
--> $DIR/deref_addrof.rs:30:13
2323
|
2424
LL | let b = *&(a);
2525
| ^^^^^ help: try this: `(a)`
2626

2727
error: immediately dereferencing a reference
28-
--> $DIR/deref_addrof.rs:31:13
28+
--> $DIR/deref_addrof.rs:32:13
2929
|
3030
LL | let b = *(&a);
3131
| ^^^^^ help: try this: `a`
3232

3333
error: immediately dereferencing a reference
34-
--> $DIR/deref_addrof.rs:34:13
34+
--> $DIR/deref_addrof.rs:35:13
3535
|
3636
LL | let b = *((&a));
3737
| ^^^^^^^ help: try this: `a`
3838

3939
error: immediately dereferencing a reference
40-
--> $DIR/deref_addrof.rs:36:13
40+
--> $DIR/deref_addrof.rs:37:13
4141
|
4242
LL | let b = *&&a;
4343
| ^^^^ help: try this: `&a`
4444

4545
error: immediately dereferencing a reference
46-
--> $DIR/deref_addrof.rs:38:14
46+
--> $DIR/deref_addrof.rs:39:14
4747
|
4848
LL | let b = **&aref;
4949
| ^^^^^^ help: try this: `aref`
5050

5151
error: immediately dereferencing a reference
52-
--> $DIR/deref_addrof.rs:44:9
52+
--> $DIR/deref_addrof.rs:45:9
5353
|
5454
LL | *& $visitor
5555
| ^^^^^^^^^^^ help: try this: `$visitor`
@@ -60,7 +60,7 @@ LL | m!(self)
6060
= note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info)
6161

6262
error: immediately dereferencing a reference
63-
--> $DIR/deref_addrof.rs:51:9
63+
--> $DIR/deref_addrof.rs:52:9
6464
|
6565
LL | *& mut $visitor
6666
| ^^^^^^^^^^^^^^^ help: try this: `$visitor`

tests/ui/should_impl_trait/corner_cases.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
clippy::needless_lifetimes,
88
clippy::missing_safety_doc,
99
clippy::wrong_self_convention,
10-
clippy::missing_panics_doc
10+
clippy::missing_panics_doc,
11+
clippy::return_self_not_must_use
1112
)]
1213

1314
use std::ops::Mul;

tests/ui/should_impl_trait/method_list_1.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
clippy::needless_lifetimes,
88
clippy::missing_safety_doc,
99
clippy::wrong_self_convention,
10-
clippy::missing_panics_doc
10+
clippy::missing_panics_doc,
11+
clippy::return_self_not_must_use
1112
)]
1213

1314
use std::ops::Mul;

tests/ui/should_impl_trait/method_list_1.stderr

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: method `add` can be confused for the standard trait method `std::ops::Add::add`
2-
--> $DIR/method_list_1.rs:24:5
2+
--> $DIR/method_list_1.rs:25:5
33
|
44
LL | / pub fn add(self, other: T) -> T {
55
LL | | unimplemented!()
@@ -10,7 +10,7 @@ LL | | }
1010
= help: consider implementing the trait `std::ops::Add` or choosing a less ambiguous method name
1111

1212
error: method `as_mut` can be confused for the standard trait method `std::convert::AsMut::as_mut`
13-
--> $DIR/method_list_1.rs:28:5
13+
--> $DIR/method_list_1.rs:29:5
1414
|
1515
LL | / pub fn as_mut(&mut self) -> &mut T {
1616
LL | | unimplemented!()
@@ -20,7 +20,7 @@ LL | | }
2020
= help: consider implementing the trait `std::convert::AsMut` or choosing a less ambiguous method name
2121

2222
error: method `as_ref` can be confused for the standard trait method `std::convert::AsRef::as_ref`
23-
--> $DIR/method_list_1.rs:32:5
23+
--> $DIR/method_list_1.rs:33:5
2424
|
2525
LL | / pub fn as_ref(&self) -> &T {
2626
LL | | unimplemented!()
@@ -30,7 +30,7 @@ LL | | }
3030
= help: consider implementing the trait `std::convert::AsRef` or choosing a less ambiguous method name
3131

3232
error: method `bitand` can be confused for the standard trait method `std::ops::BitAnd::bitand`
33-
--> $DIR/method_list_1.rs:36:5
33+
--> $DIR/method_list_1.rs:37:5
3434
|
3535
LL | / pub fn bitand(self, rhs: T) -> T {
3636
LL | | unimplemented!()
@@ -40,7 +40,7 @@ LL | | }
4040
= help: consider implementing the trait `std::ops::BitAnd` or choosing a less ambiguous method name
4141

4242
error: method `bitor` can be confused for the standard trait method `std::ops::BitOr::bitor`
43-
--> $DIR/method_list_1.rs:40:5
43+
--> $DIR/method_list_1.rs:41:5
4444
|
4545
LL | / pub fn bitor(self, rhs: Self) -> Self {
4646
LL | | unimplemented!()
@@ -50,7 +50,7 @@ LL | | }
5050
= help: consider implementing the trait `std::ops::BitOr` or choosing a less ambiguous method name
5151

5252
error: method `bitxor` can be confused for the standard trait method `std::ops::BitXor::bitxor`
53-
--> $DIR/method_list_1.rs:44:5
53+
--> $DIR/method_list_1.rs:45:5
5454
|
5555
LL | / pub fn bitxor(self, rhs: Self) -> Self {
5656
LL | | unimplemented!()
@@ -60,7 +60,7 @@ LL | | }
6060
= help: consider implementing the trait `std::ops::BitXor` or choosing a less ambiguous method name
6161

6262
error: method `borrow` can be confused for the standard trait method `std::borrow::Borrow::borrow`
63-
--> $DIR/method_list_1.rs:48:5
63+
--> $DIR/method_list_1.rs:49:5
6464
|
6565
LL | / pub fn borrow(&self) -> &str {
6666
LL | | unimplemented!()
@@ -70,7 +70,7 @@ LL | | }
7070
= help: consider implementing the trait `std::borrow::Borrow` or choosing a less ambiguous method name
7171

7272
error: method `borrow_mut` can be confused for the standard trait method `std::borrow::BorrowMut::borrow_mut`
73-
--> $DIR/method_list_1.rs:52:5
73+
--> $DIR/method_list_1.rs:53:5
7474
|
7575
LL | / pub fn borrow_mut(&mut self) -> &mut str {
7676
LL | | unimplemented!()
@@ -80,7 +80,7 @@ LL | | }
8080
= help: consider implementing the trait `std::borrow::BorrowMut` or choosing a less ambiguous method name
8181

8282
error: method `clone` can be confused for the standard trait method `std::clone::Clone::clone`
83-
--> $DIR/method_list_1.rs:56:5
83+
--> $DIR/method_list_1.rs:57:5
8484
|
8585
LL | / pub fn clone(&self) -> Self {
8686
LL | | unimplemented!()
@@ -90,7 +90,7 @@ LL | | }
9090
= help: consider implementing the trait `std::clone::Clone` or choosing a less ambiguous method name
9191

9292
error: method `cmp` can be confused for the standard trait method `std::cmp::Ord::cmp`
93-
--> $DIR/method_list_1.rs:60:5
93+
--> $DIR/method_list_1.rs:61:5
9494
|
9595
LL | / pub fn cmp(&self, other: &Self) -> Self {
9696
LL | | unimplemented!()
@@ -100,7 +100,7 @@ LL | | }
100100
= help: consider implementing the trait `std::cmp::Ord` or choosing a less ambiguous method name
101101

102102
error: method `deref` can be confused for the standard trait method `std::ops::Deref::deref`
103-
--> $DIR/method_list_1.rs:68:5
103+
--> $DIR/method_list_1.rs:69:5
104104
|
105105
LL | / pub fn deref(&self) -> &Self {
106106
LL | | unimplemented!()
@@ -110,7 +110,7 @@ LL | | }
110110
= help: consider implementing the trait `std::ops::Deref` or choosing a less ambiguous method name
111111

112112
error: method `deref_mut` can be confused for the standard trait method `std::ops::DerefMut::deref_mut`
113-
--> $DIR/method_list_1.rs:72:5
113+
--> $DIR/method_list_1.rs:73:5
114114
|
115115
LL | / pub fn deref_mut(&mut self) -> &mut Self {
116116
LL | | unimplemented!()
@@ -120,7 +120,7 @@ LL | | }
120120
= help: consider implementing the trait `std::ops::DerefMut` or choosing a less ambiguous method name
121121

122122
error: method `div` can be confused for the standard trait method `std::ops::Div::div`
123-
--> $DIR/method_list_1.rs:76:5
123+
--> $DIR/method_list_1.rs:77:5
124124
|
125125
LL | / pub fn div(self, rhs: Self) -> Self {
126126
LL | | unimplemented!()
@@ -130,7 +130,7 @@ LL | | }
130130
= help: consider implementing the trait `std::ops::Div` or choosing a less ambiguous method name
131131

132132
error: method `drop` can be confused for the standard trait method `std::ops::Drop::drop`
133-
--> $DIR/method_list_1.rs:80:5
133+
--> $DIR/method_list_1.rs:81:5
134134
|
135135
LL | / pub fn drop(&mut self) {
136136
LL | | unimplemented!()

tests/ui/should_impl_trait/method_list_2.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
clippy::needless_lifetimes,
88
clippy::missing_safety_doc,
99
clippy::wrong_self_convention,
10-
clippy::missing_panics_doc
10+
clippy::missing_panics_doc,
11+
clippy::return_self_not_must_use
1112
)]
1213

1314
use std::ops::Mul;

tests/ui/should_impl_trait/method_list_2.stderr

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: method `eq` can be confused for the standard trait method `std::cmp::PartialEq::eq`
2-
--> $DIR/method_list_2.rs:25:5
2+
--> $DIR/method_list_2.rs:26:5
33
|
44
LL | / pub fn eq(&self, other: &Self) -> bool {
55
LL | | unimplemented!()
@@ -10,7 +10,7 @@ LL | | }
1010
= help: consider implementing the trait `std::cmp::PartialEq` or choosing a less ambiguous method name
1111

1212
error: method `from_iter` can be confused for the standard trait method `std::iter::FromIterator::from_iter`
13-
--> $DIR/method_list_2.rs:29:5
13+
--> $DIR/method_list_2.rs:30:5
1414
|
1515
LL | / pub fn from_iter<T>(iter: T) -> Self {
1616
LL | | unimplemented!()
@@ -20,7 +20,7 @@ LL | | }
2020
= help: consider implementing the trait `std::iter::FromIterator` or choosing a less ambiguous method name
2121

2222
error: method `from_str` can be confused for the standard trait method `std::str::FromStr::from_str`
23-
--> $DIR/method_list_2.rs:33:5
23+
--> $DIR/method_list_2.rs:34:5
2424
|
2525
LL | / pub fn from_str(s: &str) -> Result<Self, Self> {
2626
LL | | unimplemented!()
@@ -30,7 +30,7 @@ LL | | }
3030
= help: consider implementing the trait `std::str::FromStr` or choosing a less ambiguous method name
3131

3232
error: method `hash` can be confused for the standard trait method `std::hash::Hash::hash`
33-
--> $DIR/method_list_2.rs:37:5
33+
--> $DIR/method_list_2.rs:38:5
3434
|
3535
LL | / pub fn hash(&self, state: &mut T) {
3636
LL | | unimplemented!()
@@ -40,7 +40,7 @@ LL | | }
4040
= help: consider implementing the trait `std::hash::Hash` or choosing a less ambiguous method name
4141

4242
error: method `index` can be confused for the standard trait method `std::ops::Index::index`
43-
--> $DIR/method_list_2.rs:41:5
43+
--> $DIR/method_list_2.rs:42:5
4444
|
4545
LL | / pub fn index(&self, index: usize) -> &Self {
4646
LL | | unimplemented!()
@@ -50,7 +50,7 @@ LL | | }
5050
= help: consider implementing the trait `std::ops::Index` or choosing a less ambiguous method name
5151

5252
error: method `index_mut` can be confused for the standard trait method `std::ops::IndexMut::index_mut`
53-
--> $DIR/method_list_2.rs:45:5
53+
--> $DIR/method_list_2.rs:46:5
5454
|
5555
LL | / pub fn index_mut(&mut self, index: usize) -> &mut Self {
5656
LL | | unimplemented!()
@@ -60,7 +60,7 @@ LL | | }
6060
= help: consider implementing the trait `std::ops::IndexMut` or choosing a less ambiguous method name
6161

6262
error: method `into_iter` can be confused for the standard trait method `std::iter::IntoIterator::into_iter`
63-
--> $DIR/method_list_2.rs:49:5
63+
--> $DIR/method_list_2.rs:50:5
6464
|
6565
LL | / pub fn into_iter(self) -> Self {
6666
LL | | unimplemented!()
@@ -70,7 +70,7 @@ LL | | }
7070
= help: consider implementing the trait `std::iter::IntoIterator` or choosing a less ambiguous method name
7171

7272
error: method `mul` can be confused for the standard trait method `std::ops::Mul::mul`
73-
--> $DIR/method_list_2.rs:53:5
73+
--> $DIR/method_list_2.rs:54:5
7474
|
7575
LL | / pub fn mul(self, rhs: Self) -> Self {
7676
LL | | unimplemented!()
@@ -80,7 +80,7 @@ LL | | }
8080
= help: consider implementing the trait `std::ops::Mul` or choosing a less ambiguous method name
8181

8282
error: method `neg` can be confused for the standard trait method `std::ops::Neg::neg`
83-
--> $DIR/method_list_2.rs:57:5
83+
--> $DIR/method_list_2.rs:58:5
8484
|
8585
LL | / pub fn neg(self) -> Self {
8686
LL | | unimplemented!()
@@ -90,7 +90,7 @@ LL | | }
9090
= help: consider implementing the trait `std::ops::Neg` or choosing a less ambiguous method name
9191

9292
error: method `next` can be confused for the standard trait method `std::iter::Iterator::next`
93-
--> $DIR/method_list_2.rs:61:5
93+
--> $DIR/method_list_2.rs:62:5
9494
|
9595
LL | / pub fn next(&mut self) -> Option<Self> {
9696
LL | | unimplemented!()
@@ -100,7 +100,7 @@ LL | | }
100100
= help: consider implementing the trait `std::iter::Iterator` or choosing a less ambiguous method name
101101

102102
error: method `not` can be confused for the standard trait method `std::ops::Not::not`
103-
--> $DIR/method_list_2.rs:65:5
103+
--> $DIR/method_list_2.rs:66:5
104104
|
105105
LL | / pub fn not(self) -> Self {
106106
LL | | unimplemented!()
@@ -110,7 +110,7 @@ LL | | }
110110
= help: consider implementing the trait `std::ops::Not` or choosing a less ambiguous method name
111111

112112
error: method `rem` can be confused for the standard trait method `std::ops::Rem::rem`
113-
--> $DIR/method_list_2.rs:69:5
113+
--> $DIR/method_list_2.rs:70:5
114114
|
115115
LL | / pub fn rem(self, rhs: Self) -> Self {
116116
LL | | unimplemented!()
@@ -120,7 +120,7 @@ LL | | }
120120
= help: consider implementing the trait `std::ops::Rem` or choosing a less ambiguous method name
121121

122122
error: method `shl` can be confused for the standard trait method `std::ops::Shl::shl`
123-
--> $DIR/method_list_2.rs:73:5
123+
--> $DIR/method_list_2.rs:74:5
124124
|
125125
LL | / pub fn shl(self, rhs: Self) -> Self {
126126
LL | | unimplemented!()
@@ -130,7 +130,7 @@ LL | | }
130130
= help: consider implementing the trait `std::ops::Shl` or choosing a less ambiguous method name
131131

132132
error: method `shr` can be confused for the standard trait method `std::ops::Shr::shr`
133-
--> $DIR/method_list_2.rs:77:5
133+
--> $DIR/method_list_2.rs:78:5
134134
|
135135
LL | / pub fn shr(self, rhs: Self) -> Self {
136136
LL | | unimplemented!()
@@ -140,7 +140,7 @@ LL | | }
140140
= help: consider implementing the trait `std::ops::Shr` or choosing a less ambiguous method name
141141

142142
error: method `sub` can be confused for the standard trait method `std::ops::Sub::sub`
143-
--> $DIR/method_list_2.rs:81:5
143+
--> $DIR/method_list_2.rs:82:5
144144
|
145145
LL | / pub fn sub(self, rhs: Self) -> Self {
146146
LL | | unimplemented!()

0 commit comments

Comments
 (0)