Skip to content

Commit c670ae6

Browse files
author
Alex Crawford
committed
Remove unneeded string allocations
1 parent 58a8e0c commit c670ae6

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/libsyntax/codemap.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -317,10 +317,10 @@ impl CodeMap {
317317

318318
pub fn mk_substr_filename(&self, sp: Span) -> String {
319319
let pos = self.lookup_char_pos(sp.lo());
320-
(format!("<{}:{}:{}>",
320+
format!("<{}:{}:{}>",
321321
pos.file.name,
322322
pos.line,
323-
pos.col.to_usize() + 1)).to_string()
323+
pos.col.to_usize() + 1)
324324
}
325325

326326
// If there is a doctest_offset, apply it to the line
@@ -462,12 +462,12 @@ impl CodeMap {
462462

463463
let lo = self.lookup_char_pos_adj(sp.lo());
464464
let hi = self.lookup_char_pos_adj(sp.hi());
465-
return (format!("{}:{}:{}: {}:{}",
465+
format!("{}:{}:{}: {}:{}",
466466
lo.filename,
467467
lo.line,
468468
lo.col.to_usize() + 1,
469469
hi.line,
470-
hi.col.to_usize() + 1)).to_string()
470+
hi.col.to_usize() + 1)
471471
}
472472

473473
pub fn span_to_filename(&self, sp: Span) -> FileName {

0 commit comments

Comments
 (0)