Remove unneeded string allocations
This commit is contained in:
parent
58a8e0c271
commit
c670ae67b6
1 changed files with 4 additions and 4 deletions
|
@ -317,10 +317,10 @@ impl CodeMap {
|
|||
|
||||
pub fn mk_substr_filename(&self, sp: Span) -> String {
|
||||
let pos = self.lookup_char_pos(sp.lo());
|
||||
(format!("<{}:{}:{}>",
|
||||
format!("<{}:{}:{}>",
|
||||
pos.file.name,
|
||||
pos.line,
|
||||
pos.col.to_usize() + 1)).to_string()
|
||||
pos.col.to_usize() + 1)
|
||||
}
|
||||
|
||||
// If there is a doctest_offset, apply it to the line
|
||||
|
@ -462,12 +462,12 @@ impl CodeMap {
|
|||
|
||||
let lo = self.lookup_char_pos_adj(sp.lo());
|
||||
let hi = self.lookup_char_pos_adj(sp.hi());
|
||||
return (format!("{}:{}:{}: {}:{}",
|
||||
format!("{}:{}:{}: {}:{}",
|
||||
lo.filename,
|
||||
lo.line,
|
||||
lo.col.to_usize() + 1,
|
||||
hi.line,
|
||||
hi.col.to_usize() + 1)).to_string()
|
||||
hi.col.to_usize() + 1)
|
||||
}
|
||||
|
||||
pub fn span_to_filename(&self, sp: Span) -> FileName {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue