Only trim once.

This commit is contained in:
Dessalines 2022-01-17 11:25:12 -05:00
parent 194269fd3c
commit 8009251bf2

View file

@ -177,10 +177,11 @@ pub fn clean_url_params(mut url: Url) -> Url {
pub fn clean_optional_text(text: &Option<String>) -> Option<String> {
if let Some(text) = text {
if text.trim().is_empty() {
let trimmed = text.trim();
if trimmed.is_empty() {
None
} else {
Some(text.trim().to_owned())
Some(trimmed.to_owned())
}
} else {
None