about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMark Rousskov <mark.simulacrum@gmail.com>2019-07-05 16:35:23 -0400
committerMark Rousskov <mark.simulacrum@gmail.com>2019-07-10 07:12:28 -0400
commit9b5e39723dc8193a2c80289b062f87d618a59d11 (patch)
treed159145c886c0ce0e8a278ac476b3546cfeebed4
parent59b161c7c84e48b9379fbed877a2fa5c13db0526 (diff)
downloadrust-9b5e39723dc8193a2c80289b062f87d618a59d11.tar.gz
rust-9b5e39723dc8193a2c80289b062f87d618a59d11.zip
Inline State::new
There was only one callsite for each and this removes the
unwrap_or_default's on the comments argument
-rw-r--r--src/librustc/hir/print.rs10
-rw-r--r--src/libsyntax/print/pprust.rs10
2 files changed, 2 insertions, 18 deletions
diff --git a/src/librustc/hir/print.rs b/src/librustc/hir/print.rs
index 9acf6d895e3..c12983ba1d3 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<Vec<comments::Comment>>)
-               -> 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 460c4434712..b7bbcc2c555 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<Vec<comments::Comment>>,
-               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,