Using .map() instead.

pull/2043/head
Dessalines 2022-01-19 23:10:25 -05:00
parent 8009251bf2
commit a2f4907209
1 changed files with 1 additions and 10 deletions

View File

@ -176,16 +176,7 @@ pub fn clean_url_params(mut url: Url) -> Url {
} }
pub fn clean_optional_text(text: &Option<String>) -> Option<String> { pub fn clean_optional_text(text: &Option<String>) -> Option<String> {
if let Some(text) = text { text.as_ref().map(|t| t.trim().to_string())
let trimmed = text.trim();
if trimmed.is_empty() {
None
} else {
Some(trimmed.to_owned())
}
} else {
None
}
} }
#[cfg(test)] #[cfg(test)]