This commit is contained in:
HMPerson1 2019-11-08 15:12:08 -05:00
parent 4192dbedcb
commit d4758420e6
No known key found for this signature in database
GPG key ID: 1FB477DDD27821CE
9 changed files with 22 additions and 22 deletions

View file

@ -355,7 +355,7 @@ fn check_clippy_lint_names(cx: &LateContext<'_, '_>, items: &[NestedMetaItem]) {
} }
fn is_relevant_item(cx: &LateContext<'_, '_>, item: &Item) -> bool { 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) is_relevant_expr(cx, cx.tcx.body_tables(eid), &cx.tcx.hir().body(eid).value)
} else { } else {
true true

View file

@ -126,8 +126,8 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for DocMarkdown {
} }
// no safety header // no safety header
match item.kind { match item.kind {
hir::ItemKind::Fn(_, ref header, ..) => { hir::ItemKind::Fn(ref sig, ..) => {
if cx.access_levels.is_exported(item.hir_id) && header.unsafety == hir::Unsafety::Unsafe { if cx.access_levels.is_exported(item.hir_id) && sig.header.unsafety == hir::Unsafety::Unsafe {
span_lint( span_lint(
cx, cx,
MISSING_SAFETY_DOC, MISSING_SAFETY_DOC,

View file

@ -208,7 +208,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Functions {
match kind { match kind {
hir::intravisit::FnKind::Method( hir::intravisit::FnKind::Method(
_, _,
&hir::MethodSig { &hir::FnSig {
header: hir::FnHeader { abi: Abi::Rust, .. }, 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) { fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx hir::Item) {
let attr = must_use_attr(&item.attrs); 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 { if let Some(attr) = attr {
let fn_header_span = item.span.with_hi(decl.output.span().hi()); let fn_header_span = item.span.with_hi(sig.decl.output.span().hi());
check_needless_must_use(cx, decl, item.hir_id, item.span, fn_header_span, attr); check_needless_must_use(cx, &sig.decl, item.hir_id, item.span, fn_header_span, attr);
return; return;
} }
if cx.access_levels.is_exported(item.hir_id) && !is_proc_macro(&item.attrs) { if cx.access_levels.is_exported(item.hir_id) && !is_proc_macro(&item.attrs) {
check_must_use_candidate( check_must_use_candidate(
cx, cx,
decl, &sig.decl,
cx.tcx.hir().body(*body_id), cx.tcx.hir().body(*body_id),
item.span, item.span,
item.hir_id, 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", "this function could have a `#[must_use]` attribute",
); );
} }

View file

@ -59,8 +59,8 @@ declare_lint_pass!(Lifetimes => [NEEDLESS_LIFETIMES, EXTRA_UNUSED_LIFETIMES]);
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Lifetimes { impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Lifetimes {
fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx Item) { fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx Item) {
if let ItemKind::Fn(ref decl, _, ref generics, id) = item.kind { if let ItemKind::Fn(ref sig, ref generics, id) = item.kind {
check_fn_inner(cx, decl, Some(id), generics, item.span, true); check_fn_inner(cx, &sig.decl, Some(id), generics, item.span, true);
} }
} }

View file

@ -352,8 +352,8 @@ impl<'a, 'tcx> Visitor<'tcx> for SimilarNamesLocalVisitor<'a, 'tcx> {
impl EarlyLintPass for NonExpressiveNames { impl EarlyLintPass for NonExpressiveNames {
fn check_item(&mut self, cx: &EarlyContext<'_>, item: &Item) { fn check_item(&mut self, cx: &EarlyContext<'_>, item: &Item) {
if let ItemKind::Fn(ref decl, _, _, ref blk) = item.kind { if let ItemKind::Fn(ref sig, _, ref blk) = item.kind {
do_check(self, cx, &item.attrs, decl, blk); do_check(self, cx, &item.attrs, &sig.decl, blk);
} }
} }

View file

@ -101,8 +101,8 @@ declare_lint_pass!(Ptr => [PTR_ARG, CMP_NULL, MUT_FROM_REF]);
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Ptr { impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Ptr {
fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx Item) { fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx Item) {
if let ItemKind::Fn(ref decl, _, _, body_id) = item.kind { if let ItemKind::Fn(ref sig, _, body_id) = item.kind {
check_fn(cx, decl, item.hir_id, Some(body_id)); check_fn(cx, &sig.decl, item.hir_id, Some(body_id));
} }
} }

View file

@ -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) { fn check_trait_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx TraitItem) {
match item.kind { match item.kind {
TraitItemKind::Const(ref ty, _) | TraitItemKind::Type(_, Some(ref ty)) => self.check_type(cx, ty), 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 // 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); 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); let mut vis = ImplicitHasherTypeVisitor::new(cx);
vis.visit_ty(ty); vis.visit_ty(ty);

View file

@ -193,7 +193,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UseSelf {
if let Some(impl_trait_ref) = impl_trait_ref { if let Some(impl_trait_ref) = impl_trait_ref {
for impl_item_ref in refs { for impl_item_ref in refs {
let impl_item = cx.tcx.hir().impl_item(impl_item_ref.id); 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 { = &impl_item.kind {
let item_type = cx.tcx.type_of(impl_def_id); 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); check_trait_method_impl_decl(cx, item_type, impl_item, impl_decl, &impl_trait_ref);

View file

@ -87,9 +87,9 @@ pub fn in_constant(cx: &LateContext<'_, '_>, id: HirId) -> bool {
.. ..
}) => true, }) => true,
Node::Item(&Item { Node::Item(&Item {
kind: ItemKind::Fn(_, header, ..), kind: ItemKind::Fn(ref sig, ..),
.. ..
}) => header.constness == Constness::Const, }) => sig.header.constness == Constness::Const,
Node::ImplItem(&ImplItem { Node::ImplItem(&ImplItem {
kind: ImplItemKind::Method(ref sig, _), kind: ImplItemKind::Method(ref sig, _),
.. ..
@ -635,7 +635,7 @@ pub fn get_enclosing_block<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, hir_id: HirId)
match node { match node {
Node::Block(block) => Some(block), Node::Block(block) => Some(block),
Node::Item(&Item { Node::Item(&Item {
kind: ItemKind::Fn(_, _, _, eid), kind: ItemKind::Fn(_, _, eid),
.. ..
}) })
| Node::ImplItem(&ImplItem { | Node::ImplItem(&ImplItem {