Skip to content

Commit 0f3dcdc

Browse files
committed
Document known problems
1 parent ece8b8e commit 0f3dcdc

File tree

3 files changed

+24
-19
lines changed

3 files changed

+24
-19
lines changed

clippy_lints/src/use_self.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,13 @@ use syntax_pos::symbol::keywords::SelfUpper;
2525
/// name
2626
/// feels inconsistent.
2727
///
28-
/// **Known problems:** None.
28+
/// **Known problems:**
29+
/// - Does not trigger within locally defined macros (#2098)
30+
/// - False positive when using associated types (#2843)
31+
/// - False positives in some situations when using generics (#3410)
32+
/// - False positive when type from outer function can't be used (#3463)
33+
/// - Does not diagnose tuple structs (#3498)
34+
/// - Does not trigger in lifetimed struct
2935
///
3036
/// **Example:**
3137
/// ```rust

tests/ui/use_self.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,6 @@ mod better {
5151
}
5252
}
5353

54-
//todo the lint does not handle lifetimed struct
55-
//the following module should trigger the lint on the third method only
5654
mod lifetimes {
5755
struct Foo<'a> {
5856
foo_str: &'a str,
@@ -69,7 +67,8 @@ mod lifetimes {
6967
Foo { foo_str: "foo" }
7068
}
7169

72-
// `Self` is applicable here
70+
// TODO: the lint does not handle lifetimed struct
71+
// `Self` should be applicable here
7372
fn clone(&self) -> Foo<'a> {
7473
Foo { foo_str: self.foo_str }
7574
}

tests/ui/use_self.stderr

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -37,91 +37,91 @@ LL | Foo::new()
3737
| ^^^^^^^^ help: use the applicable keyword: `Self`
3838

3939
error: unnecessary structure name repetition
40-
--> $DIR/use_self.rs:96:22
40+
--> $DIR/use_self.rs:95:22
4141
|
4242
LL | fn refs(p1: &Bad) -> &Bad {
4343
| ^^^ help: use the applicable keyword: `Self`
4444

4545
error: unnecessary structure name repetition
46-
--> $DIR/use_self.rs:96:31
46+
--> $DIR/use_self.rs:95:31
4747
|
4848
LL | fn refs(p1: &Bad) -> &Bad {
4949
| ^^^ help: use the applicable keyword: `Self`
5050

5151
error: unnecessary structure name repetition
52-
--> $DIR/use_self.rs:100:37
52+
--> $DIR/use_self.rs:99:37
5353
|
5454
LL | fn ref_refs<'a>(p1: &'a &'a Bad) -> &'a &'a Bad {
5555
| ^^^ help: use the applicable keyword: `Self`
5656

5757
error: unnecessary structure name repetition
58-
--> $DIR/use_self.rs:100:53
58+
--> $DIR/use_self.rs:99:53
5959
|
6060
LL | fn ref_refs<'a>(p1: &'a &'a Bad) -> &'a &'a Bad {
6161
| ^^^ help: use the applicable keyword: `Self`
6262

6363
error: unnecessary structure name repetition
64-
--> $DIR/use_self.rs:104:30
64+
--> $DIR/use_self.rs:103:30
6565
|
6666
LL | fn mut_refs(p1: &mut Bad) -> &mut Bad {
6767
| ^^^ help: use the applicable keyword: `Self`
6868

6969
error: unnecessary structure name repetition
70-
--> $DIR/use_self.rs:104:43
70+
--> $DIR/use_self.rs:103:43
7171
|
7272
LL | fn mut_refs(p1: &mut Bad) -> &mut Bad {
7373
| ^^^ help: use the applicable keyword: `Self`
7474

7575
error: unnecessary structure name repetition
76-
--> $DIR/use_self.rs:108:28
76+
--> $DIR/use_self.rs:107:28
7777
|
7878
LL | fn nested(_p1: Box<Bad>, _p2: (&u8, &Bad)) {}
7979
| ^^^ help: use the applicable keyword: `Self`
8080

8181
error: unnecessary structure name repetition
82-
--> $DIR/use_self.rs:108:46
82+
--> $DIR/use_self.rs:107:46
8383
|
8484
LL | fn nested(_p1: Box<Bad>, _p2: (&u8, &Bad)) {}
8585
| ^^^ help: use the applicable keyword: `Self`
8686

8787
error: unnecessary structure name repetition
88-
--> $DIR/use_self.rs:110:20
88+
--> $DIR/use_self.rs:109:20
8989
|
9090
LL | fn vals(_: Bad) -> Bad {
9191
| ^^^ help: use the applicable keyword: `Self`
9292

9393
error: unnecessary structure name repetition
94-
--> $DIR/use_self.rs:110:28
94+
--> $DIR/use_self.rs:109:28
9595
|
9696
LL | fn vals(_: Bad) -> Bad {
9797
| ^^^ help: use the applicable keyword: `Self`
9898

9999
error: unnecessary structure name repetition
100-
--> $DIR/use_self.rs:111:13
100+
--> $DIR/use_self.rs:110:13
101101
|
102102
LL | Bad::default()
103103
| ^^^^^^^^^^^^ help: use the applicable keyword: `Self`
104104

105105
error: unnecessary structure name repetition
106-
--> $DIR/use_self.rs:116:23
106+
--> $DIR/use_self.rs:115:23
107107
|
108108
LL | type Output = Bad;
109109
| ^^^ help: use the applicable keyword: `Self`
110110

111111
error: unnecessary structure name repetition
112-
--> $DIR/use_self.rs:118:27
112+
--> $DIR/use_self.rs:117:27
113113
|
114114
LL | fn mul(self, rhs: Bad) -> Bad {
115115
| ^^^ help: use the applicable keyword: `Self`
116116

117117
error: unnecessary structure name repetition
118-
--> $DIR/use_self.rs:118:35
118+
--> $DIR/use_self.rs:117:35
119119
|
120120
LL | fn mul(self, rhs: Bad) -> Bad {
121121
| ^^^ help: use the applicable keyword: `Self`
122122

123123
error: unnecessary structure name repetition
124-
--> $DIR/use_self.rs:210:56
124+
--> $DIR/use_self.rs:209:56
125125
|
126126
LL | fn bad(foos: &[Self]) -> impl Iterator<Item = &Foo> {
127127
| ^^^ help: use the applicable keyword: `Self`

0 commit comments

Comments
 (0)