From c96784c0eb7edf7518c5b675c69b7c7a6621dfe9 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Fri, 9 Oct 2020 21:35:53 +1000 Subject: [PATCH] fix new clippy lints --- rslib/src/media/mod.rs | 1 + rslib/src/notes.rs | 2 +- rslib/src/search/cards.rs | 5 +---- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/rslib/src/media/mod.rs b/rslib/src/media/mod.rs index 11e15e906..17a02943c 100644 --- a/rslib/src/media/mod.rs +++ b/rslib/src/media/mod.rs @@ -40,6 +40,7 @@ impl MediaManager { /// appended to the name. /// /// Also notes the file in the media database. + #[allow(clippy::match_like_matches_macro)] pub fn add_file<'a>( &self, ctx: &mut MediaDatabaseContext, diff --git a/rslib/src/notes.rs b/rslib/src/notes.rs index e43c0f049..94eaface0 100644 --- a/rslib/src/notes.rs +++ b/rslib/src/notes.rs @@ -515,7 +515,7 @@ mod test { col.update_note(&mut note)?; let existing = col.storage.existing_cards_for_note(note.id)?; let mut ords = existing.iter().map(|a| a.ord).collect::>(); - ords.sort(); + ords.sort_unstable(); assert_eq!(ords, vec![0, 1, 2, 499]); Ok(()) diff --git a/rslib/src/search/cards.rs b/rslib/src/search/cards.rs index fba1a752b..e4eb7ce7c 100644 --- a/rslib/src/search/cards.rs +++ b/rslib/src/search/cards.rs @@ -160,10 +160,7 @@ fn write_order(sql: &mut String, kind: SortKind, reverse: bool) -> Result<()> { fn needs_aux_sort_table(kind: SortKind) -> bool { use SortKind::*; - match kind { - CardDeck | NoteType | CardTemplate => true, - _ => false, - } + matches!(kind, CardDeck | NoteType | CardTemplate) } fn prepare_sort(col: &mut Collection, kind: SortKind) -> Result<()> {