Inline State::new

There was only one callsite for each and this removes the
unwrap_or_default's on the comments argument
This commit is contained in:
Mark Rousskov 2019-07-05 16:35:23 -04:00
parent 59b161c7c8
commit 9b5e39723d
2 changed files with 2 additions and 18 deletions

View file

@ -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,
}

View file

@ -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,