Skip to content

Commit 5b68fc1

Browse files
committed
Use ItemId as a strongly typed index.
1 parent ce0a47a commit 5b68fc1

File tree

5 files changed

+5
-5
lines changed

5 files changed

+5
-5
lines changed

clippy_lints/src/lifetimes.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ impl<'a, 'tcx> Visitor<'tcx> for RefVisitor<'a, 'tcx> {
375375
match ty.kind {
376376
TyKind::OpaqueDef(item, _) => {
377377
let map = self.cx.tcx.hir();
378-
let item = map.expect_item(item.id);
378+
let item = map.item(item);
379379
walk_item(self, item);
380380
walk_ty(self, ty);
381381
},

clippy_lints/src/manual_async_fn.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ fn future_trait_ref<'tcx>(
102102
) -> Option<(&'tcx TraitRef<'tcx>, Vec<LifetimeName>)> {
103103
if_chain! {
104104
if let TyKind::OpaqueDef(item_id, bounds) = ty.kind;
105-
let item = cx.tcx.hir().item(item_id.id);
105+
let item = cx.tcx.hir().item(item_id);
106106
if let ItemKind::OpaqueTy(opaque) = &item.kind;
107107
if let Some(trait_ref) = opaque.bounds.iter().find_map(|bound| {
108108
if let GenericBound::Trait(poly, _) = bound {

clippy_lints/src/missing_inline.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ impl<'tcx> LateLintPass<'tcx> for MissingInline {
107107
// trait method with default body needs inline in case
108108
// an impl is not provided
109109
let desc = "a default trait method";
110-
let item = cx.tcx.hir().expect_trait_item(tit.id.hir_id);
110+
let item = cx.tcx.hir().trait_item(tit.id);
111111
check_missing_inline_attrs(cx, &item.attrs, item.span, desc);
112112
}
113113
},

clippy_lints/src/utils/author.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ impl<'tcx> LateLintPass<'tcx> for Author {
130130
}
131131

132132
fn check_stmt(&mut self, cx: &LateContext<'tcx>, stmt: &'tcx hir::Stmt<'_>) {
133-
if !has_attr(cx.sess(), stmt.kind.attrs(|id| cx.tcx.hir().item(id.id))) {
133+
if !has_attr(cx.sess(), stmt.kind.attrs(|id| cx.tcx.hir().item(id))) {
134134
return;
135135
}
136136
prelude();

clippy_lints/src/utils/inspector.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ impl<'tcx> LateLintPass<'tcx> for DeepCodeInspector {
109109
}
110110

111111
fn check_stmt(&mut self, cx: &LateContext<'tcx>, stmt: &'tcx hir::Stmt<'_>) {
112-
if !has_attr(cx.sess(), stmt.kind.attrs(|id| cx.tcx.hir().item(id.id))) {
112+
if !has_attr(cx.sess(), stmt.kind.attrs(|id| cx.tcx.hir().item(id))) {
113113
return;
114114
}
115115
match stmt.kind {

0 commit comments

Comments
 (0)