diff --git a/clippy_lints/src/attrs.rs b/clippy_lints/src/attrs.rs index 06df8504def..5c881adca2c 100644 --- a/clippy_lints/src/attrs.rs +++ b/clippy_lints/src/attrs.rs @@ -355,7 +355,7 @@ fn check_clippy_lint_names(cx: &LateContext<'_, '_>, items: &[NestedMetaItem]) { } fn is_relevant_item(cx: &LateContext<'_, '_>, item: &Item) -> bool { - if let ItemKind::Fn(_, _, _, eid) = item.kind { + if let ItemKind::Fn(_, _, eid) = item.kind { is_relevant_expr(cx, cx.tcx.body_tables(eid), &cx.tcx.hir().body(eid).value) } else { true diff --git a/clippy_lints/src/doc.rs b/clippy_lints/src/doc.rs index aca4d176724..e014d191276 100644 --- a/clippy_lints/src/doc.rs +++ b/clippy_lints/src/doc.rs @@ -126,8 +126,8 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for DocMarkdown { } // no safety header match item.kind { - hir::ItemKind::Fn(_, ref header, ..) => { - if cx.access_levels.is_exported(item.hir_id) && header.unsafety == hir::Unsafety::Unsafe { + hir::ItemKind::Fn(ref sig, ..) => { + if cx.access_levels.is_exported(item.hir_id) && sig.header.unsafety == hir::Unsafety::Unsafe { span_lint( cx, MISSING_SAFETY_DOC, diff --git a/clippy_lints/src/functions.rs b/clippy_lints/src/functions.rs index 59a16c36d90..8c3306f6d12 100644 --- a/clippy_lints/src/functions.rs +++ b/clippy_lints/src/functions.rs @@ -208,7 +208,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Functions { match kind { hir::intravisit::FnKind::Method( _, - &hir::MethodSig { + &hir::FnSig { header: hir::FnHeader { abi: Abi::Rust, .. }, .. }, @@ -228,20 +228,20 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Functions { fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx hir::Item) { let attr = must_use_attr(&item.attrs); - if let hir::ItemKind::Fn(ref decl, ref _header, ref _generics, ref body_id) = item.kind { + if let hir::ItemKind::Fn(ref sig, ref _generics, ref body_id) = item.kind { if let Some(attr) = attr { - let fn_header_span = item.span.with_hi(decl.output.span().hi()); - check_needless_must_use(cx, decl, item.hir_id, item.span, fn_header_span, attr); + let fn_header_span = item.span.with_hi(sig.decl.output.span().hi()); + check_needless_must_use(cx, &sig.decl, item.hir_id, item.span, fn_header_span, attr); return; } if cx.access_levels.is_exported(item.hir_id) && !is_proc_macro(&item.attrs) { check_must_use_candidate( cx, - decl, + &sig.decl, cx.tcx.hir().body(*body_id), item.span, item.hir_id, - item.span.with_hi(decl.output.span().hi()), + item.span.with_hi(sig.decl.output.span().hi()), "this function could have a `#[must_use]` attribute", ); } diff --git a/clippy_lints/src/lifetimes.rs b/clippy_lints/src/lifetimes.rs index be1e65fc17c..fad54c3de65 100644 --- a/clippy_lints/src/lifetimes.rs +++ b/clippy_lints/src/lifetimes.rs @@ -59,8 +59,8 @@ declare_lint_pass!(Lifetimes => [NEEDLESS_LIFETIMES, EXTRA_UNUSED_LIFETIMES]); impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Lifetimes { fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx Item) { - if let ItemKind::Fn(ref decl, _, ref generics, id) = item.kind { - check_fn_inner(cx, decl, Some(id), generics, item.span, true); + if let ItemKind::Fn(ref sig, ref generics, id) = item.kind { + check_fn_inner(cx, &sig.decl, Some(id), generics, item.span, true); } } diff --git a/clippy_lints/src/non_expressive_names.rs b/clippy_lints/src/non_expressive_names.rs index 12df9325650..8ac31743a62 100644 --- a/clippy_lints/src/non_expressive_names.rs +++ b/clippy_lints/src/non_expressive_names.rs @@ -352,8 +352,8 @@ impl<'a, 'tcx> Visitor<'tcx> for SimilarNamesLocalVisitor<'a, 'tcx> { impl EarlyLintPass for NonExpressiveNames { fn check_item(&mut self, cx: &EarlyContext<'_>, item: &Item) { - if let ItemKind::Fn(ref decl, _, _, ref blk) = item.kind { - do_check(self, cx, &item.attrs, decl, blk); + if let ItemKind::Fn(ref sig, _, ref blk) = item.kind { + do_check(self, cx, &item.attrs, &sig.decl, blk); } } diff --git a/clippy_lints/src/ptr.rs b/clippy_lints/src/ptr.rs index 8b9e39e3427..55662a1ad83 100644 --- a/clippy_lints/src/ptr.rs +++ b/clippy_lints/src/ptr.rs @@ -101,8 +101,8 @@ declare_lint_pass!(Ptr => [PTR_ARG, CMP_NULL, MUT_FROM_REF]); impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Ptr { fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx Item) { - if let ItemKind::Fn(ref decl, _, _, body_id) = item.kind { - check_fn(cx, decl, item.hir_id, Some(body_id)); + if let ItemKind::Fn(ref sig, _, body_id) = item.kind { + check_fn(cx, &sig.decl, item.hir_id, Some(body_id)); } } diff --git a/clippy_lints/src/types.rs b/clippy_lints/src/types.rs index 62da724ffd9..c303445f7d1 100644 --- a/clippy_lints/src/types.rs +++ b/clippy_lints/src/types.rs @@ -1408,7 +1408,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for TypeComplexity { fn check_trait_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx TraitItem) { match item.kind { TraitItemKind::Const(ref ty, _) | TraitItemKind::Type(_, Some(ref ty)) => self.check_type(cx, ty), - TraitItemKind::Method(MethodSig { ref decl, .. }, TraitMethod::Required(_)) => self.check_fndecl(cx, decl), + TraitItemKind::Method(FnSig { ref decl, .. }, TraitMethod::Required(_)) => self.check_fndecl(cx, decl), // methods with default impl are covered by check_fn _ => (), } @@ -2118,10 +2118,10 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for ImplicitHasher { ); } }, - ItemKind::Fn(ref decl, .., ref generics, body_id) => { + ItemKind::Fn(ref sig, ref generics, body_id) => { let body = cx.tcx.hir().body(body_id); - for ty in &decl.inputs { + for ty in &sig.decl.inputs { let mut vis = ImplicitHasherTypeVisitor::new(cx); vis.visit_ty(ty); diff --git a/clippy_lints/src/use_self.rs b/clippy_lints/src/use_self.rs index 35e154aeaee..98a78895421 100644 --- a/clippy_lints/src/use_self.rs +++ b/clippy_lints/src/use_self.rs @@ -193,7 +193,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UseSelf { if let Some(impl_trait_ref) = impl_trait_ref { for impl_item_ref in refs { let impl_item = cx.tcx.hir().impl_item(impl_item_ref.id); - if let ImplItemKind::Method(MethodSig{ decl: impl_decl, .. }, impl_body_id) + if let ImplItemKind::Method(FnSig{ decl: impl_decl, .. }, impl_body_id) = &impl_item.kind { let item_type = cx.tcx.type_of(impl_def_id); check_trait_method_impl_decl(cx, item_type, impl_item, impl_decl, &impl_trait_ref); diff --git a/clippy_lints/src/utils/mod.rs b/clippy_lints/src/utils/mod.rs index bf46a9a8b82..c75b61c6718 100644 --- a/clippy_lints/src/utils/mod.rs +++ b/clippy_lints/src/utils/mod.rs @@ -87,10 +87,10 @@ pub fn in_constant(cx: &LateContext<'_, '_>, id: HirId) -> bool { .. }) => true, Node::Item(&Item { - kind: ItemKind::Fn(_, header, ..), + kind: ItemKind::Fn(ref sig, ..), .. - }) => header.constness == Constness::Const, - Node::ImplItem(&ImplItem { + }) + | Node::ImplItem(&ImplItem { kind: ImplItemKind::Method(ref sig, _), .. }) => sig.header.constness == Constness::Const, @@ -635,7 +635,7 @@ pub fn get_enclosing_block<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, hir_id: HirId) match node { Node::Block(block) => Some(block), Node::Item(&Item { - kind: ItemKind::Fn(_, _, _, eid), + kind: ItemKind::Fn(_, _, eid), .. }) | Node::ImplItem(&ImplItem {