Use is_empty() instead of comparing with ""

This commit is contained in:
Kitaiti Makoto 2021-01-15 23:25:07 +09:00
parent dfe83aafc5
commit 33fceddc08

View File

@ -401,7 +401,7 @@ pub fn update(
user.preferred_theme = form user.preferred_theme = form
.theme .theme
.clone() .clone()
.and_then(|t| if &t == "" { None } else { Some(t) }); .and_then(|t| if t.is_empty() { None } else { Some(t) });
user.hide_custom_css = form.hide_custom_css; user.hide_custom_css = form.hide_custom_css;
let _: User = user.save_changes(&*conn).map_err(Error::from)?; let _: User = user.save_changes(&*conn).map_err(Error::from)?;