expected: DiagnosticStyledString,
found: DiagnosticStyledString,
) -> &mut Self {
- let mut msg: Vec<_> =
- vec![("required when trying to coerce from type `".to_string(), Style::NoStyle)];
+ let mut msg: Vec<_> = vec![("required when trying to coerce from type `", Style::NoStyle)];
msg.extend(expected.0.iter().map(|x| match *x {
- StringPart::Normal(ref s) => (s.to_owned(), Style::NoStyle),
- StringPart::Highlighted(ref s) => (s.to_owned(), Style::Highlight),
+ StringPart::Normal(ref s) => (s.as_str(), Style::NoStyle),
+ StringPart::Highlighted(ref s) => (s.as_str(), Style::Highlight),
}));
- msg.push(("` to type '".to_string(), Style::NoStyle));
+ msg.push(("` to type '", Style::NoStyle));
msg.extend(found.0.iter().map(|x| match *x {
- StringPart::Normal(ref s) => (s.to_owned(), Style::NoStyle),
- StringPart::Highlighted(ref s) => (s.to_owned(), Style::Highlight),
+ StringPart::Normal(ref s) => (s.as_str(), Style::NoStyle),
+ StringPart::Highlighted(ref s) => (s.as_str(), Style::Highlight),
}));
- msg.push(("`".to_string(), Style::NoStyle));
+ msg.push(("`", Style::NoStyle));
// For now, just attach these as notes
self.highlighted_note(msg);