diff --git a/src/config.rs b/src/config.rs index 2a38705..70d031d 100644 --- a/src/config.rs +++ b/src/config.rs @@ -62,5 +62,5 @@ pub fn resolve_symlinks() -> bool { } pub fn get_home_dir() -> OsString { - env::var_os("HOME").unwrap_or("".into()) + env::var_os("HOME").unwrap_or_else(|| "".into()) } diff --git a/src/util.rs b/src/util.rs index d5dfa98..7a38b60 100644 --- a/src/util.rs +++ b/src/util.rs @@ -163,7 +163,7 @@ fn expand_home_dir(path: &str) -> String { return path.to_string(); } - match path.strip_prefix("~") { + match path.strip_prefix('~') { Some(path) => { format!("{}{}", home.to_str().expect("cannot convert OsString to &str"), path) }