Using .map() instead.

This commit is contained in:
Dessalines 2022-01-19 23:10:25 -05:00
parent 8009251bf2
commit a2f4907209

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> {
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)]