Skip to content

Commit

Permalink
Inline rust_printer
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark-Simulacrum committed Jun 29, 2019
1 parent ff27756 commit d26c4b7
Showing 1 changed file with 9 additions and 14 deletions.
23 changes: 9 additions & 14 deletions src/libsyntax/print/pprust.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,18 +53,6 @@ pub struct State<'a> {
is_expanded: bool
}

fn rust_printer<'a>(writer: &'a mut String, ann: &'a dyn PpAnn) -> State<'a> {
State {
s: pp::mk_printer(writer),
cm: None,
comments: None,
cur_cmnt: 0,
boxes: Vec::new(),
ann,
is_expanded: false
}
}

crate const INDENT_UNIT: usize = 4;

/// Requires you to pass an input filename and reader so that
Expand Down Expand Up @@ -137,8 +125,15 @@ pub fn to_string<F>(f: F) -> String where
{
let mut wr = String::new();
{
let ann = NoAnn;
let mut printer = rust_printer(&mut wr, &ann);
let mut printer = State {
s: pp::mk_printer(&mut wr),
cm: None,
comments: None,
cur_cmnt: 0,
boxes: Vec::new(),
ann: &NoAnn,
is_expanded: false
};
f(&mut printer);
printer.s.eof();
}
Expand Down

0 comments on commit d26c4b7

Please sign in to comment.