Skip to content

Commit

Permalink
Rollup merge of rust-lang#68416 - Centril:lowering-cleanup-hofs, r=pi…
Browse files Browse the repository at this point in the history
…etroalbini

lowering: cleanup some hofs

Some drive-by cleanup while working on `let_chains`.

r? @pietroalbini
  • Loading branch information
Centril authored Jan 21, 2020
2 parents b6d6391 + 32a81f7 commit c1b20b1
Showing 1 changed file with 3 additions and 12 deletions.
15 changes: 3 additions & 12 deletions src/librustc_ast_lowering/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -848,10 +848,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
}
}

fn with_catch_scope<T, F>(&mut self, catch_id: NodeId, f: F) -> T
where
F: FnOnce(&mut Self) -> T,
{
fn with_catch_scope<T>(&mut self, catch_id: NodeId, f: impl FnOnce(&mut Self) -> T) -> T {
let len = self.catch_scopes.len();
self.catch_scopes.push(catch_id);

Expand All @@ -867,10 +864,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
result
}

fn with_loop_scope<T, F>(&mut self, loop_id: NodeId, f: F) -> T
where
F: FnOnce(&mut Self) -> T,
{
fn with_loop_scope<T>(&mut self, loop_id: NodeId, f: impl FnOnce(&mut Self) -> T) -> T {
// We're no longer in the base loop's condition; we're in another loop.
let was_in_loop_condition = self.is_in_loop_condition;
self.is_in_loop_condition = false;
Expand All @@ -892,10 +886,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
result
}

fn with_loop_condition_scope<T, F>(&mut self, f: F) -> T
where
F: FnOnce(&mut Self) -> T,
{
fn with_loop_condition_scope<T>(&mut self, f: impl FnOnce(&mut Self) -> T) -> T {
let was_in_loop_condition = self.is_in_loop_condition;
self.is_in_loop_condition = true;

Expand Down

0 comments on commit c1b20b1

Please sign in to comment.