Skip to content

Commit e03f73e

Browse files
committed
fix nits
1 parent c87d999 commit e03f73e

File tree

4 files changed

+32
-16
lines changed

4 files changed

+32
-16
lines changed

clippy_lints/src/needless_arbitrary_self_type.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ fn check_param_inner(cx: &EarlyContext<'_>, path: &Path, span: Span, binding_mod
8282
cx,
8383
NEEDLESS_ARBITRARY_SELF_TYPE,
8484
span,
85-
"the type of the `self` parameter is arbitrary",
85+
"the type of the `self` parameter does not need to be arbitrary",
8686
"consider to change this parameter to",
8787
self_param,
8888
Applicability::MachineApplicable,

tests/ui/needless_arbitrary_self_type.fixed

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,23 +29,31 @@ impl ValType {
2929
unimplemented!();
3030
}
3131

32+
pub fn ref_good(&self) {
33+
unimplemented!();
34+
}
35+
3236
pub fn ref_bad_with_lifetime<'a>(&'a self) {
3337
unimplemented!();
3438
}
3539

36-
pub fn ref_good(&self) {
40+
pub fn ref_good_with_lifetime<'a>(&'a self) {
3741
unimplemented!();
3842
}
3943

4044
pub fn mut_ref_bad(&mut self) {
4145
unimplemented!();
4246
}
4347

48+
pub fn mut_ref_good(&mut self) {
49+
unimplemented!();
50+
}
51+
4452
pub fn mut_ref_bad_with_lifetime<'a>(&'a mut self) {
4553
unimplemented!();
4654
}
4755

48-
pub fn mut_ref_good(&mut self) {
56+
pub fn mut_ref_good_with_lifetime<'a>(&'a mut self) {
4957
unimplemented!();
5058
}
5159

tests/ui/needless_arbitrary_self_type.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,23 +29,31 @@ impl ValType {
2929
unimplemented!();
3030
}
3131

32+
pub fn ref_good(&self) {
33+
unimplemented!();
34+
}
35+
3236
pub fn ref_bad_with_lifetime<'a>(self: &'a Self) {
3337
unimplemented!();
3438
}
3539

36-
pub fn ref_good(&self) {
40+
pub fn ref_good_with_lifetime<'a>(&'a self) {
3741
unimplemented!();
3842
}
3943

4044
pub fn mut_ref_bad(self: &mut Self) {
4145
unimplemented!();
4246
}
4347

48+
pub fn mut_ref_good(&mut self) {
49+
unimplemented!();
50+
}
51+
4452
pub fn mut_ref_bad_with_lifetime<'a>(self: &'a mut Self) {
4553
unimplemented!();
4654
}
4755

48-
pub fn mut_ref_good(&mut self) {
56+
pub fn mut_ref_good_with_lifetime<'a>(&'a mut self) {
4957
unimplemented!();
5058
}
5159

tests/ui/needless_arbitrary_self_type.stderr

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,43 @@
1-
error: the type of the `self` parameter is arbitrary
1+
error: the type of the `self` parameter does not need to be arbitrary
22
--> $DIR/needless_arbitrary_self_type.rs:12:16
33
|
44
LL | pub fn bad(self: Self) {
55
| ^^^^^^^^^^ help: consider to change this parameter to: `self`
66
|
77
= note: `-D clippy::needless-arbitrary-self-type` implied by `-D warnings`
88

9-
error: the type of the `self` parameter is arbitrary
9+
error: the type of the `self` parameter does not need to be arbitrary
1010
--> $DIR/needless_arbitrary_self_type.rs:20:20
1111
|
1212
LL | pub fn mut_bad(mut self: Self) {
1313
| ^^^^^^^^^^^^^^ help: consider to change this parameter to: `mut self`
1414

15-
error: the type of the `self` parameter is arbitrary
15+
error: the type of the `self` parameter does not need to be arbitrary
1616
--> $DIR/needless_arbitrary_self_type.rs:28:20
1717
|
1818
LL | pub fn ref_bad(self: &Self) {
1919
| ^^^^^^^^^^^ help: consider to change this parameter to: `&self`
2020

21-
error: the type of the `self` parameter is arbitrary
22-
--> $DIR/needless_arbitrary_self_type.rs:32:38
21+
error: the type of the `self` parameter does not need to be arbitrary
22+
--> $DIR/needless_arbitrary_self_type.rs:36:38
2323
|
2424
LL | pub fn ref_bad_with_lifetime<'a>(self: &'a Self) {
2525
| ^^^^^^^^^^^^^^ help: consider to change this parameter to: `&'a self`
2626

27-
error: the type of the `self` parameter is arbitrary
28-
--> $DIR/needless_arbitrary_self_type.rs:40:24
27+
error: the type of the `self` parameter does not need to be arbitrary
28+
--> $DIR/needless_arbitrary_self_type.rs:44:24
2929
|
3030
LL | pub fn mut_ref_bad(self: &mut Self) {
3131
| ^^^^^^^^^^^^^^^ help: consider to change this parameter to: `&mut self`
3232

33-
error: the type of the `self` parameter is arbitrary
34-
--> $DIR/needless_arbitrary_self_type.rs:44:42
33+
error: the type of the `self` parameter does not need to be arbitrary
34+
--> $DIR/needless_arbitrary_self_type.rs:52:42
3535
|
3636
LL | pub fn mut_ref_bad_with_lifetime<'a>(self: &'a mut Self) {
3737
| ^^^^^^^^^^^^^^^^^^ help: consider to change this parameter to: `&'a mut self`
3838

39-
error: the type of the `self` parameter is arbitrary
40-
--> $DIR/needless_arbitrary_self_type.rs:52:28
39+
error: the type of the `self` parameter does not need to be arbitrary
40+
--> $DIR/needless_arbitrary_self_type.rs:60:28
4141
|
4242
LL | pub fn mut_ref_mut_bad(mut self: &mut Self) {
4343
| ^^^^^^^^^^^^^^^^^^^ help: consider to change this parameter to: `&mut self`

0 commit comments

Comments
 (0)