Skip to content

Commit 6f62887

Browse files
Use local key in providers
1 parent 60fe49c commit 6f62887

File tree

5 files changed

+7
-7
lines changed

5 files changed

+7
-7
lines changed

clippy_lints/src/cognitive_complexity.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ impl<'tcx> LateLintPass<'tcx> for CognitiveComplexity {
143143
span: Span,
144144
def_id: LocalDefId,
145145
) {
146-
if !cx.tcx.has_attr(def_id.to_def_id(), sym::test) {
146+
if !cx.tcx.has_attr(def_id, sym::test) {
147147
let expr = if is_async_fn(kind) {
148148
match get_async_fn_body(cx.tcx, body) {
149149
Some(b) => b,

clippy_lints/src/derivable_impls.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ impl<'tcx> LateLintPass<'tcx> for DerivableImpls {
181181
self_ty,
182182
..
183183
}) = item.kind;
184-
if !cx.tcx.has_attr(item.owner_id.to_def_id(), sym::automatically_derived);
184+
if !cx.tcx.has_attr(item.owner_id, sym::automatically_derived);
185185
if !item.span.from_expansion();
186186
if let Some(def_id) = trait_ref.trait_def_id();
187187
if cx.tcx.is_diagnostic_item(sym::Default, def_id);

clippy_lints/src/derive.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ impl<'tcx> LateLintPass<'tcx> for Derive {
212212
}) = item.kind
213213
{
214214
let ty = cx.tcx.type_of(item.owner_id).subst_identity();
215-
let is_automatically_derived = cx.tcx.has_attr(item.owner_id.to_def_id(), sym::automatically_derived);
215+
let is_automatically_derived = cx.tcx.has_attr(item.owner_id, sym::automatically_derived);
216216

217217
check_hash_peq(cx, item.span, trait_ref, ty, is_automatically_derived);
218218
check_ord_partial_ord(cx, item.span, trait_ref, ty, is_automatically_derived);

clippy_lints/src/functions/must_use.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ use super::{DOUBLE_MUST_USE, MUST_USE_CANDIDATE, MUST_USE_UNIT};
2222

2323
pub(super) fn check_item<'tcx>(cx: &LateContext<'tcx>, item: &'tcx hir::Item<'_>) {
2424
let attrs = cx.tcx.hir().attrs(item.hir_id());
25-
let attr = cx.tcx.get_attr(item.owner_id.to_def_id(), sym::must_use);
25+
let attr = cx.tcx.get_attr(item.owner_id, sym::must_use);
2626
if let hir::ItemKind::Fn(ref sig, _generics, ref body_id) = item.kind {
2727
let is_public = cx.effective_visibilities.is_exported(item.owner_id.def_id);
2828
let fn_header_span = item.span.with_hi(sig.decl.output.span().hi());
@@ -47,7 +47,7 @@ pub(super) fn check_impl_item<'tcx>(cx: &LateContext<'tcx>, item: &'tcx hir::Imp
4747
let is_public = cx.effective_visibilities.is_exported(item.owner_id.def_id);
4848
let fn_header_span = item.span.with_hi(sig.decl.output.span().hi());
4949
let attrs = cx.tcx.hir().attrs(item.hir_id());
50-
let attr = cx.tcx.get_attr(item.owner_id.to_def_id(), sym::must_use);
50+
let attr = cx.tcx.get_attr(item.owner_id, sym::must_use);
5151
if let Some(attr) = attr {
5252
check_needless_must_use(cx, sig.decl, item.owner_id, item.span, fn_header_span, attr);
5353
} else if is_public
@@ -73,7 +73,7 @@ pub(super) fn check_trait_item<'tcx>(cx: &LateContext<'tcx>, item: &'tcx hir::Tr
7373
let fn_header_span = item.span.with_hi(sig.decl.output.span().hi());
7474

7575
let attrs = cx.tcx.hir().attrs(item.hir_id());
76-
let attr = cx.tcx.get_attr(item.owner_id.to_def_id(), sym::must_use);
76+
let attr = cx.tcx.get_attr(item.owner_id, sym::must_use);
7777
if let Some(attr) = attr {
7878
check_needless_must_use(cx, sig.decl, item.owner_id, item.span, fn_header_span, attr);
7979
} else if let hir::TraitFn::Provided(eid) = *eid {

clippy_lints/src/partialeq_ne_impl.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ impl<'tcx> LateLintPass<'tcx> for PartialEqNeImpl {
3636
fn check_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx Item<'_>) {
3737
if_chain! {
3838
if let ItemKind::Impl(Impl { of_trait: Some(ref trait_ref), items: impl_items, .. }) = item.kind;
39-
if !cx.tcx.has_attr(item.owner_id.to_def_id(), sym::automatically_derived);
39+
if !cx.tcx.has_attr(item.owner_id, sym::automatically_derived);
4040
if let Some(eq_trait) = cx.tcx.lang_items().eq_trait();
4141
if trait_ref.path.res.def_id() == eq_trait;
4242
then {

0 commit comments

Comments
 (0)