From 9b5e39723dc8193a2c80289b062f87d618a59d11 Mon Sep 17 00:00:00 2001 From: Mark Rousskov Date: Fri, 5 Jul 2019 16:35:23 -0400 Subject: [PATCH] Inline State::new There was only one callsite for each and this removes the unwrap_or_default's on the comments argument --- src/librustc/hir/print.rs | 10 +--------- src/libsyntax/print/pprust.rs | 10 +--------- 2 files changed, 2 insertions(+), 18 deletions(-) diff --git a/src/librustc/hir/print.rs b/src/librustc/hir/print.rs index 9acf6d895e3e..c12983ba1d35 100644 --- a/src/librustc/hir/print.rs +++ b/src/librustc/hir/print.rs @@ -123,18 +123,10 @@ impl<'a> State<'a> { ann: &'a dyn PpAnn) -> State<'a> { let comments = comments::gather_comments(sess, filename, input); - State::new(cm, out, ann, Some(comments)) - } - - pub fn new(cm: &'a SourceMap, - out: &'a mut String, - ann: &'a dyn PpAnn, - comments: Option>) - -> State<'a> { State { s: pp::mk_printer(out), cm: Some(cm), - comments: comments.unwrap_or_default(), + comments: comments, cur_cmnt: 0, ann, } diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs index 460c44347128..b7bbcc2c5559 100644 --- a/src/libsyntax/print/pprust.rs +++ b/src/libsyntax/print/pprust.rs @@ -99,18 +99,10 @@ impl<'a> State<'a> { ann: &'a dyn PpAnn, is_expanded: bool) -> State<'a> { let comments = comments::gather_comments(sess, filename, input); - State::new(cm, out, ann, Some(comments), is_expanded) - } - - pub fn new(cm: &'a SourceMap, - out: &'a mut String, - ann: &'a dyn PpAnn, - comments: Option>, - is_expanded: bool) -> State<'a> { State { s: pp::mk_printer(out), cm: Some(cm), - comments: comments.unwrap_or_default(), + comments, cur_cmnt: 0, ann, is_expanded,