Skip to content

Commit 8d61c72

Browse files
Fix fallout from rust-lang/rust#68204
`{ast,hir}::ItemKind::Impl` use named fields now
1 parent 6bd0580 commit 8d61c72

23 files changed

+36
-36
lines changed

clippy_lints/src/copy_iterator.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ declare_lint_pass!(CopyIterator => [COPY_ITERATOR]);
3333

3434
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for CopyIterator {
3535
fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx Item<'_>) {
36-
if let ItemKind::Impl(_, _, _, _, Some(ref trait_ref), _, _) = item.kind {
36+
if let ItemKind::Impl { of_trait: Some(ref trait_ref) } = item.kind {
3737
let ty = cx.tcx.type_of(cx.tcx.hir().local_def_id(item.hir_id));
3838

3939
if is_copy(cx, ty) && match_path(&trait_ref.path, &paths::ITERATOR) {

clippy_lints/src/derive.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ declare_lint_pass!(Derive => [EXPL_IMPL_CLONE_ON_COPY, DERIVE_HASH_XOR_EQ]);
6666

6767
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Derive {
6868
fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx Item<'_>) {
69-
if let ItemKind::Impl(_, _, _, _, Some(ref trait_ref), _, _) = item.kind {
69+
if let ItemKind::Impl { of_trait: Some(ref trait_ref), .. } = item.kind {
7070
let ty = cx.tcx.type_of(cx.tcx.hir().local_def_id(item.hir_id));
7171
let is_automatically_derived = is_automatically_derived(&*item.attrs);
7272

clippy_lints/src/doc.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,15 +159,15 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for DocMarkdown {
159159
lint_for_missing_headers(cx, item.hir_id, item.span, sig, headers);
160160
}
161161
},
162-
hir::ItemKind::Impl(_, _, _, _, ref trait_ref, ..) => {
163-
self.in_trait_impl = trait_ref.is_some();
162+
hir::ItemKind::Impl { ref of_trait, .. } => {
163+
self.in_trait_impl = of_trait.is_some();
164164
},
165165
_ => {},
166166
}
167167
}
168168

169169
fn check_item_post(&mut self, _cx: &LateContext<'a, 'tcx>, item: &'tcx hir::Item<'_>) {
170-
if let hir::ItemKind::Impl(..) = item.kind {
170+
if let hir::ItemKind::Impl { .. } = item.kind {
171171
self.in_trait_impl = false;
172172
}
173173
}

clippy_lints/src/fallible_impl_from.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,11 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for FallibleImplFrom {
3636
// check for `impl From<???> for ..`
3737
let impl_def_id = cx.tcx.hir().local_def_id(item.hir_id);
3838
if_chain! {
39-
if let hir::ItemKind::Impl(.., impl_items) = item.kind;
39+
if let hir::ItemKind::Impl { items, .. } = item.kind;
4040
if let Some(impl_trait_ref) = cx.tcx.impl_trait_ref(impl_def_id);
4141
if match_def_path(cx, impl_trait_ref.def_id, &FROM_TRAIT);
4242
then {
43-
lint_impl_body(cx, item.span, impl_items);
43+
lint_impl_body(cx, item.span, items);
4444
}
4545
}
4646
}

clippy_lints/src/functions.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Functions {
196196
hir_id: hir::HirId,
197197
) {
198198
let is_impl = if let Some(hir::Node::Item(item)) = cx.tcx.hir().find(cx.tcx.hir().get_parent_node(hir_id)) {
199-
matches!(item.kind, hir::ItemKind::Impl(_, _, _, _, Some(_), _, _))
199+
matches!(item.kind, hir::ItemKind::Impl { of_trait: Some(_), .. })
200200
} else {
201201
false
202202
};

clippy_lints/src/inherent_impl.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ impl_lint_pass!(MultipleInherentImpl => [MULTIPLE_INHERENT_IMPL]);
4949

5050
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MultipleInherentImpl {
5151
fn check_item(&mut self, _: &LateContext<'a, 'tcx>, item: &'tcx Item<'_>) {
52-
if let ItemKind::Impl(_, _, _, ref generics, None, _, _) = item.kind {
52+
if let ItemKind::Impl { ref generics, of_trait: None, .. } = item.kind {
5353
// Remember for each inherent implementation encoutered its span and generics
5454
// but filter out implementations that have generic params (type or lifetime)
5555
// or are derived from a macro

clippy_lints/src/len_zero.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for LenZero {
7878

7979
match item.kind {
8080
ItemKind::Trait(_, _, _, _, ref trait_items) => check_trait_items(cx, item, trait_items),
81-
ItemKind::Impl(_, _, _, _, None, _, ref impl_items) => check_impl_items(cx, item, impl_items),
81+
ItemKind::Impl { of_trait: None, ref items, .. } => check_impl_items(cx, item, items),
8282
_ => (),
8383
}
8484
}

clippy_lints/src/methods/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1335,7 +1335,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Methods {
13351335
if_chain! {
13361336
if let hir::ImplItemKind::Method(ref sig, id) = impl_item.kind;
13371337
if let Some(first_arg) = iter_input_pats(&sig.decl, cx.tcx.hir().body(id)).next();
1338-
if let hir::ItemKind::Impl(_, _, _, _, None, _, _) = item.kind;
1338+
if let hir::ItemKind::Impl { of_trait: None, .. } = item.kind;
13391339

13401340
let method_def_id = cx.tcx.hir().local_def_id(impl_item.hir_id);
13411341
let method_sig = cx.tcx.fn_sig(method_def_id);

clippy_lints/src/missing_doc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MissingDoc {
154154
hir::ItemKind::ExternCrate(..)
155155
| hir::ItemKind::ForeignMod(..)
156156
| hir::ItemKind::GlobalAsm(..)
157-
| hir::ItemKind::Impl(..)
157+
| hir::ItemKind::Impl { .. }
158158
| hir::ItemKind::Use(..) => return,
159159
};
160160

clippy_lints/src/missing_inline.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MissingInline {
124124
| hir::ItemKind::OpaqueTy(..)
125125
| hir::ItemKind::ExternCrate(..)
126126
| hir::ItemKind::ForeignMod(..)
127-
| hir::ItemKind::Impl(..)
127+
| hir::ItemKind::Impl { .. }
128128
| hir::ItemKind::Use(..) => {},
129129
};
130130
}

0 commit comments

Comments
 (0)