Skip to content

Commit ea75178

Browse files
committed
separate definitions and HIR owners
fix a ui test use `into` fix clippy ui test fix a run-make-fulldeps test implement `IntoQueryParam<DefId>` for `OwnerId` use `OwnerId` for more queries change the type of `ParentOwnerIterator::Item` to `(OwnerId, OwnerNode)`
1 parent de8a1dd commit ea75178

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+85
-85
lines changed

clippy_lints/src/dereference.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -704,7 +704,7 @@ fn walk_parents<'tcx>(
704704
span,
705705
..
706706
}) if span.ctxt() == ctxt => {
707-
let ty = cx.tcx.type_of(def_id);
707+
let ty = cx.tcx.type_of(def_id.def_id);
708708
Some(ty_auto_deref_stability(cx, ty, precedence).position_for_result(cx))
709709
},
710710

clippy_lints/src/doc.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -233,11 +233,11 @@ impl<'tcx> LateLintPass<'tcx> for DocMarkdown {
233233
let body = cx.tcx.hir().body(body_id);
234234
let mut fpu = FindPanicUnwrap {
235235
cx,
236-
typeck_results: cx.tcx.typeck(item.def_id),
236+
typeck_results: cx.tcx.typeck(item.def_id.def_id),
237237
panic_span: None,
238238
};
239239
fpu.visit_expr(body.value);
240-
lint_for_missing_headers(cx, item.def_id, item.span, sig, headers, Some(body_id), fpu.panic_span);
240+
lint_for_missing_headers(cx, item.def_id.def_id, item.span, sig, headers, Some(body_id), fpu.panic_span);
241241
}
242242
},
243243
hir::ItemKind::Impl(impl_) => {
@@ -268,7 +268,7 @@ impl<'tcx> LateLintPass<'tcx> for DocMarkdown {
268268
let headers = check_attrs(cx, &self.valid_idents, attrs);
269269
if let hir::TraitItemKind::Fn(ref sig, ..) = item.kind {
270270
if !in_external_macro(cx.tcx.sess, item.span) {
271-
lint_for_missing_headers(cx, item.def_id, item.span, sig, headers, None, None);
271+
lint_for_missing_headers(cx, item.def_id.def_id, item.span, sig, headers, None, None);
272272
}
273273
}
274274
}
@@ -283,11 +283,11 @@ impl<'tcx> LateLintPass<'tcx> for DocMarkdown {
283283
let body = cx.tcx.hir().body(body_id);
284284
let mut fpu = FindPanicUnwrap {
285285
cx,
286-
typeck_results: cx.tcx.typeck(item.def_id),
286+
typeck_results: cx.tcx.typeck(item.def_id.def_id),
287287
panic_span: None,
288288
};
289289
fpu.visit_expr(body.value);
290-
lint_for_missing_headers(cx, item.def_id, item.span, sig, headers, Some(body_id), fpu.panic_span);
290+
lint_for_missing_headers(cx, item.def_id.def_id, item.span, sig, headers, Some(body_id), fpu.panic_span);
291291
}
292292
}
293293
}

clippy_lints/src/enum_variants.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ impl LateLintPass<'_> for EnumVariantNames {
297297
}
298298
}
299299
if let ItemKind::Enum(ref def, _) = item.kind {
300-
if !(self.avoid_breaking_exported_api && cx.access_levels.is_exported(item.def_id)) {
300+
if !(self.avoid_breaking_exported_api && cx.access_levels.is_exported(item.def_id.def_id)) {
301301
check_variant(cx, self.threshold, def, item_name, item.span);
302302
}
303303
}

clippy_lints/src/escape.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ impl<'tcx> LateLintPass<'tcx> for BoxedLocal {
7171
}
7272
}
7373

74-
let parent_id = cx.tcx.hir().get_parent_item(hir_id);
74+
let parent_id = cx.tcx.hir().get_parent_item(hir_id).def_id;
7575
let parent_node = cx.tcx.hir().find_by_def_id(parent_id);
7676

7777
let mut trait_self_ty = None;

clippy_lints/src/exhaustive_items.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ impl LateLintPass<'_> for ExhaustiveItems {
7373
fn check_item(&mut self, cx: &LateContext<'_>, item: &Item<'_>) {
7474
if_chain! {
7575
if let ItemKind::Enum(..) | ItemKind::Struct(..) = item.kind;
76-
if cx.access_levels.is_exported(item.def_id);
76+
if cx.access_levels.is_exported(item.def_id.def_id);
7777
let attrs = cx.tcx.hir().attrs(item.hir_id());
7878
if !attrs.iter().any(|a| a.has_name(sym::non_exhaustive));
7979
then {

clippy_lints/src/exit.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ impl<'tcx> LateLintPass<'tcx> for Exit {
3333
if let ExprKind::Path(ref path) = path_expr.kind;
3434
if let Some(def_id) = cx.qpath_res(path, path_expr.hir_id).opt_def_id();
3535
if match_def_path(cx, def_id, &paths::EXIT);
36-
let parent = cx.tcx.hir().get_parent_item(e.hir_id);
36+
let parent = cx.tcx.hir().get_parent_item(e.hir_id).def_id;
3737
if let Some(Node::Item(Item{kind: ItemKind::Fn(..), ..})) = cx.tcx.hir().find_by_def_id(parent);
3838
// If the next item up is a function we check if it is an entry point
3939
// and only then emit a linter warning

clippy_lints/src/fallible_impl_from.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ fn lint_impl_body<'tcx>(cx: &LateContext<'tcx>, impl_span: Span, impl_items: &[h
107107
let body = cx.tcx.hir().body(body_id);
108108
let mut fpu = FindPanicUnwrap {
109109
lcx: cx,
110-
typeck_results: cx.tcx.typeck(impl_item.id.def_id),
110+
typeck_results: cx.tcx.typeck(impl_item.id.def_id.def_id),
111111
result: Vec::new(),
112112
};
113113
fpu.visit_expr(body.value);

clippy_lints/src/functions/must_use.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ pub(super) fn check_item<'tcx>(cx: &LateContext<'tcx>, item: &'tcx hir::Item<'_>
2121
let attrs = cx.tcx.hir().attrs(item.hir_id());
2222
let attr = cx.tcx.get_attr(item.def_id.to_def_id(), sym::must_use);
2323
if let hir::ItemKind::Fn(ref sig, _generics, ref body_id) = item.kind {
24-
let is_public = cx.access_levels.is_exported(item.def_id);
24+
let is_public = cx.access_levels.is_exported(item.def_id.def_id);
2525
let fn_header_span = item.span.with_hi(sig.decl.output.span().hi());
2626
if let Some(attr) = attr {
2727
check_needless_must_use(cx, sig.decl, item.hir_id(), item.span, fn_header_span, attr);
@@ -31,7 +31,7 @@ pub(super) fn check_item<'tcx>(cx: &LateContext<'tcx>, item: &'tcx hir::Item<'_>
3131
sig.decl,
3232
cx.tcx.hir().body(*body_id),
3333
item.span,
34-
item.def_id,
34+
item.def_id.def_id,
3535
item.span.with_hi(sig.decl.output.span().hi()),
3636
"this function could have a `#[must_use]` attribute",
3737
);
@@ -41,19 +41,19 @@ pub(super) fn check_item<'tcx>(cx: &LateContext<'tcx>, item: &'tcx hir::Item<'_>
4141

4242
pub(super) fn check_impl_item<'tcx>(cx: &LateContext<'tcx>, item: &'tcx hir::ImplItem<'_>) {
4343
if let hir::ImplItemKind::Fn(ref sig, ref body_id) = item.kind {
44-
let is_public = cx.access_levels.is_exported(item.def_id);
44+
let is_public = cx.access_levels.is_exported(item.def_id.def_id);
4545
let fn_header_span = item.span.with_hi(sig.decl.output.span().hi());
4646
let attrs = cx.tcx.hir().attrs(item.hir_id());
4747
let attr = cx.tcx.get_attr(item.def_id.to_def_id(), sym::must_use);
4848
if let Some(attr) = attr {
4949
check_needless_must_use(cx, sig.decl, item.hir_id(), item.span, fn_header_span, attr);
50-
} else if is_public && !is_proc_macro(cx.sess(), attrs) && trait_ref_of_method(cx, item.def_id).is_none() {
50+
} else if is_public && !is_proc_macro(cx.sess(), attrs) && trait_ref_of_method(cx, item.def_id.def_id).is_none() {
5151
check_must_use_candidate(
5252
cx,
5353
sig.decl,
5454
cx.tcx.hir().body(*body_id),
5555
item.span,
56-
item.def_id,
56+
item.def_id.def_id,
5757
item.span.with_hi(sig.decl.output.span().hi()),
5858
"this method could have a `#[must_use]` attribute",
5959
);
@@ -63,7 +63,7 @@ pub(super) fn check_impl_item<'tcx>(cx: &LateContext<'tcx>, item: &'tcx hir::Imp
6363

6464
pub(super) fn check_trait_item<'tcx>(cx: &LateContext<'tcx>, item: &'tcx hir::TraitItem<'_>) {
6565
if let hir::TraitItemKind::Fn(ref sig, ref eid) = item.kind {
66-
let is_public = cx.access_levels.is_exported(item.def_id);
66+
let is_public = cx.access_levels.is_exported(item.def_id.def_id);
6767
let fn_header_span = item.span.with_hi(sig.decl.output.span().hi());
6868

6969
let attrs = cx.tcx.hir().attrs(item.hir_id());
@@ -78,7 +78,7 @@ pub(super) fn check_trait_item<'tcx>(cx: &LateContext<'tcx>, item: &'tcx hir::Tr
7878
sig.decl,
7979
body,
8080
item.span,
81-
item.def_id,
81+
item.def_id.def_id,
8282
item.span.with_hi(sig.decl.output.span().hi()),
8383
"this method could have a `#[must_use]` attribute",
8484
);
@@ -171,7 +171,7 @@ fn is_mutable_pat(cx: &LateContext<'_>, pat: &hir::Pat<'_>, tys: &mut DefIdSet)
171171
return false; // ignore `_` patterns
172172
}
173173
if cx.tcx.has_typeck_results(pat.hir_id.owner.to_def_id()) {
174-
is_mutable_ty(cx, cx.tcx.typeck(pat.hir_id.owner).pat_ty(pat), pat.span, tys)
174+
is_mutable_ty(cx, cx.tcx.typeck(pat.hir_id.owner.def_id).pat_ty(pat), pat.span, tys)
175175
} else {
176176
false
177177
}
@@ -218,7 +218,7 @@ impl<'a, 'tcx> intravisit::Visitor<'tcx> for StaticMutVisitor<'a, 'tcx> {
218218
if self.cx.tcx.has_typeck_results(arg.hir_id.owner.to_def_id())
219219
&& is_mutable_ty(
220220
self.cx,
221-
self.cx.tcx.typeck(arg.hir_id.owner).expr_ty(arg),
221+
self.cx.tcx.typeck(arg.hir_id.owner.def_id).expr_ty(arg),
222222
arg.span,
223223
&mut tys,
224224
)
@@ -236,7 +236,7 @@ impl<'a, 'tcx> intravisit::Visitor<'tcx> for StaticMutVisitor<'a, 'tcx> {
236236
if self.cx.tcx.has_typeck_results(arg.hir_id.owner.to_def_id())
237237
&& is_mutable_ty(
238238
self.cx,
239-
self.cx.tcx.typeck(arg.hir_id.owner).expr_ty(arg),
239+
self.cx.tcx.typeck(arg.hir_id.owner.def_id).expr_ty(arg),
240240
arg.span,
241241
&mut tys,
242242
)

clippy_lints/src/functions/not_unsafe_ptr_arg_deref.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ pub(super) fn check_fn<'tcx>(
2828
pub(super) fn check_trait_item<'tcx>(cx: &LateContext<'tcx>, item: &'tcx hir::TraitItem<'_>) {
2929
if let hir::TraitItemKind::Fn(ref sig, hir::TraitFn::Provided(eid)) = item.kind {
3030
let body = cx.tcx.hir().body(eid);
31-
check_raw_ptr(cx, sig.header.unsafety, sig.decl, body, item.def_id);
31+
check_raw_ptr(cx, sig.header.unsafety, sig.decl, body, item.def_id.def_id);
3232
}
3333
}
3434

clippy_lints/src/functions/result.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ fn result_err_ty<'tcx>(
3434

3535
pub(super) fn check_item<'tcx>(cx: &LateContext<'tcx>, item: &hir::Item<'tcx>, large_err_threshold: u64) {
3636
if let hir::ItemKind::Fn(ref sig, _generics, _) = item.kind
37-
&& let Some((hir_ty, err_ty)) = result_err_ty(cx, sig.decl, item.def_id, item.span)
37+
&& let Some((hir_ty, err_ty)) = result_err_ty(cx, sig.decl, item.def_id.def_id, item.span)
3838
{
39-
if cx.access_levels.is_exported(item.def_id) {
39+
if cx.access_levels.is_exported(item.def_id.def_id) {
4040
let fn_header_span = item.span.with_hi(sig.decl.output.span().hi());
4141
check_result_unit_err(cx, err_ty, fn_header_span);
4242
}
@@ -47,10 +47,10 @@ pub(super) fn check_item<'tcx>(cx: &LateContext<'tcx>, item: &hir::Item<'tcx>, l
4747
pub(super) fn check_impl_item<'tcx>(cx: &LateContext<'tcx>, item: &hir::ImplItem<'tcx>, large_err_threshold: u64) {
4848
// Don't lint if method is a trait's implementation, we can't do anything about those
4949
if let hir::ImplItemKind::Fn(ref sig, _) = item.kind
50-
&& let Some((hir_ty, err_ty)) = result_err_ty(cx, sig.decl, item.def_id, item.span)
51-
&& trait_ref_of_method(cx, item.def_id).is_none()
50+
&& let Some((hir_ty, err_ty)) = result_err_ty(cx, sig.decl, item.def_id.def_id, item.span)
51+
&& trait_ref_of_method(cx, item.def_id.def_id).is_none()
5252
{
53-
if cx.access_levels.is_exported(item.def_id) {
53+
if cx.access_levels.is_exported(item.def_id.def_id) {
5454
let fn_header_span = item.span.with_hi(sig.decl.output.span().hi());
5555
check_result_unit_err(cx, err_ty, fn_header_span);
5656
}
@@ -61,8 +61,8 @@ pub(super) fn check_impl_item<'tcx>(cx: &LateContext<'tcx>, item: &hir::ImplItem
6161
pub(super) fn check_trait_item<'tcx>(cx: &LateContext<'tcx>, item: &hir::TraitItem<'tcx>, large_err_threshold: u64) {
6262
if let hir::TraitItemKind::Fn(ref sig, _) = item.kind {
6363
let fn_header_span = item.span.with_hi(sig.decl.output.span().hi());
64-
if let Some((hir_ty, err_ty)) = result_err_ty(cx, sig.decl, item.def_id, item.span) {
65-
if cx.access_levels.is_exported(item.def_id) {
64+
if let Some((hir_ty, err_ty)) = result_err_ty(cx, sig.decl, item.def_id.def_id, item.span) {
65+
if cx.access_levels.is_exported(item.def_id.def_id) {
6666
check_result_unit_err(cx, err_ty, fn_header_span);
6767
}
6868
check_result_large_err(cx, err_ty, hir_ty.span, large_err_threshold);

clippy_lints/src/implicit_hasher.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ impl<'tcx> LateLintPass<'tcx> for ImplicitHasher {
112112
}
113113
}
114114

115-
if !cx.access_levels.is_exported(item.def_id) {
115+
if !cx.access_levels.is_exported(item.def_id.def_id) {
116116
return;
117117
}
118118

clippy_lints/src/inherent_to_string.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ impl<'tcx> LateLintPass<'tcx> for InherentToString {
108108
if is_type_diagnostic_item(cx, return_ty(cx, impl_item.hir_id()), sym::String);
109109

110110
// Filters instances of to_string which are required by a trait
111-
if trait_ref_of_method(cx, impl_item.def_id).is_none();
111+
if trait_ref_of_method(cx, impl_item.def_id.def_id).is_none();
112112

113113
then {
114114
show_lint(cx, impl_item);

clippy_lints/src/iter_not_returning_iterator.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ impl<'tcx> LateLintPass<'tcx> for IterNotReturningIterator {
4444
let name = item.ident.name.as_str();
4545
if matches!(name, "iter" | "iter_mut") {
4646
if let TraitItemKind::Fn(fn_sig, _) = &item.kind {
47-
check_sig(cx, name, fn_sig, item.def_id);
47+
check_sig(cx, name, fn_sig, item.def_id.def_id);
4848
}
4949
}
5050
}
@@ -58,7 +58,7 @@ impl<'tcx> LateLintPass<'tcx> for IterNotReturningIterator {
5858
)
5959
{
6060
if let ImplItemKind::Fn(fn_sig, _) = &item.kind {
61-
check_sig(cx, name, fn_sig, item.def_id);
61+
check_sig(cx, name, fn_sig, item.def_id.def_id);
6262
}
6363
}
6464
}

clippy_lints/src/len_zero.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ impl<'tcx> LateLintPass<'tcx> for LenZero {
134134
if item.ident.name == sym::len;
135135
if let ImplItemKind::Fn(sig, _) = &item.kind;
136136
if sig.decl.implicit_self.has_implicit_self();
137-
if cx.access_levels.is_exported(item.def_id);
137+
if cx.access_levels.is_exported(item.def_id.def_id);
138138
if matches!(sig.decl.output, FnRetTy::Return(_));
139139
if let Some(imp) = get_parent_as_impl(cx.tcx, item.hir_id());
140140
if imp.of_trait.is_none();
@@ -210,7 +210,7 @@ fn check_trait_items(cx: &LateContext<'_>, visited_trait: &Item<'_>, trait_items
210210
}
211211
}
212212

213-
if cx.access_levels.is_exported(visited_trait.def_id) && trait_items.iter().any(|i| is_named_self(cx, i, sym::len))
213+
if cx.access_levels.is_exported(visited_trait.def_id.def_id) && trait_items.iter().any(|i| is_named_self(cx, i, sym::len))
214214
{
215215
let mut current_and_super_traits = DefIdSet::default();
216216
fill_trait_set(visited_trait.def_id.to_def_id(), &mut current_and_super_traits, cx);

clippy_lints/src/lifetimes.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ impl<'tcx> LateLintPass<'tcx> for Lifetimes {
102102

103103
fn check_impl_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx ImplItem<'_>) {
104104
if let ImplItemKind::Fn(ref sig, id) = item.kind {
105-
let report_extra_lifetimes = trait_ref_of_method(cx, item.def_id).is_none();
105+
let report_extra_lifetimes = trait_ref_of_method(cx, item.def_id.def_id).is_none();
106106
check_fn_inner(
107107
cx,
108108
sig.decl,
@@ -276,7 +276,7 @@ fn could_use_elision<'tcx>(
276276
let mut checker = BodyLifetimeChecker {
277277
lifetimes_used_in_body: false,
278278
};
279-
checker.visit_expr(body.value);
279+
checker.visit_expr(&body.value);
280280
if checker.lifetimes_used_in_body {
281281
return false;
282282
}

clippy_lints/src/loops/mut_range_bound.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ fn check_for_mutation<'tcx>(
6969
ExprUseVisitor::new(
7070
&mut delegate,
7171
&infcx,
72-
body.hir_id.owner,
72+
body.hir_id.owner.def_id,
7373
cx.param_env,
7474
cx.typeck_results(),
7575
)

clippy_lints/src/manual_non_exhaustive.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ impl<'tcx> LateLintPass<'tcx> for ManualNonExhaustiveEnum {
166166
if let Some((id, span)) = iter.next()
167167
&& iter.next().is_none()
168168
{
169-
self.potential_enums.push((item.def_id, id, item.span, span));
169+
self.potential_enums.push((item.def_id.def_id, id, item.span, span));
170170
}
171171
}
172172
}

clippy_lints/src/methods/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3250,7 +3250,7 @@ impl<'tcx> LateLintPass<'tcx> for Methods {
32503250
return;
32513251
}
32523252
let name = impl_item.ident.name.as_str();
3253-
let parent = cx.tcx.hir().get_parent_item(impl_item.hir_id());
3253+
let parent = cx.tcx.hir().get_parent_item(impl_item.hir_id()).def_id;
32543254
let item = cx.tcx.hir().expect_item(parent);
32553255
let self_ty = cx.tcx.type_of(item.def_id);
32563256

@@ -3259,7 +3259,7 @@ impl<'tcx> LateLintPass<'tcx> for Methods {
32593259
if let hir::ImplItemKind::Fn(ref sig, id) = impl_item.kind;
32603260
if let Some(first_arg) = iter_input_pats(sig.decl, cx.tcx.hir().body(id)).next();
32613261

3262-
let method_sig = cx.tcx.fn_sig(impl_item.def_id);
3262+
let method_sig = cx.tcx.fn_sig(impl_item.def_id.def_id);
32633263
let method_sig = cx.tcx.erase_late_bound_regions(method_sig);
32643264

32653265
let first_arg_ty = method_sig.inputs().iter().next();
@@ -3269,7 +3269,7 @@ impl<'tcx> LateLintPass<'tcx> for Methods {
32693269

32703270
then {
32713271
// if this impl block implements a trait, lint in trait definition instead
3272-
if !implements_trait && cx.access_levels.is_exported(impl_item.def_id) {
3272+
if !implements_trait && cx.access_levels.is_exported(impl_item.def_id.def_id) {
32733273
// check missing trait implementations
32743274
for method_config in &TRAIT_METHODS {
32753275
if name == method_config.method_name &&
@@ -3301,7 +3301,7 @@ impl<'tcx> LateLintPass<'tcx> for Methods {
33013301

33023302
if sig.decl.implicit_self.has_implicit_self()
33033303
&& !(self.avoid_breaking_exported_api
3304-
&& cx.access_levels.is_exported(impl_item.def_id))
3304+
&& cx.access_levels.is_exported(impl_item.def_id.def_id))
33053305
{
33063306
wrong_self_convention::check(
33073307
cx,

clippy_lints/src/missing_const_for_fn.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ impl<'tcx> LateLintPass<'tcx> for MissingConstForFn {
136136

137137
// Const fns are not allowed as methods in a trait.
138138
{
139-
let parent = cx.tcx.hir().get_parent_item(hir_id);
139+
let parent = cx.tcx.hir().get_parent_item(hir_id).def_id;
140140
if parent != CRATE_DEF_ID {
141141
if let hir::Node::Item(item) = cx.tcx.hir().get_by_def_id(parent) {
142142
if let hir::ItemKind::Trait(..) = &item.kind {

clippy_lints/src/missing_doc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ impl<'tcx> LateLintPass<'tcx> for MissingDoc {
131131
hir::ItemKind::Fn(..) => {
132132
// ignore main()
133133
if it.ident.name == sym::main {
134-
let at_root = cx.tcx.local_parent(it.def_id) == CRATE_DEF_ID;
134+
let at_root = cx.tcx.local_parent(it.def_id.def_id) == CRATE_DEF_ID;
135135
if at_root {
136136
return;
137137
}

0 commit comments

Comments
 (0)