Skip to content

Rustup rust-lang/rust#66188 #4795

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 8, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion clippy_lints/src/attrs.rs
Original file line number Diff line number Diff line change
@@ -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
4 changes: 2 additions & 2 deletions clippy_lints/src/doc.rs
Original file line number Diff line number Diff line change
@@ -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,
12 changes: 6 additions & 6 deletions clippy_lints/src/functions.rs
Original file line number Diff line number Diff line change
@@ -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",
);
}
4 changes: 2 additions & 2 deletions clippy_lints/src/lifetimes.rs
Original file line number Diff line number Diff line change
@@ -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);
}
}

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

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

6 changes: 3 additions & 3 deletions clippy_lints/src/types.rs
Original file line number Diff line number Diff line change
@@ -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);

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