mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-26 22:50:56 +00:00
Rustup to rust-lang/rust#66931
This commit is contained in:
parent
9632e27487
commit
f6a5b608ef
11 changed files with 12 additions and 12 deletions
|
@ -232,7 +232,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Attributes {
|
|||
ItemKind::ExternCrate(..) | ItemKind::Use(..) => {
|
||||
let skip_unused_imports = item.attrs.iter().any(|attr| attr.check_name(sym!(macro_use)));
|
||||
|
||||
for attr in &item.attrs {
|
||||
for attr in item.attrs {
|
||||
if in_external_macro(cx.sess(), attr.span) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnportableVariant {
|
|||
return;
|
||||
}
|
||||
if let ItemKind::Enum(def, _) = &item.kind {
|
||||
for var in &def.variants {
|
||||
for var in def.variants {
|
||||
if let Some(anon_const) = &var.disr_expr {
|
||||
let param_env = ty::ParamEnv::empty();
|
||||
let def_id = cx.tcx.hir().body_owner_def_id(anon_const.body);
|
||||
|
|
|
@ -32,7 +32,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for EnumGlobUse {
|
|||
fn check_mod(&mut self, cx: &LateContext<'a, 'tcx>, m: &'tcx Mod<'_>, _: Span, _: HirId) {
|
||||
let map = cx.tcx.hir();
|
||||
// only check top level `use` statements
|
||||
for item in &m.item_ids {
|
||||
for item in m.item_ids {
|
||||
lint_item(cx, map.expect_item(item.id));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for FallibleImplFrom {
|
|||
// check for `impl From<???> for ..`
|
||||
let impl_def_id = cx.tcx.hir().local_def_id(item.hir_id);
|
||||
if_chain! {
|
||||
if let hir::ItemKind::Impl(.., ref impl_items) = item.kind;
|
||||
if let hir::ItemKind::Impl(.., impl_items) = item.kind;
|
||||
if let Some(impl_trait_ref) = cx.tcx.impl_trait_ref(impl_def_id);
|
||||
if match_def_path(cx, impl_trait_ref.def_id, &FROM_TRAIT);
|
||||
then {
|
||||
|
@ -46,7 +46,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for FallibleImplFrom {
|
|||
}
|
||||
}
|
||||
|
||||
fn lint_impl_body<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, impl_span: Span, impl_items: &hir::HirVec<hir::ImplItemRef>) {
|
||||
fn lint_impl_body<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, impl_span: Span, impl_items: &[hir::ImplItemRef]) {
|
||||
use rustc::hir::intravisit::{self, NestedVisitorMap, Visitor};
|
||||
use rustc::hir::*;
|
||||
|
||||
|
|
|
@ -94,7 +94,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MissingInline {
|
|||
let desc = "a function";
|
||||
check_missing_inline_attrs(cx, &it.attrs, it.span, desc);
|
||||
},
|
||||
hir::ItemKind::Trait(ref _is_auto, ref _unsafe, ref _generics, ref _bounds, ref trait_items) => {
|
||||
hir::ItemKind::Trait(ref _is_auto, ref _unsafe, ref _generics, ref _bounds, trait_items) => {
|
||||
// note: we need to check if the trait is exported so we can't use
|
||||
// `LateLintPass::check_trait_item` here.
|
||||
for tit in trait_items {
|
||||
|
|
|
@ -144,7 +144,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NeedlessPassByValue {
|
|||
let fn_sig = cx.tcx.fn_sig(fn_def_id);
|
||||
let fn_sig = cx.tcx.erase_late_bound_regions(&fn_sig);
|
||||
|
||||
for (idx, ((input, &ty), arg)) in decl.inputs.iter().zip(fn_sig.inputs()).zip(&body.params).enumerate() {
|
||||
for (idx, ((input, &ty), arg)) in decl.inputs.iter().zip(fn_sig.inputs()).zip(body.params).enumerate() {
|
||||
// All spans generated from a proc-macro invocation are the same...
|
||||
if span == input.span {
|
||||
return;
|
||||
|
|
|
@ -94,7 +94,7 @@ impl_lint_pass!(NewWithoutDefault => [NEW_WITHOUT_DEFAULT]);
|
|||
|
||||
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NewWithoutDefault {
|
||||
fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx hir::Item<'_>) {
|
||||
if let hir::ItemKind::Impl(_, _, _, _, None, _, ref items) = item.kind {
|
||||
if let hir::ItemKind::Impl(_, _, _, _, None, _, items) = item.kind {
|
||||
for assoc_item in items {
|
||||
if let hir::AssocItemKind::Method { has_self: false } = assoc_item.kind {
|
||||
let impl_item = cx.tcx.hir().impl_item(assoc_item.id);
|
||||
|
|
|
@ -34,7 +34,7 @@ declare_lint_pass!(PartialEqNeImpl => [PARTIALEQ_NE_IMPL]);
|
|||
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for PartialEqNeImpl {
|
||||
fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx Item<'_>) {
|
||||
if_chain! {
|
||||
if let ItemKind::Impl(_, _, _, _, Some(ref trait_ref), _, ref impl_items) = item.kind;
|
||||
if let ItemKind::Impl(_, _, _, _, Some(ref trait_ref), _, impl_items) = item.kind;
|
||||
if !is_automatically_derived(&*item.attrs);
|
||||
if let Some(eq_trait) = cx.tcx.lang_items().eq_trait();
|
||||
if trait_ref.path.res.def_id() == eq_trait;
|
||||
|
|
|
@ -23,7 +23,7 @@ declare_lint_pass!(SerdeAPI => [SERDE_API_MISUSE]);
|
|||
|
||||
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for SerdeAPI {
|
||||
fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx Item<'_>) {
|
||||
if let ItemKind::Impl(_, _, _, _, Some(ref trait_ref), _, ref items) = item.kind {
|
||||
if let ItemKind::Impl(_, _, _, _, Some(ref trait_ref), _, items) = item.kind {
|
||||
let did = trait_ref.path.res.def_id();
|
||||
if let Some(visit_did) = get_trait_def_id(cx, &paths::SERDE_DE_VISITOR) {
|
||||
if did == visit_did {
|
||||
|
|
|
@ -44,7 +44,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnusedSelf {
|
|||
if item.span.from_expansion() {
|
||||
return;
|
||||
}
|
||||
if let ItemKind::Impl(_, _, _, _, None, _, ref impl_item_refs) = item.kind {
|
||||
if let ItemKind::Impl(_, _, _, _, None, _, impl_item_refs) = item.kind {
|
||||
for impl_item_ref in impl_item_refs {
|
||||
if_chain! {
|
||||
if let ImplItemRef {
|
||||
|
|
|
@ -170,7 +170,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UseSelf {
|
|||
return;
|
||||
}
|
||||
if_chain! {
|
||||
if let ItemKind::Impl(.., ref item_type, ref refs) = item.kind;
|
||||
if let ItemKind::Impl(.., ref item_type, refs) = item.kind;
|
||||
if let TyKind::Path(QPath::Resolved(_, ref item_path)) = item_type.kind;
|
||||
then {
|
||||
let parameters = &item_path.segments.last().expect(SEGMENTS_MSG).args;
|
||||
|
|
Loading…
Reference in a new issue