diff options
| author | ljedrz <ljedrz@gmail.com> | 2018-10-09 14:30:14 +0200 |
|---|---|---|
| committer | ljedrz <ljedrz@gmail.com> | 2018-10-10 10:39:18 +0200 |
| commit | a01a99423168ffd3ef3003c328056dc09804f1ce (patch) | |
| tree | dd71748279ec6aaf5b767a16276a28560431b413 /src/librustc_errors | |
| parent | b1a137d0159543d5a295ce86a9b7475c486efeac (diff) | |
| download | rust-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.rs | 8 |
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)> { |
