mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-07 01:05:39 +03:00
Avoid unnecessary use of the Map trait.
The `Map` trait is there for cases where `tcx` isn't available. This isn't one of those cases, so it's simpler to just call through `tcx` directly.
This commit is contained in:
@@ -14,7 +14,7 @@
|
||||
use rustc_errors::{Applicability, Diag, MultiSpan, struct_span_code_err};
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::def::{DefKind, Res};
|
||||
use rustc_hir::intravisit::{Map, Visitor, walk_block, walk_expr};
|
||||
use rustc_hir::intravisit::{Visitor, walk_block, walk_expr};
|
||||
use rustc_hir::{CoroutineDesugaring, CoroutineKind, CoroutineSource, LangItem, PatField};
|
||||
use rustc_middle::bug;
|
||||
use rustc_middle::hir::nested_filter::OnlyBodies;
|
||||
@@ -1082,7 +1082,7 @@ fn visit_expr(&mut self, ex: &'hir hir::Expr<'hir>) -> Self::Result {
|
||||
] {
|
||||
for (destination, sp) in elements {
|
||||
if let Ok(hir_id) = destination.target_id
|
||||
&& let hir::Node::Expr(expr) = tcx.hir().hir_node(hir_id)
|
||||
&& let hir::Node::Expr(expr) = tcx.hir_node(hir_id)
|
||||
&& !matches!(
|
||||
sp.desugaring_kind(),
|
||||
Some(DesugaringKind::ForLoop | DesugaringKind::WhileLoop)
|
||||
|
||||
Reference in New Issue
Block a user