mirror of
https://gitlab.com/keys.openpgp.org/hagrid.git
synced 2025-10-06 00:23:08 +02:00
Clean up linting warnings: this manual char comparison can be written more succinctly.
Commands: cargo clippy --tests --no-deps --workspace Warnings: warning: this manual char comparison can be written more succinctly --> src/web/vks_api.rs:117:37 | 117 | .flat_map(|lang| lang.split(|c| c == '-' || c == ';' || c == '_').next()) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using an array of `char`: `['-', ';', '_']` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_pattern_char_comparison = note: `#[warn(clippy::manual_pattern_char_comparison)]` on by default
This commit is contained in:
@@ -114,7 +114,7 @@ pub fn upload_fallback(origin: RequestOrigin) -> JsonErrorResponse {
|
||||
fn get_locale(langs: &rocket::State<Translations>, locales: Vec<String>) -> I18n {
|
||||
locales
|
||||
.iter()
|
||||
.flat_map(|lang| lang.split(|c| c == '-' || c == ';' || c == '_').next())
|
||||
.flat_map(|lang| lang.split(['-', ';', '_']).next())
|
||||
.flat_map(|lang| langs.iter().find(|(trans, _)| trans == &lang))
|
||||
.next()
|
||||
.or_else(|| langs.iter().find(|(trans, _)| trans == &"en"))
|
||||
|
Reference in New Issue
Block a user