Skip to content

Commit 9b5e397

Browse files
Inline State::new
There was only one callsite for each and this removes the unwrap_or_default's on the comments argument
1 parent 59b161c commit 9b5e397

File tree

2 files changed

+2
-18
lines changed

2 files changed

+2
-18
lines changed

src/librustc/hir/print.rs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -123,18 +123,10 @@ impl<'a> State<'a> {
123123
ann: &'a dyn PpAnn)
124124
-> State<'a> {
125125
let comments = comments::gather_comments(sess, filename, input);
126-
State::new(cm, out, ann, Some(comments))
127-
}
128-
129-
pub fn new(cm: &'a SourceMap,
130-
out: &'a mut String,
131-
ann: &'a dyn PpAnn,
132-
comments: Option<Vec<comments::Comment>>)
133-
-> State<'a> {
134126
State {
135127
s: pp::mk_printer(out),
136128
cm: Some(cm),
137-
comments: comments.unwrap_or_default(),
129+
comments: comments,
138130
cur_cmnt: 0,
139131
ann,
140132
}

src/libsyntax/print/pprust.rs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -99,18 +99,10 @@ impl<'a> State<'a> {
9999
ann: &'a dyn PpAnn,
100100
is_expanded: bool) -> State<'a> {
101101
let comments = comments::gather_comments(sess, filename, input);
102-
State::new(cm, out, ann, Some(comments), is_expanded)
103-
}
104-
105-
pub fn new(cm: &'a SourceMap,
106-
out: &'a mut String,
107-
ann: &'a dyn PpAnn,
108-
comments: Option<Vec<comments::Comment>>,
109-
is_expanded: bool) -> State<'a> {
110102
State {
111103
s: pp::mk_printer(out),
112104
cm: Some(cm),
113-
comments: comments.unwrap_or_default(),
105+
comments,
114106
cur_cmnt: 0,
115107
ann,
116108
is_expanded,

0 commit comments

Comments
 (0)