diff --git a/crates/utils/src/utils.rs b/crates/utils/src/utils.rs index a1fefffe8..2b28ae0ea 100644 --- a/crates/utils/src/utils.rs +++ b/crates/utils/src/utils.rs @@ -176,16 +176,7 @@ pub fn clean_url_params(mut url: Url) -> Url { } pub fn clean_optional_text(text: &Option) -> Option { - if let Some(text) = text { - let trimmed = text.trim(); - if trimmed.is_empty() { - None - } else { - Some(trimmed.to_owned()) - } - } else { - None - } + text.as_ref().map(|t| t.trim().to_string()) } #[cfg(test)]