about summary refs log tree commit diff
path: root/src/librustc_errors
diff options
context:
space:
mode:
authorljedrz <ljedrz@gmail.com>2018-10-09 14:30:14 +0200
committerljedrz <ljedrz@gmail.com>2018-10-10 10:39:18 +0200
commita01a99423168ffd3ef3003c328056dc09804f1ce (patch)
treedd71748279ec6aaf5b767a16276a28560431b413 /src/librustc_errors
parentb1a137d0159543d5a295ce86a9b7475c486efeac (diff)
downloadrust-a01a99423168ffd3ef3003c328056dc09804f1ce.tar.gz
rust-a01a99423168ffd3ef3003c328056dc09804f1ce.zip
A handful of random string-related improvements
Diffstat (limited to 'src/librustc_errors')
-rw-r--r--src/librustc_errors/diagnostic.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/librustc_errors/diagnostic.rs b/src/librustc_errors/diagnostic.rs
index 2799f2cc81f..870eeadc081 100644
--- a/src/librustc_errors/diagnostic.rs
+++ b/src/librustc_errors/diagnostic.rs
@@ -76,9 +76,9 @@ pub enum StringPart {
 }
 
 impl StringPart {
-    pub fn content(&self) -> String {
+    pub fn content(&self) -> &str {
         match self {
-            &StringPart::Normal(ref s) | & StringPart::Highlighted(ref s) => s.to_owned()
+            &StringPart::Normal(ref s) | & StringPart::Highlighted(ref s) => s
         }
     }
 }
@@ -398,7 +398,7 @@ impl Diagnostic {
     }
 
     pub fn message(&self) -> String {
-        self.message.iter().map(|i| i.0.to_owned()).collect::<String>()
+        self.message.iter().map(|i| i.0.as_str()).collect::<String>()
     }
 
     pub fn styled_message(&self) -> &Vec<(String, Style)> {
@@ -448,7 +448,7 @@ impl Diagnostic {
 
 impl SubDiagnostic {
     pub fn message(&self) -> String {
-        self.message.iter().map(|i| i.0.to_owned()).collect::<String>()
+        self.message.iter().map(|i| i.0.as_str()).collect::<String>()
     }
 
     pub fn styled_message(&self) -> &Vec<(String, Style)> {