Skip to content

Commit

Permalink
lowering: cleanup some hofs
Browse files Browse the repository at this point in the history
  • Loading branch information
Centril committed Jan 21, 2020
1 parent ce361fb commit 32a81f7
Showing 1 changed file with 3 additions and 12 deletions.
15 changes: 3 additions & 12 deletions src/librustc_ast_lowering/expr.rs
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 32a81f7

Please sign in to comment.