apply clippy fixes

This commit is contained in:
ad hoc 2022-05-04 11:33:43 +02:00
parent 34f75d9792
commit b94eabe48c
No known key found for this signature in database
GPG Key ID: 4F00A782990CC643

View File

@ -177,27 +177,23 @@ make_setting_route!(
"enabled": setting.as_ref().map(|s| !matches!(s.enabled, Setting::Set(false))), "enabled": setting.as_ref().map(|s| !matches!(s.enabled, Setting::Set(false))),
"disable_on_attributes": setting "disable_on_attributes": setting
.as_ref() .as_ref()
.map(|s| s.disable_on_attributes.as_ref().set().map(|m| !m.is_empty())) .and_then(|s| s.disable_on_attributes.as_ref().set().map(|m| !m.is_empty())),
.flatten(),
"disable_on_words": setting "disable_on_words": setting
.as_ref() .as_ref()
.map(|s| s.disable_on_words.as_ref().set().map(|m| !m.is_empty())) .and_then(|s| s.disable_on_words.as_ref().set().map(|m| !m.is_empty())),
.flatten(),
"min_word_size_for_one_typo": setting "min_word_size_for_one_typo": setting
.as_ref() .as_ref()
.map(|s| s.min_word_size_for_typos .and_then(|s| s.min_word_size_for_typos
.as_ref() .as_ref()
.set() .set()
.map(|s| s.one_typo.set())) .map(|s| s.one_typo.set()))
.flatten()
.flatten(), .flatten(),
"min_word_size_for_two_typos": setting "min_word_size_for_two_typos": setting
.as_ref() .as_ref()
.map(|s| s.min_word_size_for_typos .and_then(|s| s.min_word_size_for_typos
.as_ref() .as_ref()
.set() .set()
.map(|s| s.two_typos.set())) .map(|s| s.two_typos.set()))
.flatten()
.flatten(), .flatten(),
}, },
}), }),
@ -325,36 +321,31 @@ pub async fn update_all(
"enabled": settings.typo_tolerance "enabled": settings.typo_tolerance
.as_ref() .as_ref()
.set() .set()
.map(|s| s.enabled.as_ref().set()) .and_then(|s| s.enabled.as_ref().set())
.flatten()
.copied(), .copied(),
"disable_on_attributes": settings.typo_tolerance "disable_on_attributes": settings.typo_tolerance
.as_ref() .as_ref()
.set() .set()
.map(|s| s.disable_on_attributes.as_ref().set().map(|m| !m.is_empty())) .and_then(|s| s.disable_on_attributes.as_ref().set().map(|m| !m.is_empty())),
.flatten(),
"disable_on_words": settings.typo_tolerance "disable_on_words": settings.typo_tolerance
.as_ref() .as_ref()
.set() .set()
.map(|s| s.disable_on_words.as_ref().set().map(|m| !m.is_empty())) .and_then(|s| s.disable_on_words.as_ref().set().map(|m| !m.is_empty())),
.flatten(),
"min_word_size_for_one_typo": settings.typo_tolerance "min_word_size_for_one_typo": settings.typo_tolerance
.as_ref() .as_ref()
.set() .set()
.map(|s| s.min_word_size_for_typos .and_then(|s| s.min_word_size_for_typos
.as_ref() .as_ref()
.set() .set()
.map(|s| s.one_typo.set())) .map(|s| s.one_typo.set()))
.flatten()
.flatten(), .flatten(),
"min_word_size_for_two_typos": settings.typo_tolerance "min_word_size_for_two_typos": settings.typo_tolerance
.as_ref() .as_ref()
.set() .set()
.map(|s| s.min_word_size_for_typos .and_then(|s| s.min_word_size_for_typos
.as_ref() .as_ref()
.set() .set()
.map(|s| s.two_typos.set())) .map(|s| s.two_typos.set()))
.flatten()
.flatten(), .flatten(),
}, },
}), }),