Rustup to rust-lang/rust#68204
This commit is contained in:
parent
6bd0580887
commit
e72f0e61c6
24 changed files with 75 additions and 28 deletions
|
@ -33,7 +33,11 @@ declare_lint_pass!(CopyIterator => [COPY_ITERATOR]);
|
||||||
|
|
||||||
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for CopyIterator {
|
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for CopyIterator {
|
||||||
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::Impl(_, _, _, _, Some(ref trait_ref), _, _) = item.kind {
|
if let ItemKind::Impl {
|
||||||
|
of_trait: Some(ref trait_ref),
|
||||||
|
..
|
||||||
|
} = item.kind
|
||||||
|
{
|
||||||
let ty = cx.tcx.type_of(cx.tcx.hir().local_def_id(item.hir_id));
|
let ty = cx.tcx.type_of(cx.tcx.hir().local_def_id(item.hir_id));
|
||||||
|
|
||||||
if is_copy(cx, ty) && match_path(&trait_ref.path, &paths::ITERATOR) {
|
if is_copy(cx, ty) && match_path(&trait_ref.path, &paths::ITERATOR) {
|
||||||
|
|
|
@ -66,7 +66,11 @@ declare_lint_pass!(Derive => [EXPL_IMPL_CLONE_ON_COPY, DERIVE_HASH_XOR_EQ]);
|
||||||
|
|
||||||
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Derive {
|
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Derive {
|
||||||
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::Impl(_, _, _, _, Some(ref trait_ref), _, _) = item.kind {
|
if let ItemKind::Impl {
|
||||||
|
of_trait: Some(ref trait_ref),
|
||||||
|
..
|
||||||
|
} = item.kind
|
||||||
|
{
|
||||||
let ty = cx.tcx.type_of(cx.tcx.hir().local_def_id(item.hir_id));
|
let ty = cx.tcx.type_of(cx.tcx.hir().local_def_id(item.hir_id));
|
||||||
let is_automatically_derived = is_automatically_derived(&*item.attrs);
|
let is_automatically_derived = is_automatically_derived(&*item.attrs);
|
||||||
|
|
||||||
|
|
|
@ -159,7 +159,10 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for DocMarkdown {
|
||||||
lint_for_missing_headers(cx, item.hir_id, item.span, sig, headers);
|
lint_for_missing_headers(cx, item.hir_id, item.span, sig, headers);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
hir::ItemKind::Impl(_, _, _, _, ref trait_ref, ..) => {
|
hir::ItemKind::Impl {
|
||||||
|
of_trait: ref trait_ref,
|
||||||
|
..
|
||||||
|
} => {
|
||||||
self.in_trait_impl = trait_ref.is_some();
|
self.in_trait_impl = trait_ref.is_some();
|
||||||
},
|
},
|
||||||
_ => {},
|
_ => {},
|
||||||
|
@ -167,7 +170,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for DocMarkdown {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn check_item_post(&mut self, _cx: &LateContext<'a, 'tcx>, item: &'tcx hir::Item<'_>) {
|
fn check_item_post(&mut self, _cx: &LateContext<'a, 'tcx>, item: &'tcx hir::Item<'_>) {
|
||||||
if let hir::ItemKind::Impl(..) = item.kind {
|
if let hir::ItemKind::Impl { .. } = item.kind {
|
||||||
self.in_trait_impl = false;
|
self.in_trait_impl = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,7 +64,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for BoxedLocal {
|
||||||
let parent_node = cx.tcx.hir().find(parent_id);
|
let parent_node = cx.tcx.hir().find(parent_id);
|
||||||
|
|
||||||
if let Some(Node::Item(item)) = parent_node {
|
if let Some(Node::Item(item)) = parent_node {
|
||||||
if let ItemKind::Impl(_, _, _, _, Some(..), _, _) = item.kind {
|
if let ItemKind::Impl { of_trait: Some(_), .. } = item.kind {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for FallibleImplFrom {
|
||||||
// check for `impl From<???> for ..`
|
// check for `impl From<???> for ..`
|
||||||
let impl_def_id = cx.tcx.hir().local_def_id(item.hir_id);
|
let impl_def_id = cx.tcx.hir().local_def_id(item.hir_id);
|
||||||
if_chain! {
|
if_chain! {
|
||||||
if let hir::ItemKind::Impl(.., impl_items) = item.kind;
|
if let hir::ItemKind::Impl{ items: impl_items, .. } = item.kind;
|
||||||
if let Some(impl_trait_ref) = cx.tcx.impl_trait_ref(impl_def_id);
|
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);
|
if match_def_path(cx, impl_trait_ref.def_id, &FROM_TRAIT);
|
||||||
then {
|
then {
|
||||||
|
|
|
@ -196,7 +196,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Functions {
|
||||||
hir_id: hir::HirId,
|
hir_id: hir::HirId,
|
||||||
) {
|
) {
|
||||||
let is_impl = if let Some(hir::Node::Item(item)) = cx.tcx.hir().find(cx.tcx.hir().get_parent_node(hir_id)) {
|
let is_impl = if let Some(hir::Node::Item(item)) = cx.tcx.hir().find(cx.tcx.hir().get_parent_node(hir_id)) {
|
||||||
matches!(item.kind, hir::ItemKind::Impl(_, _, _, _, Some(_), _, _))
|
matches!(item.kind, hir::ItemKind::Impl{ of_trait: Some(_), .. })
|
||||||
} else {
|
} else {
|
||||||
false
|
false
|
||||||
};
|
};
|
||||||
|
|
|
@ -49,7 +49,12 @@ impl_lint_pass!(MultipleInherentImpl => [MULTIPLE_INHERENT_IMPL]);
|
||||||
|
|
||||||
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MultipleInherentImpl {
|
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MultipleInherentImpl {
|
||||||
fn check_item(&mut self, _: &LateContext<'a, 'tcx>, item: &'tcx Item<'_>) {
|
fn check_item(&mut self, _: &LateContext<'a, 'tcx>, item: &'tcx Item<'_>) {
|
||||||
if let ItemKind::Impl(_, _, _, ref generics, None, _, _) = item.kind {
|
if let ItemKind::Impl {
|
||||||
|
ref generics,
|
||||||
|
of_trait: None,
|
||||||
|
..
|
||||||
|
} = item.kind
|
||||||
|
{
|
||||||
// Remember for each inherent implementation encoutered its span and generics
|
// Remember for each inherent implementation encoutered its span and generics
|
||||||
// but filter out implementations that have generic params (type or lifetime)
|
// but filter out implementations that have generic params (type or lifetime)
|
||||||
// or are derived from a macro
|
// or are derived from a macro
|
||||||
|
|
|
@ -78,7 +78,11 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for LenZero {
|
||||||
|
|
||||||
match item.kind {
|
match item.kind {
|
||||||
ItemKind::Trait(_, _, _, _, ref trait_items) => check_trait_items(cx, item, trait_items),
|
ItemKind::Trait(_, _, _, _, ref trait_items) => check_trait_items(cx, item, trait_items),
|
||||||
ItemKind::Impl(_, _, _, _, None, _, ref impl_items) => check_impl_items(cx, item, impl_items),
|
ItemKind::Impl {
|
||||||
|
of_trait: None,
|
||||||
|
items: ref impl_items,
|
||||||
|
..
|
||||||
|
} => check_impl_items(cx, item, impl_items),
|
||||||
_ => (),
|
_ => (),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1335,7 +1335,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Methods {
|
||||||
if_chain! {
|
if_chain! {
|
||||||
if let hir::ImplItemKind::Method(ref sig, id) = impl_item.kind;
|
if let hir::ImplItemKind::Method(ref sig, id) = impl_item.kind;
|
||||||
if let Some(first_arg) = iter_input_pats(&sig.decl, cx.tcx.hir().body(id)).next();
|
if let Some(first_arg) = iter_input_pats(&sig.decl, cx.tcx.hir().body(id)).next();
|
||||||
if let hir::ItemKind::Impl(_, _, _, _, None, _, _) = item.kind;
|
if let hir::ItemKind::Impl{ of_trait: None, .. } = item.kind;
|
||||||
|
|
||||||
let method_def_id = cx.tcx.hir().local_def_id(impl_item.hir_id);
|
let method_def_id = cx.tcx.hir().local_def_id(impl_item.hir_id);
|
||||||
let method_sig = cx.tcx.fn_sig(method_def_id);
|
let method_sig = cx.tcx.fn_sig(method_def_id);
|
||||||
|
|
|
@ -154,7 +154,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MissingDoc {
|
||||||
hir::ItemKind::ExternCrate(..)
|
hir::ItemKind::ExternCrate(..)
|
||||||
| hir::ItemKind::ForeignMod(..)
|
| hir::ItemKind::ForeignMod(..)
|
||||||
| hir::ItemKind::GlobalAsm(..)
|
| hir::ItemKind::GlobalAsm(..)
|
||||||
| hir::ItemKind::Impl(..)
|
| hir::ItemKind::Impl { .. }
|
||||||
| hir::ItemKind::Use(..) => return,
|
| hir::ItemKind::Use(..) => return,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -124,7 +124,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MissingInline {
|
||||||
| hir::ItemKind::OpaqueTy(..)
|
| hir::ItemKind::OpaqueTy(..)
|
||||||
| hir::ItemKind::ExternCrate(..)
|
| hir::ItemKind::ExternCrate(..)
|
||||||
| hir::ItemKind::ForeignMod(..)
|
| hir::ItemKind::ForeignMod(..)
|
||||||
| hir::ItemKind::Impl(..)
|
| hir::ItemKind::Impl { .. }
|
||||||
| hir::ItemKind::Use(..) => {},
|
| hir::ItemKind::Use(..) => {},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -91,7 +91,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NeedlessPassByValue {
|
||||||
|
|
||||||
// Exclude non-inherent impls
|
// Exclude non-inherent impls
|
||||||
if let Some(Node::Item(item)) = cx.tcx.hir().find(cx.tcx.hir().get_parent_node(hir_id)) {
|
if let Some(Node::Item(item)) = cx.tcx.hir().find(cx.tcx.hir().get_parent_node(hir_id)) {
|
||||||
if matches!(item.kind, ItemKind::Impl(_, _, _, _, Some(_), _, _) |
|
if matches!(item.kind, ItemKind::Impl{ of_trait: Some(_), .. } |
|
||||||
ItemKind::Trait(..))
|
ItemKind::Trait(..))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -93,8 +93,12 @@ pub struct NewWithoutDefault {
|
||||||
impl_lint_pass!(NewWithoutDefault => [NEW_WITHOUT_DEFAULT]);
|
impl_lint_pass!(NewWithoutDefault => [NEW_WITHOUT_DEFAULT]);
|
||||||
|
|
||||||
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NewWithoutDefault {
|
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NewWithoutDefault {
|
||||||
|
#[allow(clippy::too_many_lines)]
|
||||||
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<'_>) {
|
||||||
if let hir::ItemKind::Impl(_, _, _, _, None, _, items) = item.kind {
|
if let hir::ItemKind::Impl {
|
||||||
|
of_trait: None, items, ..
|
||||||
|
} = item.kind
|
||||||
|
{
|
||||||
for assoc_item in items {
|
for assoc_item in items {
|
||||||
if let hir::AssocItemKind::Method { has_self: false } = assoc_item.kind {
|
if let hir::AssocItemKind::Method { has_self: false } = assoc_item.kind {
|
||||||
let impl_item = cx.tcx.hir().impl_item(assoc_item.id);
|
let impl_item = cx.tcx.hir().impl_item(assoc_item.id);
|
||||||
|
|
|
@ -168,7 +168,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NonCopyConst {
|
||||||
let item_hir_id = cx.tcx.hir().get_parent_node(impl_item.hir_id);
|
let item_hir_id = cx.tcx.hir().get_parent_node(impl_item.hir_id);
|
||||||
let item = cx.tcx.hir().expect_item(item_hir_id);
|
let item = cx.tcx.hir().expect_item(item_hir_id);
|
||||||
// Ensure the impl is an inherent impl.
|
// Ensure the impl is an inherent impl.
|
||||||
if let ItemKind::Impl(_, _, _, _, None, _, _) = item.kind {
|
if let ItemKind::Impl { of_trait: None, .. } = item.kind {
|
||||||
let ty = hir_ty_to_ty(cx.tcx, hir_ty);
|
let ty = hir_ty_to_ty(cx.tcx, hir_ty);
|
||||||
verify_ty_bound(
|
verify_ty_bound(
|
||||||
cx,
|
cx,
|
||||||
|
|
|
@ -33,7 +33,7 @@ declare_lint_pass!(PartialEqNeImpl => [PARTIALEQ_NE_IMPL]);
|
||||||
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for PartialEqNeImpl {
|
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for PartialEqNeImpl {
|
||||||
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_chain! {
|
if_chain! {
|
||||||
if let ItemKind::Impl(_, _, _, _, Some(ref trait_ref), _, impl_items) = item.kind;
|
if let ItemKind::Impl{ of_trait: Some(ref trait_ref), items: impl_items, .. } = item.kind;
|
||||||
if !is_automatically_derived(&*item.attrs);
|
if !is_automatically_derived(&*item.attrs);
|
||||||
if let Some(eq_trait) = cx.tcx.lang_items().eq_trait();
|
if let Some(eq_trait) = cx.tcx.lang_items().eq_trait();
|
||||||
if trait_ref.path.res.def_id() == eq_trait;
|
if trait_ref.path.res.def_id() == eq_trait;
|
||||||
|
|
|
@ -110,7 +110,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Ptr {
|
||||||
if let ImplItemKind::Method(ref sig, body_id) = item.kind {
|
if let ImplItemKind::Method(ref sig, body_id) = item.kind {
|
||||||
let parent_item = cx.tcx.hir().get_parent_item(item.hir_id);
|
let parent_item = cx.tcx.hir().get_parent_item(item.hir_id);
|
||||||
if let Some(Node::Item(it)) = cx.tcx.hir().find(parent_item) {
|
if let Some(Node::Item(it)) = cx.tcx.hir().find(parent_item) {
|
||||||
if let ItemKind::Impl(_, _, _, _, Some(_), _, _) = it.kind {
|
if let ItemKind::Impl { of_trait: Some(_), .. } = it.kind {
|
||||||
return; // ignore trait impls
|
return; // ignore trait impls
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,12 @@ declare_lint_pass!(SerdeAPI => [SERDE_API_MISUSE]);
|
||||||
|
|
||||||
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for SerdeAPI {
|
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for SerdeAPI {
|
||||||
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::Impl(_, _, _, _, Some(ref trait_ref), _, items) = item.kind {
|
if let ItemKind::Impl {
|
||||||
|
of_trait: Some(ref trait_ref),
|
||||||
|
items,
|
||||||
|
..
|
||||||
|
} = item.kind
|
||||||
|
{
|
||||||
let did = trait_ref.path.res.def_id();
|
let did = trait_ref.path.res.def_id();
|
||||||
if let Some(visit_did) = get_trait_def_id(cx, &paths::SERDE_DE_VISITOR) {
|
if let Some(visit_did) = get_trait_def_id(cx, &paths::SERDE_DE_VISITOR) {
|
||||||
if did == visit_did {
|
if did == visit_did {
|
||||||
|
|
|
@ -167,7 +167,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for TriviallyCopyPassByRef {
|
||||||
|
|
||||||
// Exclude non-inherent impls
|
// Exclude non-inherent impls
|
||||||
if let Some(Node::Item(item)) = cx.tcx.hir().find(cx.tcx.hir().get_parent_node(hir_id)) {
|
if let Some(Node::Item(item)) = cx.tcx.hir().find(cx.tcx.hir().get_parent_node(hir_id)) {
|
||||||
if matches!(item.kind, ItemKind::Impl(_, _, _, _, Some(_), _, _) |
|
if matches!(item.kind, ItemKind::Impl{ of_trait: Some(_), .. } |
|
||||||
ItemKind::Trait(..))
|
ItemKind::Trait(..))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -181,7 +181,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Types {
|
||||||
) {
|
) {
|
||||||
// Skip trait implementations; see issue #605.
|
// Skip trait implementations; see issue #605.
|
||||||
if let Some(hir::Node::Item(item)) = cx.tcx.hir().find(cx.tcx.hir().get_parent_item(id)) {
|
if let Some(hir::Node::Item(item)) = cx.tcx.hir().find(cx.tcx.hir().get_parent_item(id)) {
|
||||||
if let ItemKind::Impl(_, _, _, _, Some(..), _, _) = item.kind {
|
if let ItemKind::Impl { of_trait: Some(_), .. } = item.kind {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2106,7 +2106,12 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for ImplicitHasher {
|
||||||
}
|
}
|
||||||
|
|
||||||
match item.kind {
|
match item.kind {
|
||||||
ItemKind::Impl(_, _, _, ref generics, _, ref ty, ref items) => {
|
ItemKind::Impl {
|
||||||
|
ref generics,
|
||||||
|
self_ty: ref ty,
|
||||||
|
ref items,
|
||||||
|
..
|
||||||
|
} => {
|
||||||
let mut vis = ImplicitHasherTypeVisitor::new(cx);
|
let mut vis = ImplicitHasherTypeVisitor::new(cx);
|
||||||
vis.visit_ty(ty);
|
vis.visit_ty(ty);
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,12 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnusedSelf {
|
||||||
if item.span.from_expansion() {
|
if item.span.from_expansion() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if let ItemKind::Impl(_, _, _, _, None, _, impl_item_refs) = item.kind {
|
if let ItemKind::Impl {
|
||||||
|
of_trait: None,
|
||||||
|
items: impl_item_refs,
|
||||||
|
..
|
||||||
|
} = item.kind
|
||||||
|
{
|
||||||
for impl_item_ref in impl_item_refs {
|
for impl_item_ref in impl_item_refs {
|
||||||
if_chain! {
|
if_chain! {
|
||||||
if let ImplItemRef {
|
if let ImplItemRef {
|
||||||
|
|
|
@ -173,7 +173,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UseSelf {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if_chain! {
|
if_chain! {
|
||||||
if let ItemKind::Impl(.., ref item_type, refs) = item.kind;
|
if let ItemKind::Impl{ self_ty: ref item_type, items: refs, .. } = item.kind;
|
||||||
if let TyKind::Path(QPath::Resolved(_, ref item_path)) = item_type.kind;
|
if let TyKind::Path(QPath::Resolved(_, ref item_path)) = item_type.kind;
|
||||||
then {
|
then {
|
||||||
let parameters = &item_path.segments.last().expect(SEGMENTS_MSG).args;
|
let parameters = &item_path.segments.last().expect(SEGMENTS_MSG).args;
|
||||||
|
@ -269,7 +269,7 @@ impl<'a, 'tcx> Visitor<'tcx> for UseSelfVisitor<'a, 'tcx> {
|
||||||
| ItemKind::Enum(..)
|
| ItemKind::Enum(..)
|
||||||
| ItemKind::Struct(..)
|
| ItemKind::Struct(..)
|
||||||
| ItemKind::Union(..)
|
| ItemKind::Union(..)
|
||||||
| ItemKind::Impl(..)
|
| ItemKind::Impl { .. }
|
||||||
| ItemKind::Fn(..) => {
|
| ItemKind::Fn(..) => {
|
||||||
// Don't check statements that shadow `Self` or where `Self` can't be used
|
// Don't check statements that shadow `Self` or where `Self` can't be used
|
||||||
},
|
},
|
||||||
|
|
|
@ -388,10 +388,13 @@ fn print_item(cx: &LateContext<'_, '_>, item: &hir::Item<'_>) {
|
||||||
hir::ItemKind::TraitAlias(..) => {
|
hir::ItemKind::TraitAlias(..) => {
|
||||||
println!("trait alias");
|
println!("trait alias");
|
||||||
},
|
},
|
||||||
hir::ItemKind::Impl(_, _, _, _, Some(ref _trait_ref), _, _) => {
|
hir::ItemKind::Impl {
|
||||||
|
of_trait: Some(ref _trait_ref),
|
||||||
|
..
|
||||||
|
} => {
|
||||||
println!("trait impl");
|
println!("trait impl");
|
||||||
},
|
},
|
||||||
hir::ItemKind::Impl(_, _, _, _, None, _, _) => {
|
hir::ItemKind::Impl { of_trait: None, .. } => {
|
||||||
println!("impl");
|
println!("impl");
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -219,7 +219,12 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for LintWithoutLintPass {
|
||||||
} else if is_expn_of(item.span, "impl_lint_pass").is_some()
|
} else if is_expn_of(item.span, "impl_lint_pass").is_some()
|
||||||
|| is_expn_of(item.span, "declare_lint_pass").is_some()
|
|| is_expn_of(item.span, "declare_lint_pass").is_some()
|
||||||
{
|
{
|
||||||
if let hir::ItemKind::Impl(.., None, _, ref impl_item_refs) = item.kind {
|
if let hir::ItemKind::Impl {
|
||||||
|
of_trait: None,
|
||||||
|
items: ref impl_item_refs,
|
||||||
|
..
|
||||||
|
} = item.kind
|
||||||
|
{
|
||||||
let mut collector = LintCollector {
|
let mut collector = LintCollector {
|
||||||
output: &mut self.registered_lints,
|
output: &mut self.registered_lints,
|
||||||
cx,
|
cx,
|
||||||
|
|
|
@ -357,7 +357,7 @@ pub fn trait_ref_of_method<'tcx>(cx: &LateContext<'_, 'tcx>, hir_id: HirId) -> O
|
||||||
if_chain! {
|
if_chain! {
|
||||||
if parent_impl != hir::CRATE_HIR_ID;
|
if parent_impl != hir::CRATE_HIR_ID;
|
||||||
if let hir::Node::Item(item) = cx.tcx.hir().get(parent_impl);
|
if let hir::Node::Item(item) = cx.tcx.hir().get(parent_impl);
|
||||||
if let hir::ItemKind::Impl(_, _, _, _, trait_ref, _, _) = &item.kind;
|
if let hir::ItemKind::Impl{ of_trait: trait_ref, .. } = &item.kind;
|
||||||
then { return trait_ref.as_ref(); }
|
then { return trait_ref.as_ref(); }
|
||||||
}
|
}
|
||||||
None
|
None
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue