Skip to content

Commit a8520b0

Browse files
committed
Auto merge of #5934 - ThibsG:WrongSelfTestCase4037, r=ebroto
Add async test case for FP in `wrong_self_convention` lint Closes: #4037 changelog: none r? @ebroto
2 parents b57ef14 + 03bc7ae commit a8520b0

File tree

2 files changed

+25
-12
lines changed

2 files changed

+25
-12
lines changed

tests/ui/wrong_self_convention.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// edition:2018
12
#![warn(clippy::wrong_self_convention)]
23
#![warn(clippy::wrong_pub_self_convention)]
34
#![allow(dead_code)]
@@ -75,3 +76,15 @@ mod issue4293 {
7576
fn into_t3(self: Arc<T>) {}
7677
}
7778
}
79+
80+
// False positive for async (see #4037)
81+
mod issue4037 {
82+
pub struct Foo;
83+
pub struct Bar;
84+
85+
impl Foo {
86+
pub async fn into_bar(self) -> Bar {
87+
Bar
88+
}
89+
}
90+
}

tests/ui/wrong_self_convention.stderr

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,73 +1,73 @@
11
error: methods called `from_*` usually take no self; consider choosing a less ambiguous name
2-
--> $DIR/wrong_self_convention.rs:17:17
2+
--> $DIR/wrong_self_convention.rs:18:17
33
|
44
LL | fn from_i32(self) {}
55
| ^^^^
66
|
77
= note: `-D clippy::wrong-self-convention` implied by `-D warnings`
88

99
error: methods called `from_*` usually take no self; consider choosing a less ambiguous name
10-
--> $DIR/wrong_self_convention.rs:23:21
10+
--> $DIR/wrong_self_convention.rs:24:21
1111
|
1212
LL | pub fn from_i64(self) {}
1313
| ^^^^
1414

1515
error: methods called `as_*` usually take self by reference or self by mutable reference; consider choosing a less ambiguous name
16-
--> $DIR/wrong_self_convention.rs:35:15
16+
--> $DIR/wrong_self_convention.rs:36:15
1717
|
1818
LL | fn as_i32(self) {}
1919
| ^^^^
2020

2121
error: methods called `into_*` usually take self by value; consider choosing a less ambiguous name
22-
--> $DIR/wrong_self_convention.rs:37:17
22+
--> $DIR/wrong_self_convention.rs:38:17
2323
|
2424
LL | fn into_i32(&self) {}
2525
| ^^^^^
2626

2727
error: methods called `is_*` usually take self by reference or no self; consider choosing a less ambiguous name
28-
--> $DIR/wrong_self_convention.rs:39:15
28+
--> $DIR/wrong_self_convention.rs:40:15
2929
|
3030
LL | fn is_i32(self) {}
3131
| ^^^^
3232

3333
error: methods called `to_*` usually take self by reference; consider choosing a less ambiguous name
34-
--> $DIR/wrong_self_convention.rs:41:15
34+
--> $DIR/wrong_self_convention.rs:42:15
3535
|
3636
LL | fn to_i32(self) {}
3737
| ^^^^
3838

3939
error: methods called `from_*` usually take no self; consider choosing a less ambiguous name
40-
--> $DIR/wrong_self_convention.rs:43:17
40+
--> $DIR/wrong_self_convention.rs:44:17
4141
|
4242
LL | fn from_i32(self) {}
4343
| ^^^^
4444

4545
error: methods called `as_*` usually take self by reference or self by mutable reference; consider choosing a less ambiguous name
46-
--> $DIR/wrong_self_convention.rs:45:19
46+
--> $DIR/wrong_self_convention.rs:46:19
4747
|
4848
LL | pub fn as_i64(self) {}
4949
| ^^^^
5050

5151
error: methods called `into_*` usually take self by value; consider choosing a less ambiguous name
52-
--> $DIR/wrong_self_convention.rs:46:21
52+
--> $DIR/wrong_self_convention.rs:47:21
5353
|
5454
LL | pub fn into_i64(&self) {}
5555
| ^^^^^
5656

5757
error: methods called `is_*` usually take self by reference or no self; consider choosing a less ambiguous name
58-
--> $DIR/wrong_self_convention.rs:47:19
58+
--> $DIR/wrong_self_convention.rs:48:19
5959
|
6060
LL | pub fn is_i64(self) {}
6161
| ^^^^
6262

6363
error: methods called `to_*` usually take self by reference; consider choosing a less ambiguous name
64-
--> $DIR/wrong_self_convention.rs:48:19
64+
--> $DIR/wrong_self_convention.rs:49:19
6565
|
6666
LL | pub fn to_i64(self) {}
6767
| ^^^^
6868

6969
error: methods called `from_*` usually take no self; consider choosing a less ambiguous name
70-
--> $DIR/wrong_self_convention.rs:49:21
70+
--> $DIR/wrong_self_convention.rs:50:21
7171
|
7272
LL | pub fn from_i64(self) {}
7373
| ^^^^

0 commit comments

Comments
 (0)