let fn_def_id = cx.tcx.hir().local_def_id(hir_id);
cx.tcx.infer_ctxt().enter(|infcx| {
- ExprUseVisitor::new(&mut v, &infcx, fn_def_id.to_def_id(), cx.param_env, cx.tables).consume_body(body);
+ ExprUseVisitor::new(&mut v, &infcx, fn_def_id, cx.param_env, cx.tables).consume_body(body);
});
for node in v.set {
}
let def_id = pat.hir_id.owner.to_def_id();
if cx.tcx.has_typeck_tables(def_id) {
- is_mutable_ty(cx, &cx.tcx.typeck_tables_of(def_id).pat_ty(pat), pat.span, tys)
+ is_mutable_ty(
+ cx,
+ &cx.tcx.typeck_tables_of(def_id.expect_local()).pat_ty(pat),
+ pat.span,
+ tys,
+ )
} else {
false
}
if self.cx.tcx.has_typeck_tables(def_id)
&& is_mutable_ty(
self.cx,
- self.cx.tcx.typeck_tables_of(def_id).expr_ty(arg),
+ self.cx.tcx.typeck_tables_of(def_id.expect_local()).expr_ty(arg),
arg.span,
&mut tys,
)
};
let def_id = body.hir_id.owner.to_def_id();
cx.tcx.infer_ctxt().enter(|infcx| {
- ExprUseVisitor::new(&mut delegate, &infcx, def_id, cx.param_env, cx.tables).walk_expr(body);
+ ExprUseVisitor::new(&mut delegate, &infcx, def_id.expect_local(), cx.param_env, cx.tables).walk_expr(body);
});
delegate.mutation_span()
}
} = {
let mut ctx = MovedVariablesCtxt::default();
cx.tcx.infer_ctxt().enter(|infcx| {
- euv::ExprUseVisitor::new(&mut ctx, &infcx, fn_def_id.to_def_id(), cx.param_env, cx.tables)
- .consume_body(body);
+ euv::ExprUseVisitor::new(&mut ctx, &infcx, fn_def_id, cx.param_env, cx.tables).consume_body(body);
});
ctx
};
hir::QPath::Resolved(_, path) => path.res,
hir::QPath::TypeRelative(..) => {
if cx.tcx.has_typeck_tables(id.owner.to_def_id()) {
- cx.tcx.typeck_tables_of(id.owner.to_def_id()).qpath_res(qpath, id)
+ cx.tcx
+ .typeck_tables_of(id.owner.to_def_id().expect_local())
+ .qpath_res(qpath, id)
} else {
Res::Err
}
pub fn is_entrypoint_fn(cx: &LateContext<'_, '_>, def_id: DefId) -> bool {
cx.tcx
.entry_fn(LOCAL_CRATE)
- .map_or(false, |(entry_fn_def_id, _)| def_id == entry_fn_def_id)
+ .map_or(false, |(entry_fn_def_id, _)| def_id == entry_fn_def_id.to_def_id())
}
/// Gets the name of the item the expression is in, if available.
};
let def_id = expr.hir_id.owner.to_def_id();
cx.tcx.infer_ctxt().enter(|infcx| {
- ExprUseVisitor::new(&mut delegate, &infcx, def_id, cx.param_env, cx.tables).walk_expr(expr);
+ ExprUseVisitor::new(&mut delegate, &infcx, def_id.expect_local(), cx.param_env, cx.tables).walk_expr(expr);
});
if delegate.skip {
if let ItemKind::Use(use_path, UseKind::Glob) = &item.kind;
// don't lint prelude glob imports
if !use_path.segments.iter().last().map_or(false, |ps| ps.ident.as_str() == "prelude");
- let used_imports = cx.tcx.names_imported_by_glob_use(item.hir_id.owner.to_def_id());
+ let used_imports = cx.tcx.names_imported_by_glob_use(item.hir_id.owner);
if !used_imports.is_empty(); // Already handled by `unused_imports`
then {
let mut applicability = Applicability::MachineApplicable;