A handful of random string-related improvements
This commit is contained in:
parent
b1a137d015
commit
a01a994231
@ -91,13 +91,13 @@ pub fn try_run_suppressed(cmd: &mut Command) -> bool {
|
||||
output.status.success()
|
||||
}
|
||||
|
||||
pub fn gnu_target(target: &str) -> String {
|
||||
pub fn gnu_target(target: &str) -> &str {
|
||||
match target {
|
||||
"i686-pc-windows-msvc" => "i686-pc-win32".to_string(),
|
||||
"x86_64-pc-windows-msvc" => "x86_64-pc-win32".to_string(),
|
||||
"i686-pc-windows-gnu" => "i686-w64-mingw32".to_string(),
|
||||
"x86_64-pc-windows-gnu" => "x86_64-w64-mingw32".to_string(),
|
||||
s => s.to_string(),
|
||||
"i686-pc-windows-msvc" => "i686-pc-win32",
|
||||
"x86_64-pc-windows-msvc" => "x86_64-pc-win32",
|
||||
"i686-pc-windows-gnu" => "i686-w64-mingw32",
|
||||
"x86_64-pc-windows-gnu" => "x86_64-w64-mingw32",
|
||||
s => s,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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)> {
|
||||
|
Loading…
x
Reference in New Issue
Block a user