Skip to content

Commit

Permalink
rustfmt
Browse files Browse the repository at this point in the history
  • Loading branch information
dingxiangfei2009 committed Oct 13, 2020
1 parent 323f079 commit 66345d9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
15 changes: 10 additions & 5 deletions compiler/rustc_typeck/src/check/generator_interior.rs
Expand Up @@ -8,9 +8,9 @@ use rustc_data_structures::fx::{FxHashSet, FxIndexSet};
use rustc_hir as hir;
use rustc_hir::def::{CtorKind, DefKind, Res};
use rustc_hir::def_id::DefId;
use rustc_hir::intravisit::{self, NestedVisitorMap, Visitor};
use rustc_hir::{Expr, ExprKind, Pat, PatKind, Arm, Guard, HirId};
use rustc_hir::hir_id::HirIdSet;
use rustc_hir::intravisit::{self, NestedVisitorMap, Visitor};
use rustc_hir::{Arm, Expr, ExprKind, Guard, HirId, Pat, PatKind};
use rustc_middle::middle::region::{self, YieldData};
use rustc_middle::ty::{self, Ty};
use rustc_span::Span;
Expand Down Expand Up @@ -64,7 +64,9 @@ impl<'a, 'tcx> InteriorVisitor<'a, 'tcx> {
yield_data.expr_and_pat_count, self.expr_count, source_span
);

if guard_borrowing_from_pattern || yield_data.expr_and_pat_count >= self.expr_count {
if guard_borrowing_from_pattern
|| yield_data.expr_and_pat_count >= self.expr_count
{
Some(yield_data)
} else {
None
Expand Down Expand Up @@ -239,7 +241,10 @@ impl<'a, 'tcx> Visitor<'tcx> for InteriorVisitor<'a, 'tcx> {
let mut scope_var_ids =
self.nested_scope_of_guards.pop().expect("should have pushed at least one earlier");
for var_id in scope_var_ids.drain(..) {
assert!(self.current_scope_of_guards.remove(&var_id), "variable should be placed in scope earlier");
assert!(
self.current_scope_of_guards.remove(&var_id),
"variable should be placed in scope earlier"
);
}
self.arm_has_guard = false;
}
Expand Down Expand Up @@ -289,7 +294,7 @@ impl<'a, 'tcx> Visitor<'tcx> for InteriorVisitor<'a, 'tcx> {
}
}
_ => intravisit::walk_expr(self, expr),
}
},
ExprKind::Path(qpath) => {
intravisit::walk_expr(self, expr);
let res = self.fcx.typeck_results.borrow().qpath_res(qpath, expr.hir_id);
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/generator/yielding-in-match-guards.rs
Expand Up @@ -26,4 +26,4 @@ async fn g() {
}
}

fn main() {}
fn main() {}

0 comments on commit 66345d9

Please sign in to comment.