diff --git a/src/lib/shell/variables/mod.rs b/src/lib/shell/variables/mod.rs index 292e4aab8d5f8870b04e3d9dd4e4378129cf9e4a..4bc8f411d21e19f0a3872027407028ef16378322 100644 --- a/src/lib/shell/variables/mod.rs +++ b/src/lib/shell/variables/mod.rs @@ -540,11 +540,7 @@ impl Variables { /// Useful for getting smaller prompts, this will produce a simplified variant of the /// working directory which the leading `HOME` prefix replaced with a tilde character. fn get_simplified_directory(&self) -> types::Str { - let home = match self.get::<types::Str>("HOME") { - Some(string) => string, - None => "?".into(), - }; - + let home = self.get::<types::Str>("HOME").unwrap_or_else(|| "?".into()); env::var("PWD").unwrap().replace(&*home, "~").into() }