about summary refs log tree commit diff
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume1.gomez@gmail.com>2018-02-17 14:45:27 +0100
committerGitHub <noreply@github.com>2018-02-17 14:45:27 +0100
commitc4f0011353d6908803cd05b9c7917fdfa964281d (patch)
treea44387bd0ccca7b361a440e2145ea51c1585df06
parent7dd8c090e4c08882f4adb9354e6963ab93eed48c (diff)
parentc670ae67b606ccdae475e0db2cddd2f3ece8c7e6 (diff)
downloadrust-c4f0011353d6908803cd05b9c7917fdfa964281d.tar.gz
rust-c4f0011353d6908803cd05b9c7917fdfa964281d.zip
Rollup merge of #48284 - crawford:string, r=sfackler
Remove unneeded string allocations
-rw-r--r--src/libsyntax/codemap.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/libsyntax/codemap.rs b/src/libsyntax/codemap.rs
index ff6f32fc3be..df5845f6c21 100644
--- a/src/libsyntax/codemap.rs
+++ b/src/libsyntax/codemap.rs
@@ -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 {