mirror of
https://github.com/LemmyNet/lemmy
synced 2024-11-22 12:33:09 +00:00
Using .map() instead.
This commit is contained in:
parent
8009251bf2
commit
a2f4907209
1 changed files with 1 additions and 10 deletions
|
@ -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)]
|
||||
|
|
Loading…
Reference in a new issue