Skip to content

Commit b51b172

Browse files
committed
Auto merge of rust-lang#89158 - the8472:rollup-3e4ijth, r=the8472
Rollup of 12 pull requests Successful merges: - rust-lang#88795 (Print a note if a character literal contains a variation selector) - rust-lang#89015 (core::ascii::escape_default: reduce struct size) - rust-lang#89078 (Cleanup: Remove needless reference in ParentHirIterator) - rust-lang#89086 (Stabilize `Iterator::map_while`) - rust-lang#89096 ([bootstrap] Improve the error message when `ninja` is not found to link to installation instructions) - rust-lang#89113 (dont `.ensure()` the `thir_abstract_const` query call in `mir_build`) - rust-lang#89114 (Fixes a technicality regarding the size of C's `char` type) - rust-lang#89115 (:arrow_up: rust-analyzer) - rust-lang#89126 (Fix ICE when `indirect_structural_match` is allowed) - rust-lang#89141 (Impl `Error` for `FromSecsError` without foreign type) - rust-lang#89142 (Fix match for placeholder region) - rust-lang#89147 (add case for checking const refs in check_const_value_eq) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents a3b67fe + ac9e80e commit b51b172

File tree

2 files changed

+6
-12
lines changed

2 files changed

+6
-12
lines changed

clippy_utils/src/higher.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,7 @@ impl<'hir> IfLet<'hir> {
105105
if_else,
106106
) = expr.kind
107107
{
108-
let hir = cx.tcx.hir();
109-
let mut iter = hir.parent_iter(expr.hir_id);
108+
let mut iter = cx.tcx.hir().parent_iter(expr.hir_id);
110109
if let Some((_, Node::Block(Block { stmts: [], .. }))) = iter.next() {
111110
if let Some((
112111
_,

clippy_utils/src/lib.rs

+5-10
Original file line numberDiff line numberDiff line change
@@ -833,12 +833,11 @@ pub fn capture_local_usage(cx: &LateContext<'tcx>, e: &Expr<'_>) -> CaptureKind
833833
ExprKind::Path(QPath::Resolved(None, Path { res: Res::Local(_), .. }))
834834
));
835835

836-
let map = cx.tcx.hir();
837836
let mut child_id = e.hir_id;
838837
let mut capture = CaptureKind::Value;
839838
let mut capture_expr_ty = e;
840839

841-
for (parent_id, parent) in map.parent_iter(e.hir_id) {
840+
for (parent_id, parent) in cx.tcx.hir().parent_iter(e.hir_id) {
842841
if let [Adjustment {
843842
kind: Adjust::Deref(_) | Adjust::Borrow(AutoBorrow::Ref(..)),
844843
target,
@@ -1224,8 +1223,7 @@ pub fn get_enclosing_block<'tcx>(cx: &LateContext<'tcx>, hir_id: HirId) -> Optio
12241223

12251224
/// Gets the loop or closure enclosing the given expression, if any.
12261225
pub fn get_enclosing_loop_or_closure(tcx: TyCtxt<'tcx>, expr: &Expr<'_>) -> Option<&'tcx Expr<'tcx>> {
1227-
let map = tcx.hir();
1228-
for (_, node) in map.parent_iter(expr.hir_id) {
1226+
for (_, node) in tcx.hir().parent_iter(expr.hir_id) {
12291227
match node {
12301228
Node::Expr(
12311229
e
@@ -1244,8 +1242,7 @@ pub fn get_enclosing_loop_or_closure(tcx: TyCtxt<'tcx>, expr: &Expr<'_>) -> Opti
12441242

12451243
/// Gets the parent node if it's an impl block.
12461244
pub fn get_parent_as_impl(tcx: TyCtxt<'_>, id: HirId) -> Option<&Impl<'_>> {
1247-
let map = tcx.hir();
1248-
match map.parent_iter(id).next() {
1245+
match tcx.hir().parent_iter(id).next() {
12491246
Some((
12501247
_,
12511248
Node::Item(Item {
@@ -1259,8 +1256,7 @@ pub fn get_parent_as_impl(tcx: TyCtxt<'_>, id: HirId) -> Option<&Impl<'_>> {
12591256

12601257
/// Checks if the given expression is the else clause of either an `if` or `if let` expression.
12611258
pub fn is_else_clause(tcx: TyCtxt<'_>, expr: &Expr<'_>) -> bool {
1262-
let map = tcx.hir();
1263-
let mut iter = map.parent_iter(expr.hir_id);
1259+
let mut iter = tcx.hir().parent_iter(expr.hir_id);
12641260
match iter.next() {
12651261
Some((
12661262
_,
@@ -1794,9 +1790,8 @@ pub fn is_expr_identity_function(cx: &LateContext<'_>, expr: &Expr<'_>) -> bool
17941790

17951791
/// Gets the node where an expression is either used, or it's type is unified with another branch.
17961792
pub fn get_expr_use_or_unification_node(tcx: TyCtxt<'tcx>, expr: &Expr<'_>) -> Option<Node<'tcx>> {
1797-
let map = tcx.hir();
17981793
let mut child_id = expr.hir_id;
1799-
let mut iter = map.parent_iter(child_id);
1794+
let mut iter = tcx.hir().parent_iter(child_id);
18001795
loop {
18011796
match iter.next() {
18021797
None => break None,

0 commit comments

Comments
 (0)