Move methods from Map to TyCtxt, part 3.
Continuing the work from #137162. Every method gains a `hir_` prefix.
This commit is contained in:
parent
43c2b0086a
commit
806be25fc9
105 changed files with 243 additions and 273 deletions
|
@ -466,7 +466,7 @@ impl<'tcx> LateLintPass<'tcx> for MissingDoc {
|
|||
MethodLateContext::TraitAutoImpl => {}
|
||||
// If the method is an impl for an item with docs_hidden, don't doc.
|
||||
MethodLateContext::PlainImpl => {
|
||||
let parent = cx.tcx.hir().get_parent_item(impl_item.hir_id());
|
||||
let parent = cx.tcx.hir_get_parent_item(impl_item.hir_id());
|
||||
let impl_ty = cx.tcx.type_of(parent).instantiate_identity();
|
||||
let outerdef = match impl_ty.kind() {
|
||||
ty::Adt(def, _) => Some(def.did()),
|
||||
|
|
|
@ -147,7 +147,7 @@ impl<'tcx> LateLintPass<'tcx> for DropForgetUseless {
|
|||
let is_copy = cx.type_is_copy_modulo_regions(arg_ty);
|
||||
let drop_is_single_call_in_arm = is_single_call_in_arm(cx, arg, expr);
|
||||
let let_underscore_ignore_sugg = || {
|
||||
if let Some((_, node)) = cx.tcx.hir().parent_iter(expr.hir_id).nth(0)
|
||||
if let Some((_, node)) = cx.tcx.hir_parent_iter(expr.hir_id).nth(0)
|
||||
&& let Node::Stmt(stmt) = node
|
||||
&& let StmtKind::Semi(e) = stmt.kind
|
||||
&& e.hir_id == expr.hir_id
|
||||
|
|
|
@ -95,7 +95,7 @@ pub(crate) struct IfLetRescope {
|
|||
}
|
||||
|
||||
fn expr_parent_is_else(tcx: TyCtxt<'_>, hir_id: hir::HirId) -> bool {
|
||||
let Some((_, hir::Node::Expr(expr))) = tcx.hir().parent_iter(hir_id).next() else {
|
||||
let Some((_, hir::Node::Expr(expr))) = tcx.hir_parent_iter(hir_id).next() else {
|
||||
return false;
|
||||
};
|
||||
let hir::ExprKind::If(_cond, _conseq, Some(alt)) = expr.kind else { return false };
|
||||
|
@ -103,7 +103,7 @@ fn expr_parent_is_else(tcx: TyCtxt<'_>, hir_id: hir::HirId) -> bool {
|
|||
}
|
||||
|
||||
fn expr_parent_is_stmt(tcx: TyCtxt<'_>, hir_id: hir::HirId) -> bool {
|
||||
let mut parents = tcx.hir().parent_iter(hir_id);
|
||||
let mut parents = tcx.hir_parent_iter(hir_id);
|
||||
let stmt = match parents.next() {
|
||||
Some((_, hir::Node::Stmt(stmt))) => stmt,
|
||||
Some((_, hir::Node::Block(_) | hir::Node::Arm(_))) => return true,
|
||||
|
|
|
@ -497,7 +497,7 @@ impl Diagnostics {
|
|||
return;
|
||||
};
|
||||
|
||||
for (hir_id, _parent) in cx.tcx.hir().parent_iter(current_id) {
|
||||
for (hir_id, _parent) in cx.tcx.hir_parent_iter(current_id) {
|
||||
if let Some(owner_did) = hir_id.as_owner()
|
||||
&& cx.tcx.has_attr(owner_did, sym::rustc_lint_diagnostics)
|
||||
{
|
||||
|
@ -512,7 +512,7 @@ impl Diagnostics {
|
|||
//
|
||||
// Otherwise, emit a `DIAGNOSTIC_OUTSIDE_OF_IMPL` lint.
|
||||
let mut is_inside_appropriate_impl = false;
|
||||
for (_hir_id, parent) in cx.tcx.hir().parent_iter(current_id) {
|
||||
for (_hir_id, parent) in cx.tcx.hir_parent_iter(current_id) {
|
||||
debug!(?parent);
|
||||
if let Node::Item(Item { kind: ItemKind::Impl(impl_), .. }) = parent
|
||||
&& let Impl { of_trait: Some(of_trait), .. } = impl_
|
||||
|
|
|
@ -128,7 +128,7 @@ impl<'tcx> LateLintPass<'tcx> for ShadowedIntoIter {
|
|||
// we should just suggest removing the `.into_iter()` or changing it to `.iter()`
|
||||
// to disambiguate if we want to iterate by-value or by-ref.
|
||||
let sub = if let Some((_, hir::Node::Expr(parent_expr))) =
|
||||
cx.tcx.hir().parent_iter(expr.hir_id).nth(1)
|
||||
cx.tcx.hir_parent_iter(expr.hir_id).nth(1)
|
||||
&& let hir::ExprKind::Match(arg, [_], hir::MatchSource::ForLoopDesugar) =
|
||||
&parent_expr.kind
|
||||
&& let hir::ExprKind::Call(path, [_]) = &arg.kind
|
||||
|
|
|
@ -68,7 +68,7 @@ impl<'tcx> LateLintPass<'tcx> for UnqualifiedLocalImports {
|
|||
return;
|
||||
}
|
||||
|
||||
let encl_item_id = cx.tcx.hir().get_parent_item(item.hir_id());
|
||||
let encl_item_id = cx.tcx.hir_get_parent_item(item.hir_id());
|
||||
let encl_item = cx.tcx.hir_node_by_def_id(encl_item_id.def_id);
|
||||
if encl_item.fn_kind().is_some() {
|
||||
// `use` in a method -- don't lint, that leads to too many undesirable lints
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue