diff --git a/src/configure.rs b/src/configure.rs index 48f765aa..415a1e0b 100644 --- a/src/configure.rs +++ b/src/configure.rs @@ -140,11 +140,11 @@ fn get_editor() -> String { } fn get_editor_internal(visual: Option, editor: Option) -> String { - let editor_name = visual.unwrap_or_else(|| "".into()); + let editor_name = visual.unwrap_or_default(); if !editor_name.is_empty() { return editor_name; } - let editor_name = editor.unwrap_or_else(|| "".into()); + let editor_name = editor.unwrap_or_default(); if !editor_name.is_empty() { return editor_name; } diff --git a/src/modules/conda.rs b/src/modules/conda.rs index 70878b73..025a99ca 100644 --- a/src/modules/conda.rs +++ b/src/modules/conda.rs @@ -9,9 +9,7 @@ use crate::formatter::StringFormatter; /// Will display the Conda environment iff `$CONDA_DEFAULT_ENV` is set. pub fn module<'a>(context: &'a Context) -> Option> { // Reference implementation: https://github.com/denysdovhan/spaceship-prompt/blob/master/sections/conda.zsh - let conda_env = context - .get_env("CONDA_DEFAULT_ENV") - .unwrap_or_else(|| "".into()); + let conda_env = context.get_env("CONDA_DEFAULT_ENV").unwrap_or_default(); if conda_env.trim().is_empty() { return None; }