File tree Expand file tree Collapse file tree 2 files changed +9
-5
lines changed
clippy_lints/src/functions Expand file tree Collapse file tree 2 files changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -28,15 +28,14 @@ pub fn check_fn(
28
28
let name = ident. name . as_str ( ) ;
29
29
30
30
let name = match sig. decl . implicit_self {
31
- ImplicitSelfKind :: ImmRef => name,
32
31
ImplicitSelfKind :: MutRef => {
33
32
let Some ( name) = name. strip_suffix ( "_mut" ) else {
34
33
return ;
35
34
} ;
36
35
name
37
36
} ,
38
- ImplicitSelfKind :: Imm | ImplicitSelfKind :: Mut => name,
39
- _ => return ,
37
+ ImplicitSelfKind :: Imm | ImplicitSelfKind :: Mut | ImplicitSelfKind :: ImmRef => name,
38
+ ImplicitSelfKind :: None => return ,
40
39
} ;
41
40
42
41
// Body must be &(mut) <self_data>.name
Original file line number Diff line number Diff line change @@ -278,16 +278,21 @@ declare_clippy_lint! {
278
278
///
279
279
/// impl A {
280
280
/// fn a(&self) -> &str{
281
- /// self.b
281
+ /// & self.b
282
282
/// }
283
283
/// }
284
284
/// // example code where clippy issues a warning
285
285
/// ```
286
286
/// Use instead:
287
287
/// ```rust
288
+ /// struct A {
289
+ /// a: String,
290
+ /// b: String,
291
+ /// }
292
+ ///
288
293
/// impl A {
289
294
/// fn a(&self) -> &str{
290
- /// self.a
295
+ /// & self.a
291
296
/// }
292
297
/// }
293
298
/// ```
You can’t perform that action at this time.
0 commit comments