Skip to content

Commit 23549a8

Browse files
committed
Auto merge of rust-lang#5324 - matthiaskrgr:rustup_32, r=flip1995
rustup rust-lang#69738 changelog: none
2 parents 24f6d64 + a97f60b commit 23549a8

18 files changed

+32
-32
lines changed

clippy_lints/src/attrs.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use rustc_ast::ast::{AttrKind, AttrStyle, Attribute, Lit, LitKind, MetaItemKind,
1212
use rustc_ast::util::lev_distance::find_best_match_for_name;
1313
use rustc_errors::Applicability;
1414
use rustc_hir::{
15-
Block, Expr, ExprKind, ImplItem, ImplItemKind, Item, ItemKind, StmtKind, TraitItem, TraitItemKind, TraitMethod,
15+
Block, Expr, ExprKind, ImplItem, ImplItemKind, Item, ItemKind, StmtKind, TraitFn, TraitItem, TraitItemKind,
1616
};
1717
use rustc_lint::{CheckLintNameResult, EarlyContext, EarlyLintPass, LateContext, LateLintPass, LintContext};
1818
use rustc_session::{declare_lint_pass, declare_tool_lint};
@@ -372,15 +372,15 @@ fn is_relevant_item(cx: &LateContext<'_, '_>, item: &Item<'_>) -> bool {
372372

373373
fn is_relevant_impl(cx: &LateContext<'_, '_>, item: &ImplItem<'_>) -> bool {
374374
match item.kind {
375-
ImplItemKind::Method(_, eid) => is_relevant_expr(cx, cx.tcx.body_tables(eid), &cx.tcx.hir().body(eid).value),
375+
ImplItemKind::Fn(_, eid) => is_relevant_expr(cx, cx.tcx.body_tables(eid), &cx.tcx.hir().body(eid).value),
376376
_ => false,
377377
}
378378
}
379379

380380
fn is_relevant_trait(cx: &LateContext<'_, '_>, item: &TraitItem<'_>) -> bool {
381381
match item.kind {
382-
TraitItemKind::Fn(_, TraitMethod::Required(_)) => true,
383-
TraitItemKind::Fn(_, TraitMethod::Provided(eid)) => {
382+
TraitItemKind::Fn(_, TraitFn::Required(_)) => true,
383+
TraitItemKind::Fn(_, TraitFn::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
@@ -191,7 +191,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for DocMarkdown {
191191
if self.in_trait_impl || in_external_macro(cx.tcx.sess, item.span) {
192192
return;
193193
}
194-
if let hir::ImplItemKind::Method(ref sig, body_id) = item.kind {
194+
if let hir::ImplItemKind::Fn(ref sig, body_id) = item.kind {
195195
lint_for_missing_headers(cx, item.hir_id, item.span, sig, headers, Some(body_id));
196196
}
197197
}

clippy_lints/src/fallible_impl_from.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ fn lint_impl_body<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, impl_span: Span, impl_it
9393
for impl_item in impl_items {
9494
if_chain! {
9595
if impl_item.ident.name == sym!(from);
96-
if let ImplItemKind::Method(_, body_id) =
96+
if let ImplItemKind::Fn(_, body_id) =
9797
cx.tcx.hir().impl_item(impl_item.id).kind;
9898
then {
9999
// check the body for `begin_panic` or `unwrap`

clippy_lints/src/functions.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Functions {
250250
}
251251

252252
fn check_impl_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx hir::ImplItem<'_>) {
253-
if let hir::ImplItemKind::Method(ref sig, ref body_id) = item.kind {
253+
if let hir::ImplItemKind::Fn(ref sig, ref body_id) = item.kind {
254254
let attr = must_use_attr(&item.attrs);
255255
if let Some(attr) = attr {
256256
let fn_header_span = item.span.with_hi(sig.decl.output.span().hi());
@@ -284,7 +284,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Functions {
284284
let fn_header_span = item.span.with_hi(sig.decl.output.span().hi());
285285
check_needless_must_use(cx, &sig.decl, item.hir_id, item.span, fn_header_span, attr);
286286
}
287-
if let hir::TraitMethod::Provided(eid) = *eid {
287+
if let hir::TraitFn::Provided(eid) = *eid {
288288
let body = cx.tcx.hir().body(eid);
289289
Self::check_raw_ptr(cx, sig.header.unsafety, &sig.decl, body, item.hir_id);
290290

clippy_lints/src/inherent_to_string.rs

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

101101
if_chain! {
102102
// Check if item is a method, called to_string and has a parameter 'self'
103-
if let ImplItemKind::Method(ref signature, _) = impl_item.kind;
103+
if let ImplItemKind::Fn(ref signature, _) = impl_item.kind;
104104
if impl_item.ident.name.as_str() == "to_string";
105105
let decl = &signature.decl;
106106
if decl.implicit_self.has_implicit_self();

clippy_lints/src/inline_fn_without_body.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use crate::utils::span_lint_and_then;
44
use crate::utils::sugg::DiagnosticBuilderExt;
55
use rustc_ast::ast::{Attribute, Name};
66
use rustc_errors::Applicability;
7-
use rustc_hir::{TraitItem, TraitItemKind, TraitMethod};
7+
use rustc_hir::{TraitFn, TraitItem, TraitItemKind};
88
use rustc_lint::{LateContext, LateLintPass};
99
use rustc_session::{declare_lint_pass, declare_tool_lint};
1010

@@ -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::Fn(_, TraitMethod::Required(_)) = item.kind {
35+
if let TraitItemKind::Fn(_, TraitFn::Required(_)) = item.kind {
3636
check_attrs(cx, item.ident.name, &item.attrs);
3737
}
3838
}

clippy_lints/src/lifetimes.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use rustc_hir::intravisit::{
99
use rustc_hir::FnRetTy::Return;
1010
use rustc_hir::{
1111
BodyId, FnDecl, GenericArg, GenericBound, GenericParam, GenericParamKind, Generics, ImplItem, ImplItemKind, Item,
12-
ItemKind, Lifetime, LifetimeName, ParamName, QPath, TraitBoundModifier, TraitItem, TraitItemKind, TraitMethod, Ty,
12+
ItemKind, Lifetime, LifetimeName, ParamName, QPath, TraitBoundModifier, TraitFn, TraitItem, TraitItemKind, Ty,
1313
TyKind, WhereClause, WherePredicate,
1414
};
1515
use rustc_lint::{LateContext, LateLintPass, LintContext};
@@ -86,7 +86,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Lifetimes {
8686
}
8787

8888
fn check_impl_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx ImplItem<'_>) {
89-
if let ImplItemKind::Method(ref sig, id) = item.kind {
89+
if let ImplItemKind::Fn(ref sig, id) = item.kind {
9090
let report_extra_lifetimes = trait_ref_of_method(cx, item.hir_id).is_none();
9191
check_fn_inner(
9292
cx,
@@ -102,8 +102,8 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Lifetimes {
102102
fn check_trait_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx TraitItem<'_>) {
103103
if let TraitItemKind::Fn(ref sig, ref body) = item.kind {
104104
let body = match *body {
105-
TraitMethod::Required(_) => None,
106-
TraitMethod::Provided(id) => Some(id),
105+
TraitFn::Required(_) => None,
106+
TraitFn::Provided(id) => Some(id),
107107
};
108108
check_fn_inner(cx, &sig.decl, body, &item.generics, item.span, true);
109109
}

clippy_lints/src/methods/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1410,7 +1410,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Methods {
14101410
let def_id = cx.tcx.hir().local_def_id(item.hir_id);
14111411
let ty = cx.tcx.type_of(def_id);
14121412
if_chain! {
1413-
if let hir::ImplItemKind::Method(ref sig, id) = impl_item.kind;
1413+
if let hir::ImplItemKind::Fn(ref sig, id) = impl_item.kind;
14141414
if let Some(first_arg) = iter_input_pats(&sig.decl, cx.tcx.hir().body(id)).next();
14151415
if let hir::ItemKind::Impl{ of_trait: None, .. } = item.kind;
14161416

@@ -1469,7 +1469,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Methods {
14691469
}
14701470
}
14711471

1472-
if let hir::ImplItemKind::Method(_, _) = impl_item.kind {
1472+
if let hir::ImplItemKind::Fn(_, _) = impl_item.kind {
14731473
let ret_ty = return_ty(cx, impl_item.hir_id);
14741474

14751475
// walk the return type and check for Self (this does not check associated types)

clippy_lints/src/missing_doc.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MissingDoc {
185185

186186
let desc = match impl_item.kind {
187187
hir::ImplItemKind::Const(..) => "an associated constant",
188-
hir::ImplItemKind::Method(..) => "a method",
188+
hir::ImplItemKind::Fn(..) => "a method",
189189
hir::ImplItemKind::TyAlias(_) => "an associated type",
190190
hir::ImplItemKind::OpaqueTy(_) => "an existential type",
191191
};

clippy_lints/src/missing_inline.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MissingInline {
141141
}
142142

143143
let desc = match impl_item.kind {
144-
hir::ImplItemKind::Method(..) => "a method",
144+
hir::ImplItemKind::Fn(..) => "a method",
145145
hir::ImplItemKind::Const(..) | hir::ImplItemKind::TyAlias(_) | hir::ImplItemKind::OpaqueTy(_) => return,
146146
};
147147

clippy_lints/src/mut_key.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MutableKeyType {
5959
}
6060

6161
fn check_impl_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx hir::ImplItem<'tcx>) {
62-
if let hir::ImplItemKind::Method(ref sig, ..) = item.kind {
62+
if let hir::ImplItemKind::Fn(ref sig, ..) = item.kind {
6363
if trait_ref_of_method(cx, item.hir_id).is_none() {
6464
check_sig(cx, item.hir_id, &sig.decl);
6565
}

clippy_lints/src/new_without_default.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NewWithoutDefault {
105105
if in_external_macro(cx.sess(), impl_item.span) {
106106
return;
107107
}
108-
if let hir::ImplItemKind::Method(ref sig, _) = impl_item.kind {
108+
if let hir::ImplItemKind::Fn(ref sig, _) = impl_item.kind {
109109
let name = impl_item.ident.name;
110110
let id = impl_item.hir_id;
111111
if sig.header.constness == hir::Constness::Const {

clippy_lints/src/ptr.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use rustc::ty;
1010
use rustc_errors::Applicability;
1111
use rustc_hir::{
1212
BinOpKind, BodyId, Expr, ExprKind, FnDecl, FnRetTy, GenericArg, HirId, ImplItem, ImplItemKind, Item, ItemKind,
13-
Lifetime, MutTy, Mutability, Node, PathSegment, QPath, TraitItem, TraitItemKind, TraitMethod, Ty, TyKind,
13+
Lifetime, MutTy, Mutability, Node, PathSegment, QPath, TraitFn, TraitItem, TraitItemKind, Ty, TyKind,
1414
};
1515
use rustc_lint::{LateContext, LateLintPass};
1616
use rustc_session::{declare_lint_pass, declare_tool_lint};
@@ -109,7 +109,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Ptr {
109109
}
110110

111111
fn check_impl_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx ImplItem<'_>) {
112-
if let ImplItemKind::Method(ref sig, body_id) = item.kind {
112+
if let ImplItemKind::Fn(ref sig, body_id) = item.kind {
113113
let parent_item = cx.tcx.hir().get_parent_item(item.hir_id);
114114
if let Some(Node::Item(it)) = cx.tcx.hir().find(parent_item) {
115115
if let ItemKind::Impl { of_trait: Some(_), .. } = it.kind {
@@ -122,7 +122,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Ptr {
122122

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

clippy_lints/src/types.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ use rustc_hir as hir;
1515
use rustc_hir::intravisit::{walk_body, walk_expr, walk_ty, FnKind, NestedVisitorMap, Visitor};
1616
use rustc_hir::{
1717
BinOpKind, Body, Expr, ExprKind, FnDecl, FnRetTy, FnSig, GenericArg, GenericParamKind, HirId, ImplItem,
18-
ImplItemKind, Item, ItemKind, Lifetime, Local, MatchSource, MutTy, Mutability, QPath, Stmt, StmtKind, TraitItem,
19-
TraitItemKind, TraitMethod, TyKind, UnOp,
18+
ImplItemKind, Item, ItemKind, Lifetime, Local, MatchSource, MutTy, Mutability, QPath, Stmt, StmtKind, TraitFn,
19+
TraitItem, TraitItemKind, TyKind, UnOp,
2020
};
2121
use rustc_lint::{LateContext, LateLintPass, LintContext};
2222
use rustc_session::{declare_lint_pass, declare_tool_lint, impl_lint_pass};
@@ -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::Fn(FnSig { ref decl, .. }, TraitMethod::Required(_)) => self.check_fndecl(cx, decl),
1460+
TraitItemKind::Fn(FnSig { ref decl, .. }, TraitFn::Required(_)) => self.check_fndecl(cx, decl),
14611461
// methods with default impl are covered by check_fn
14621462
_ => (),
14631463
}

clippy_lints/src/unused_self.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnusedSelf {
5858
kind: AssocItemKind::Method { has_self: true },
5959
..
6060
} = impl_item_ref;
61-
if let ImplItemKind::Method(_, body_id) = &impl_item.kind;
61+
if let ImplItemKind::Fn(_, body_id) = &impl_item.kind;
6262
let body = cx.tcx.hir().body(*body_id);
6363
if !body.params.is_empty();
6464
then {

clippy_lints/src/use_self.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UseSelf {
195195
if let Some(impl_trait_ref) = impl_trait_ref {
196196
for impl_item_ref in refs {
197197
let impl_item = cx.tcx.hir().impl_item(impl_item_ref.id);
198-
if let ImplItemKind::Method(FnSig{ decl: impl_decl, .. }, impl_body_id)
198+
if let ImplItemKind::Fn(FnSig{ decl: impl_decl, .. }, impl_body_id)
199199
= &impl_item.kind {
200200
let item_type = cx.tcx.type_of(impl_def_id);
201201
check_trait_method_impl_decl(cx, item_type, impl_item, impl_decl, &impl_trait_ref);

clippy_lints/src/utils/inspector.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for DeepCodeInspector {
6262
println!("associated constant");
6363
print_expr(cx, &cx.tcx.hir().body(body_id).value, 1);
6464
},
65-
hir::ImplItemKind::Method(..) => println!("method"),
65+
hir::ImplItemKind::Fn(..) => println!("method"),
6666
hir::ImplItemKind::TyAlias(_) => println!("associated type"),
6767
hir::ImplItemKind::OpaqueTy(_) => println!("existential type"),
6868
}

clippy_lints/src/utils/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ pub fn in_constant(cx: &LateContext<'_, '_>, id: HirId) -> bool {
101101
..
102102
})
103103
| Node::ImplItem(&ImplItem {
104-
kind: ImplItemKind::Method(ref sig, _),
104+
kind: ImplItemKind::Fn(ref sig, _),
105105
..
106106
}) => sig.header.constness == Constness::Const,
107107
_ => false,
@@ -758,7 +758,7 @@ pub fn get_enclosing_block<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, hir_id: HirId)
758758
..
759759
})
760760
| Node::ImplItem(&ImplItem {
761-
kind: ImplItemKind::Method(_, eid),
761+
kind: ImplItemKind::Fn(_, eid),
762762
..
763763
}) => match cx.tcx.hir().body(eid).value.kind {
764764
ExprKind::Block(ref block, _) => Some(block),

0 commit comments

Comments
 (0)