Skip to content

Commit 3e2e81b

Browse files
committed
Fix internal warnings
1 parent 5fa0e07 commit 3e2e81b

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

clippy_lints/src/functions/missnamed_getters.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff 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

clippy_lints/src/functions/mod.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff 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
/// ```

0 commit comments

Comments
 (0)