4125: Avoid lossy OsString conversions r=matklad a=lnicola

This is a bit invasive, and perhaps for not much benefit since non-UTF-8 environment variables don't work anyway.

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
This commit is contained in:
bors[bot] 2020-04-25 10:35:14 +00:00 committed by GitHub
commit f654f49435
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 14 additions and 9 deletions

View file

@ -358,7 +358,7 @@ fn env_expand(
// However, we cannot use an empty string here, because for
// `include!(concat!(env!("OUT_DIR"), "/foo.rs"))` will become
// `include!("foo.rs"), which might go to infinite loop
let s = get_env_inner(db, arg_id, &key).unwrap_or("__RA_UNIMPLEMENTATED__".to_string());
let s = get_env_inner(db, arg_id, &key).unwrap_or_else(|| "__RA_UNIMPLEMENTATED__".to_string());
let expanded = quote! { #s };
Ok((expanded, FragmentKind::Expr))