Skip to content
Permalink
Browse files

Remove needless indirection in bclose

  • Loading branch information...
Mark-Simulacrum committed Jul 9, 2019
1 parent 04b80a5 commit 39aa9bf7303c7fdf8d8f3fc62010f8493267cfd5
Showing with 4 additions and 12 deletions.
  1. +2 −6 src/librustc/hir/print.rs
  2. +2 −6 src/libsyntax/print/pprust.rs
@@ -169,10 +169,6 @@ impl<'a> State<'a> {
self.end(); // close the head-box
}

pub fn bclose_(&mut self, span: syntax_pos::Span, indented: usize) {
self.bclose_maybe_open(span, indented, true)
}

pub fn bclose_maybe_open(&mut self,
span: syntax_pos::Span,
indented: usize,
@@ -187,7 +183,7 @@ impl<'a> State<'a> {
}

pub fn bclose(&mut self, span: syntax_pos::Span) {
self.bclose_(span, indent_unit)
self.bclose_maybe_open(span, indent_unit, true)
}

pub fn space_if_not_bol(&mut self) {
@@ -1276,7 +1272,7 @@ impl<'a> State<'a> {
for arm in arms {
self.print_arm(arm);
}
self.bclose_(expr.span, indent_unit);
self.bclose(expr.span);
}
hir::ExprKind::Closure(capture_clause, ref decl, body, _fn_decl_span, _gen) => {
self.print_capture_clause(capture_clause);
@@ -778,10 +778,6 @@ impl<'a> State<'a> {
self.end(); // close the head-box
}

crate fn bclose_(&mut self, span: syntax_pos::Span,
indented: usize) {
self.bclose_maybe_open(span, indented, true)
}
crate fn bclose_maybe_open(&mut self, span: syntax_pos::Span,
indented: usize, close_box: bool) {
self.maybe_print_comment(span.hi());
@@ -792,7 +788,7 @@ impl<'a> State<'a> {
}
}
crate fn bclose(&mut self, span: syntax_pos::Span) {
self.bclose_(span, INDENT_UNIT)
self.bclose_maybe_open(span, INDENT_UNIT, true)
}

crate fn break_offset_if_not_bol(&mut self, n: usize,
@@ -2027,7 +2023,7 @@ impl<'a> State<'a> {
for arm in arms {
self.print_arm(arm);
}
self.bclose_(expr.span, INDENT_UNIT);
self.bclose(expr.span);
}
ast::ExprKind::Closure(
capture_clause, asyncness, movability, ref decl, ref body, _) => {

0 comments on commit 39aa9bf

Please sign in to comment.
You can’t perform that action at this time.