Skip to content

Commit b064ea8

Browse files
committed
Auto merge of #5307 - JohnTitor:rename-method, r=flip1995
Rustup to rust-lang/rust#69674 changelog: none
2 parents fdce47b + 3e37766 commit b064ea8

12 files changed

+14
-14
lines changed

clippy_lints/src/attrs.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -379,8 +379,8 @@ fn is_relevant_impl(cx: &LateContext<'_, '_>, item: &ImplItem<'_>) -> bool {
379379

380380
fn is_relevant_trait(cx: &LateContext<'_, '_>, item: &TraitItem<'_>) -> bool {
381381
match item.kind {
382-
TraitItemKind::Method(_, TraitMethod::Required(_)) => true,
383-
TraitItemKind::Method(_, TraitMethod::Provided(eid)) => {
382+
TraitItemKind::Fn(_, TraitMethod::Required(_)) => true,
383+
TraitItemKind::Fn(_, TraitMethod::Provided(eid)) => {
384384
is_relevant_expr(cx, cx.tcx.body_tables(eid), &cx.tcx.hir().body(eid).value)
385385
},
386386
_ => false,

clippy_lints/src/doc.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for DocMarkdown {
179179

180180
fn check_trait_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx hir::TraitItem<'_>) {
181181
let headers = check_attrs(cx, &self.valid_idents, &item.attrs);
182-
if let hir::TraitItemKind::Method(ref sig, ..) = item.kind {
182+
if let hir::TraitItemKind::Fn(ref sig, ..) = item.kind {
183183
if !in_external_macro(cx.tcx.sess, item.span) {
184184
lint_for_missing_headers(cx, item.hir_id, item.span, sig, headers, None);
185185
}

clippy_lints/src/functions.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Functions {
273273
}
274274

275275
fn check_trait_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx hir::TraitItem<'_>) {
276-
if let hir::TraitItemKind::Method(ref sig, ref eid) = item.kind {
276+
if let hir::TraitItemKind::Fn(ref sig, ref eid) = item.kind {
277277
// don't lint extern functions decls, it's not their fault
278278
if sig.header.abi == Abi::Rust {
279279
self.check_arg_number(cx, &sig.decl, item.span.with_hi(sig.decl.output.span().hi()));

clippy_lints/src/inline_fn_without_body.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ declare_lint_pass!(InlineFnWithoutBody => [INLINE_FN_WITHOUT_BODY]);
3232

3333
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for InlineFnWithoutBody {
3434
fn check_trait_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx TraitItem<'_>) {
35-
if let TraitItemKind::Method(_, TraitMethod::Required(_)) = item.kind {
35+
if let TraitItemKind::Fn(_, TraitMethod::Required(_)) = item.kind {
3636
check_attrs(cx, item.ident.name, &item.attrs);
3737
}
3838
}

clippy_lints/src/lifetimes.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Lifetimes {
100100
}
101101

102102
fn check_trait_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx TraitItem<'_>) {
103-
if let TraitItemKind::Method(ref sig, ref body) = item.kind {
103+
if let TraitItemKind::Fn(ref sig, ref body) = item.kind {
104104
let body = match *body {
105105
TraitMethod::Required(_) => None,
106106
TraitMethod::Provided(id) => Some(id),

clippy_lints/src/methods/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1738,7 +1738,7 @@ fn lint_expect_fun_call(
17381738
if let hir::ExprKind::Path(ref p) = fun.kind {
17391739
match cx.tables.qpath_res(p, fun.hir_id) {
17401740
hir::def::Res::Def(hir::def::DefKind::Fn, def_id)
1741-
| hir::def::Res::Def(hir::def::DefKind::Method, def_id) => matches!(
1741+
| hir::def::Res::Def(hir::def::DefKind::AssocFn, def_id) => matches!(
17421742
cx.tcx.fn_sig(def_id).output().skip_binder().kind,
17431743
ty::Ref(ty::ReStatic, ..)
17441744
),

clippy_lints/src/missing_doc.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MissingDoc {
164164
fn check_trait_item(&mut self, cx: &LateContext<'a, 'tcx>, trait_item: &'tcx hir::TraitItem<'_>) {
165165
let desc = match trait_item.kind {
166166
hir::TraitItemKind::Const(..) => "an associated constant",
167-
hir::TraitItemKind::Method(..) => "a trait method",
167+
hir::TraitItemKind::Fn(..) => "a trait method",
168168
hir::TraitItemKind::Type(..) => "an associated type",
169169
};
170170

clippy_lints/src/missing_inline.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MissingInline {
100100
let tit_ = cx.tcx.hir().trait_item(tit.id);
101101
match tit_.kind {
102102
hir::TraitItemKind::Const(..) | hir::TraitItemKind::Type(..) => {},
103-
hir::TraitItemKind::Method(..) => {
103+
hir::TraitItemKind::Fn(..) => {
104104
if tit.defaultness.has_value() {
105105
// trait method with default body needs inline in case
106106
// an impl is not provided

clippy_lints/src/mut_key.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MutableKeyType {
6767
}
6868

6969
fn check_trait_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx hir::TraitItem<'tcx>) {
70-
if let hir::TraitItemKind::Method(ref sig, ..) = item.kind {
70+
if let hir::TraitItemKind::Fn(ref sig, ..) = item.kind {
7171
check_sig(cx, item.hir_id, &sig.decl);
7272
}
7373
}

clippy_lints/src/ptr.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Ptr {
121121
}
122122

123123
fn check_trait_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx TraitItem<'_>) {
124-
if let TraitItemKind::Method(ref sig, ref trait_method) = item.kind {
124+
if let TraitItemKind::Fn(ref sig, ref trait_method) = item.kind {
125125
let body_id = if let TraitMethod::Provided(b) = *trait_method {
126126
Some(b)
127127
} else {

clippy_lints/src/trivially_copy_pass_by_ref.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for TriviallyCopyPassByRef {
132132
return;
133133
}
134134

135-
if let hir::TraitItemKind::Method(method_sig, _) = &item.kind {
135+
if let hir::TraitItemKind::Fn(method_sig, _) = &item.kind {
136136
self.check_poly_fn(cx, item.hir_id, &*method_sig.decl, None);
137137
}
138138
}

clippy_lints/src/types.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Types {
204204
fn check_trait_item(&mut self, cx: &LateContext<'_, '_>, item: &TraitItem<'_>) {
205205
match item.kind {
206206
TraitItemKind::Const(ref ty, _) | TraitItemKind::Type(_, Some(ref ty)) => self.check_ty(cx, ty, false),
207-
TraitItemKind::Method(ref sig, _) => self.check_fn_decl(cx, &sig.decl),
207+
TraitItemKind::Fn(ref sig, _) => self.check_fn_decl(cx, &sig.decl),
208208
_ => (),
209209
}
210210
}
@@ -1457,7 +1457,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for TypeComplexity {
14571457
fn check_trait_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx TraitItem<'_>) {
14581458
match item.kind {
14591459
TraitItemKind::Const(ref ty, _) | TraitItemKind::Type(_, Some(ref ty)) => self.check_type(cx, ty),
1460-
TraitItemKind::Method(FnSig { ref decl, .. }, TraitMethod::Required(_)) => self.check_fndecl(cx, decl),
1460+
TraitItemKind::Fn(FnSig { ref decl, .. }, TraitMethod::Required(_)) => self.check_fndecl(cx, decl),
14611461
// methods with default impl are covered by check_fn
14621462
_ => (),
14631463
}

0 commit comments

Comments
 (0)