Use unwrap_or_default

This commit is contained in:
kjeremy 2019-12-20 09:43:30 -05:00
parent 133b4063a6
commit f22aabc136

View file

@ -104,7 +104,7 @@ impl ast::ItemList {
} }
}; };
let indent = leading_indent(self.syntax()).unwrap_or("".into()); let indent = leading_indent(self.syntax()).unwrap_or_default();
let ws = tokens::WsBuilder::new(&format!("\n{}", indent)); let ws = tokens::WsBuilder::new(&format!("\n{}", indent));
let to_insert = iter::once(ws.ws().into()); let to_insert = iter::once(ws.ws().into());
match existing_ws { match existing_ws {
@ -133,7 +133,7 @@ impl ast::RecordFieldList {
let space = if is_multiline { let space = if is_multiline {
ws = tokens::WsBuilder::new(&format!( ws = tokens::WsBuilder::new(&format!(
"\n{} ", "\n{} ",
leading_indent(self.syntax()).unwrap_or("".into()) leading_indent(self.syntax()).unwrap_or_default()
)); ));
ws.ws() ws.ws()
} else { } else {