1
Fork 0

Move methods from Map to TyCtxt, part 3.

Continuing the work from #137162.

Every method gains a `hir_` prefix.
This commit is contained in:
Nicholas Nethercote 2025-02-21 07:54:35 +11:00
parent 43c2b0086a
commit 806be25fc9
105 changed files with 243 additions and 273 deletions

View file

@ -751,7 +751,7 @@ impl UnsafeOpKind {
span: Span,
suggest_unsafe_block: bool,
) {
let parent_id = tcx.hir().get_parent_item(hir_id);
let parent_id = tcx.hir_get_parent_item(hir_id);
let parent_owner = tcx.hir_owner_node(parent_id);
let should_suggest = parent_owner.fn_sig().is_some_and(|sig| {
// Do not suggest for safe target_feature functions
@ -921,7 +921,7 @@ impl UnsafeOpKind {
hir_context: HirId,
unsafe_op_in_unsafe_fn_allowed: bool,
) {
let note_non_inherited = tcx.hir().parent_iter(hir_context).find(|(id, node)| {
let note_non_inherited = tcx.hir_parent_iter(hir_context).find(|(id, node)| {
if let hir::Node::Expr(block) = node
&& let hir::ExprKind::Block(block, _) = block.kind
&& let hir::BlockCheckMode::UnsafeBlock(_) = block.rules

View file

@ -1041,7 +1041,7 @@ fn find_fallback_pattern_typo<'tcx>(
let mut imported = vec![];
let mut imported_spans = vec![];
let (infcx, param_env) = cx.tcx.infer_ctxt().build_with_typing_env(cx.typing_env);
let parent = cx.tcx.hir().get_parent_item(hir_id);
let parent = cx.tcx.hir_get_parent_item(hir_id);
for item in cx.tcx.hir_crate_items(()).free_items() {
if let DefKind::Use = cx.tcx.def_kind(item.owner_id) {
@ -1137,7 +1137,7 @@ fn find_fallback_pattern_typo<'tcx>(
} else {
// Look for local bindings for people that might have gotten confused with how
// `let` and `const` works.
for (_, node) in cx.tcx.hir().parent_iter(hir_id) {
for (_, node) in cx.tcx.hir_parent_iter(hir_id) {
match node {
hir::Node::Stmt(hir::Stmt { kind: hir::StmtKind::Let(let_stmt), .. }) => {
if let hir::PatKind::Binding(_, _, binding_name, _) = let_stmt.pat.kind {