Skip to content

Commit 36960a5

Browse files
committed
Remove an unnecessary HirId to DefId convertion
1 parent 63edd2c commit 36960a5

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/librustc_typeck/astconv.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2001,16 +2001,15 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
20012001
let PathSeg(def_id, index) = path_segs.last().unwrap();
20022002
self.ast_path_to_ty(span, *def_id, &path.segments[*index])
20032003
}
2004-
Res::Def(DefKind::TyParam, did) => {
2004+
Res::Def(DefKind::TyParam, def_id) => {
20052005
assert_eq!(opt_self_ty, None);
20062006
self.prohibit_generics(&path.segments);
20072007

2008-
let hir_id = tcx.hir().as_local_hir_id(did).unwrap();
2008+
let hir_id = tcx.hir().as_local_hir_id(def_id).unwrap();
20092009
let item_id = tcx.hir().get_parent_node_by_hir_id(hir_id);
20102010
let item_def_id = tcx.hir().local_def_id_from_hir_id(item_id);
20112011
let generics = tcx.generics_of(item_def_id);
2012-
let index = generics.param_def_id_to_index[
2013-
&tcx.hir().local_def_id_from_hir_id(hir_id)];
2012+
let index = generics.param_def_id_to_index[&def_id];
20142013
tcx.mk_ty_param(index, tcx.hir().name_by_hir_id(hir_id).as_interned_str())
20152014
}
20162015
Res::SelfTy(Some(_), None) => {

0 commit comments

Comments
 (0)