Expand description
convert a string into a static str and string to &str
fix cannot return reference to temporary value
fn string_to_static_str_works() {
let option_value = Some(123);
// cannot return reference to temporary value
// let v = option_value.map_or("", |v| v.to_string().as_str());
let v = option_value.map_or("", |v| to_str(v.to_string()));
assert_eq!(v, "123");
}