Clean up some unwraps (#1147)

This commit is contained in:
Jonathan Turner
2020-01-02 09:45:32 +13:00
committed by GitHub
parent 25298d35e4
commit aa577bf9bf
10 changed files with 183 additions and 98 deletions

View File

@ -422,9 +422,11 @@ pub async fn cli() -> Result<(), Box<dyn Error>> {
};
let prompt = {
let bytes = strip_ansi_escapes::strip(&colored_prompt).unwrap();
String::from_utf8_lossy(&bytes).to_string()
if let Ok(bytes) = strip_ansi_escapes::strip(&colored_prompt) {
String::from_utf8_lossy(&bytes).to_string()
} else {
"> ".to_string()
}
};
rl.helper_mut().expect("No helper").colored_prompt = colored_prompt;