I've:
#[derive(Clone)]
pub struct Language {
_abbrev: String,
_data: Arc<LanguageData>,
_region: Option<Region>,
}
impl Language {
fn parse_tag<T: ToString>(tag: T) -> Option<(String, String)> {
...
if region_abbrev.is_none() {
let r = Region::parse(language_abbrev);
if let Some(a) = r {
region_abbrev = Some(a.to_string().to_lowercase().as_str());
}
}
...
}
}
In the range of code a.to_string().to_lowercase()
I'm getting:
temporary value dropped while borrowed
consider using a `let` binding to create a longer lived valuerustcE0716
language.rs(60, 76): temporary value is freed at the end of this statement
language.rs(63, 12): borrow later used here
I did try binding this range to a variable b
, but the issue persists:
let b = a.to_string().to_lowercase();
region_abbrev = Some(b.as_str());
With this the error goes on the entire b.as_str()
range.