Prefer unwrap_or_else to unwrap_or in case of function calls/allocations

This commit is contained in:
ljedrz
2018-10-12 16:16:00 +02:00
parent cb5e1b93e3
commit d28aed6dc4
35 changed files with 57 additions and 54 deletions

View File

@@ -3119,7 +3119,7 @@ impl<'a> State<'a> {
if cmnt.style != comments::Trailing { return Ok(()) }
let span_line = cm.lookup_char_pos(span.hi());
let comment_line = cm.lookup_char_pos(cmnt.pos);
let next = next_pos.unwrap_or(cmnt.pos + BytePos(1));
let next = next_pos.unwrap_or_else(|| cmnt.pos + BytePos(1));
if span.hi() < cmnt.pos && cmnt.pos < next && span_line.line == comment_line.line {
self.print_comment(cmnt)?;
}