Skip to content

Commit

Permalink
Auto merge of #4795 - HMPerson1:rustup, r=matthiaskrgr
Browse files Browse the repository at this point in the history
Rustup rust-lang/rust#66188

changelog: none
  • Loading branch information
bors committed Nov 8, 2019
2 parents 4192dbe + 94b36d9 commit 37fa1e2
Show file tree
Hide file tree
Showing 9 changed files with 23 additions and 23 deletions.
2 changes: 1 addition & 1 deletion clippy_lints/src/attrs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions clippy_lints/src/doc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
12 changes: 6 additions & 6 deletions clippy_lints/src/functions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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, .. },
..
},
Expand All @@ -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",
);
}
Expand Down
4 changes: 2 additions & 2 deletions clippy_lints/src/lifetimes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down
4 changes: 2 additions & 2 deletions clippy_lints/src/non_expressive_names.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down
4 changes: 2 additions & 2 deletions clippy_lints/src/ptr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
}

Expand Down
6 changes: 3 additions & 3 deletions clippy_lints/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
_ => (),
}
Expand Down Expand Up @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/use_self.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
8 changes: 4 additions & 4 deletions clippy_lints/src/utils/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 37fa1e2

Please sign in to comment.