From d26c4b7bd6e5905280dd4441482331fb9fb65e07 Mon Sep 17 00:00:00 2001 From: Mark Rousskov Date: Mon, 24 Jun 2019 14:54:48 -0400 Subject: [PATCH] Inline rust_printer --- src/libsyntax/print/pprust.rs | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs index fff39d8afaf49..67646cce69b4f 100644 --- a/src/libsyntax/print/pprust.rs +++ b/src/libsyntax/print/pprust.rs @@ -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 @@ -137,8 +125,15 @@ pub fn to_string(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(); }