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(
2828 let name = ident. name . as_str ( ) ;
2929
3030 let name = match sig. decl . implicit_self {
31- ImplicitSelfKind :: ImmRef => name,
3231 ImplicitSelfKind :: MutRef => {
3332 let Some ( name) = name. strip_suffix ( "_mut" ) else {
3433 return ;
3534 } ;
3635 name
3736 } ,
38- ImplicitSelfKind :: Imm | ImplicitSelfKind :: Mut => name,
39- _ => return ,
37+ ImplicitSelfKind :: Imm | ImplicitSelfKind :: Mut | ImplicitSelfKind :: ImmRef => name,
38+ ImplicitSelfKind :: None => return ,
4039 } ;
4140
4241 // Body must be &(mut) <self_data>.name
Original file line number Diff line number Diff line change @@ -278,16 +278,21 @@ declare_clippy_lint! {
278278 ///
279279 /// impl A {
280280 /// fn a(&self) -> &str{
281- /// self.b
281+ /// & self.b
282282 /// }
283283 /// }
284284 /// // example code where clippy issues a warning
285285 /// ```
286286 /// Use instead:
287287 /// ```rust
288+ /// struct A {
289+ /// a: String,
290+ /// b: String,
291+ /// }
292+ ///
288293 /// impl A {
289294 /// fn a(&self) -> &str{
290- /// self.a
295+ /// & self.a
291296 /// }
292297 /// }
293298 /// ```
You can’t perform that action at this time.
0 commit comments