Closed
Description
Currently, attempting to compile code that expects a String
while providing an &'static str
causes the following to be shown:
error[E0308]: mismatched types
--> src/incoming.rs:70:90
|
70 | timestamp: headers.get_raw("x-timestamp").unwrap_or(ErrorKind::MissingHeader("x-timestamp"))?,
| ^^^^^^^^^^^^^ expected struct `std::string::String`, found reference
|
= note: expected type `std::string::String`
found type `&'static str`
= help: here are some functions which might fulfill your needs:
- .escape_debug()
- .escape_default()
- .escape_unicode()
- .to_lowercase()
- .to_uppercase()
I'm guessing that these suggestions are automatically generated/derived by the compiler, but none of them are good "generic" suggestions.
The compiler should probably suggest either .to_owned()
or .into()
in this case instead.