This commit is contained in:
Christoph Walcher 2020-08-05 23:38:55 +02:00
parent c87d999fa2
commit e03f73e627
No known key found for this signature in database
GPG Key ID: A193164A4D05EE44
4 changed files with 32 additions and 16 deletions

View File

@ -82,7 +82,7 @@ fn check_param_inner(cx: &EarlyContext<'_>, path: &Path, span: Span, binding_mod
cx,
NEEDLESS_ARBITRARY_SELF_TYPE,
span,
"the type of the `self` parameter is arbitrary",
"the type of the `self` parameter does not need to be arbitrary",
"consider to change this parameter to",
self_param,
Applicability::MachineApplicable,

View File

@ -29,11 +29,15 @@ impl ValType {
unimplemented!();
}
pub fn ref_good(&self) {
unimplemented!();
}
pub fn ref_bad_with_lifetime<'a>(&'a self) {
unimplemented!();
}
pub fn ref_good(&self) {
pub fn ref_good_with_lifetime<'a>(&'a self) {
unimplemented!();
}
@ -41,11 +45,15 @@ impl ValType {
unimplemented!();
}
pub fn mut_ref_good(&mut self) {
unimplemented!();
}
pub fn mut_ref_bad_with_lifetime<'a>(&'a mut self) {
unimplemented!();
}
pub fn mut_ref_good(&mut self) {
pub fn mut_ref_good_with_lifetime<'a>(&'a mut self) {
unimplemented!();
}

View File

@ -29,11 +29,15 @@ impl ValType {
unimplemented!();
}
pub fn ref_good(&self) {
unimplemented!();
}
pub fn ref_bad_with_lifetime<'a>(self: &'a Self) {
unimplemented!();
}
pub fn ref_good(&self) {
pub fn ref_good_with_lifetime<'a>(&'a self) {
unimplemented!();
}
@ -41,11 +45,15 @@ impl ValType {
unimplemented!();
}
pub fn mut_ref_good(&mut self) {
unimplemented!();
}
pub fn mut_ref_bad_with_lifetime<'a>(self: &'a mut Self) {
unimplemented!();
}
pub fn mut_ref_good(&mut self) {
pub fn mut_ref_good_with_lifetime<'a>(&'a mut self) {
unimplemented!();
}

View File

@ -1,4 +1,4 @@
error: the type of the `self` parameter is arbitrary
error: the type of the `self` parameter does not need to be arbitrary
--> $DIR/needless_arbitrary_self_type.rs:12:16
|
LL | pub fn bad(self: Self) {
@ -6,38 +6,38 @@ LL | pub fn bad(self: Self) {
|
= note: `-D clippy::needless-arbitrary-self-type` implied by `-D warnings`
error: the type of the `self` parameter is arbitrary
error: the type of the `self` parameter does not need to be arbitrary
--> $DIR/needless_arbitrary_self_type.rs:20:20
|
LL | pub fn mut_bad(mut self: Self) {
| ^^^^^^^^^^^^^^ help: consider to change this parameter to: `mut self`
error: the type of the `self` parameter is arbitrary
error: the type of the `self` parameter does not need to be arbitrary
--> $DIR/needless_arbitrary_self_type.rs:28:20
|
LL | pub fn ref_bad(self: &Self) {
| ^^^^^^^^^^^ help: consider to change this parameter to: `&self`
error: the type of the `self` parameter is arbitrary
--> $DIR/needless_arbitrary_self_type.rs:32:38
error: the type of the `self` parameter does not need to be arbitrary
--> $DIR/needless_arbitrary_self_type.rs:36:38
|
LL | pub fn ref_bad_with_lifetime<'a>(self: &'a Self) {
| ^^^^^^^^^^^^^^ help: consider to change this parameter to: `&'a self`
error: the type of the `self` parameter is arbitrary
--> $DIR/needless_arbitrary_self_type.rs:40:24
error: the type of the `self` parameter does not need to be arbitrary
--> $DIR/needless_arbitrary_self_type.rs:44:24
|
LL | pub fn mut_ref_bad(self: &mut Self) {
| ^^^^^^^^^^^^^^^ help: consider to change this parameter to: `&mut self`
error: the type of the `self` parameter is arbitrary
--> $DIR/needless_arbitrary_self_type.rs:44:42
error: the type of the `self` parameter does not need to be arbitrary
--> $DIR/needless_arbitrary_self_type.rs:52:42
|
LL | pub fn mut_ref_bad_with_lifetime<'a>(self: &'a mut Self) {
| ^^^^^^^^^^^^^^^^^^ help: consider to change this parameter to: `&'a mut self`
error: the type of the `self` parameter is arbitrary
--> $DIR/needless_arbitrary_self_type.rs:52:28
error: the type of the `self` parameter does not need to be arbitrary
--> $DIR/needless_arbitrary_self_type.rs:60:28
|
LL | pub fn mut_ref_mut_bad(mut self: &mut Self) {
| ^^^^^^^^^^^^^^^^^^^ help: consider to change this parameter to: `&mut self`