diff --git a/rslib/src/collection/backup.rs b/rslib/src/collection/backup.rs index 0918fc5a3..a2e6bcc7e 100644 --- a/rslib/src/collection/backup.rs +++ b/rslib/src/collection/backup.rs @@ -326,7 +326,8 @@ mod test { let expected: Vec<_> = backups .iter() - .filter_map(|b| b.1.then(|| b.0.clone())) + .filter(|b| b.1) + .map(|b| b.0.clone()) .collect(); let obsolete_backups = BackupFilter::new(today, limits).obsolete_backups(backups.into_iter().map(|b| b.0)); diff --git a/rslib/src/import_export/package/apkg/import/notes.rs b/rslib/src/import_export/package/apkg/import/notes.rs index 857ae9ee4..f4c4dda22 100644 --- a/rslib/src/import_export/package/apkg/import/notes.rs +++ b/rslib/src/import_export/package/apkg/import/notes.rs @@ -546,7 +546,7 @@ fn notetype_conflicts( if meta.notetype_id != note.notetype_id { conflicts .entry((meta.notetype_id, note.notetype_id)) - .or_insert_with(Vec::new) + .or_default() .push(note.id); } }; diff --git a/rslib/src/notetype/checks.rs b/rslib/src/notetype/checks.rs index b53ed3c3d..1cd6320dc 100644 --- a/rslib/src/notetype/checks.rs +++ b/rslib/src/notetype/checks.rs @@ -43,10 +43,11 @@ fn media_field_referencing_templates<'a>( notetypes .flat_map(|notetype| { notetype.templates.iter().flat_map(|card_type| { - card_type.sides().into_iter().filter_map(|(format, front)| { - references_media_field(format) - .then(|| Template::new(¬etype.name, &card_type.name, front)) - }) + card_type + .sides() + .into_iter() + .filter(|&(format, _front)| references_media_field(format)) + .map(|(_format, front)| Template::new(¬etype.name, &card_type.name, front)) }) }) .collect() diff --git a/rslib/src/search/sqlwriter.rs b/rslib/src/search/sqlwriter.rs index 2d9ab5731..94880e1ae 100644 --- a/rslib/src/search/sqlwriter.rs +++ b/rslib/src/search/sqlwriter.rs @@ -630,9 +630,8 @@ impl SqlWriter<'_> { let matched_fields = nt .fields .iter() - .filter_map(|field| { - matches_glob(&field.name).then(|| field.ord.unwrap_or_default()) - }) + .filter(|&field| matches_glob(&field.name)) + .map(|field| field.ord.unwrap_or_default()) .collect_ranges(); if !matched_fields.is_empty() { field_map.push(FieldQualifiedSearchContext { @@ -660,9 +659,8 @@ impl SqlWriter<'_> { let matched_fields: Vec = nt .fields .iter() - .filter_map(|field| { - matches_glob(&field.name).then(|| field.ord.unwrap_or_default()) - }) + .filter(|&field| matches_glob(&field.name)) + .map(|field| field.ord.unwrap_or_default()) .collect(); if !matched_fields.is_empty() { field_map.push((nt.id, matched_fields)); diff --git a/rslib/src/services.rs b/rslib/src/services.rs index 536507436..27f25cf33 100644 --- a/rslib/src/services.rs +++ b/rslib/src/services.rs @@ -1,6 +1,9 @@ // Copyright: Ankitects Pty Ltd and contributors // License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html +#![allow(clippy::redundant_closure)] + // Includes the automatically-generated *Service and Backend*Service traits, // and some impls on Backend and Collection. + include!(concat!(env!("OUT_DIR"), "/backend.rs")); diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 886cf9fcc..0cd95ef97 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,3 +1,3 @@ [toolchain] # older versions may fail to compile; newer versions may fail the clippy tests -channel = "1.72" +channel = "1.73"