mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-23 21:23:56 +00:00
Use ItemId as a strongly typed index.
This commit is contained in:
parent
ce0a47ab8c
commit
5b68fc16ed
5 changed files with 5 additions and 5 deletions
|
@ -375,7 +375,7 @@ impl<'a, 'tcx> Visitor<'tcx> for RefVisitor<'a, 'tcx> {
|
|||
match ty.kind {
|
||||
TyKind::OpaqueDef(item, _) => {
|
||||
let map = self.cx.tcx.hir();
|
||||
let item = map.expect_item(item.id);
|
||||
let item = map.item(item);
|
||||
walk_item(self, item);
|
||||
walk_ty(self, ty);
|
||||
},
|
||||
|
|
|
@ -102,7 +102,7 @@ fn future_trait_ref<'tcx>(
|
|||
) -> Option<(&'tcx TraitRef<'tcx>, Vec<LifetimeName>)> {
|
||||
if_chain! {
|
||||
if let TyKind::OpaqueDef(item_id, bounds) = ty.kind;
|
||||
let item = cx.tcx.hir().item(item_id.id);
|
||||
let item = cx.tcx.hir().item(item_id);
|
||||
if let ItemKind::OpaqueTy(opaque) = &item.kind;
|
||||
if let Some(trait_ref) = opaque.bounds.iter().find_map(|bound| {
|
||||
if let GenericBound::Trait(poly, _) = bound {
|
||||
|
|
|
@ -107,7 +107,7 @@ impl<'tcx> LateLintPass<'tcx> for MissingInline {
|
|||
// trait method with default body needs inline in case
|
||||
// an impl is not provided
|
||||
let desc = "a default trait method";
|
||||
let item = cx.tcx.hir().expect_trait_item(tit.id.hir_id);
|
||||
let item = cx.tcx.hir().trait_item(tit.id);
|
||||
check_missing_inline_attrs(cx, &item.attrs, item.span, desc);
|
||||
}
|
||||
},
|
||||
|
|
|
@ -130,7 +130,7 @@ impl<'tcx> LateLintPass<'tcx> for Author {
|
|||
}
|
||||
|
||||
fn check_stmt(&mut self, cx: &LateContext<'tcx>, stmt: &'tcx hir::Stmt<'_>) {
|
||||
if !has_attr(cx.sess(), stmt.kind.attrs(|id| cx.tcx.hir().item(id.id))) {
|
||||
if !has_attr(cx.sess(), stmt.kind.attrs(|id| cx.tcx.hir().item(id))) {
|
||||
return;
|
||||
}
|
||||
prelude();
|
||||
|
|
|
@ -109,7 +109,7 @@ impl<'tcx> LateLintPass<'tcx> for DeepCodeInspector {
|
|||
}
|
||||
|
||||
fn check_stmt(&mut self, cx: &LateContext<'tcx>, stmt: &'tcx hir::Stmt<'_>) {
|
||||
if !has_attr(cx.sess(), stmt.kind.attrs(|id| cx.tcx.hir().item(id.id))) {
|
||||
if !has_attr(cx.sess(), stmt.kind.attrs(|id| cx.tcx.hir().item(id))) {
|
||||
return;
|
||||
}
|
||||
match stmt.kind {
|
||||
|
|
Loading…
Reference in a new issue