From 2eab86a633f5984758f3c0a6698905add9923db0 Mon Sep 17 00:00:00 2001 From: Daniel Pechersky Date: Tue, 16 Sep 2025 16:31:05 +0700 Subject: [PATCH] Pass some lints --- Cargo.toml | 55 ++++-------------------- rslib/src/scheduler/fsrs/memory_state.rs | 11 ++--- 2 files changed, 14 insertions(+), 52 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index f9ed269aa..35511e64f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -63,10 +63,7 @@ bitflags = "2.9.1" blake3 = "1.8.2" bytes = "1.10.1" camino = "1.1.10" -chrono = { version = "0.4.41", default-features = false, features = [ - "std", - "clock", -] } +chrono = { version = "0.4.41", default-features = false, features = ["std", "clock"] } clap = { version = "4.5.40", features = ["derive"] } coarsetime = "0.1.36" convert_case = "0.8.0" @@ -111,26 +108,12 @@ prost-build = "0.13" prost-reflect = "0.14.7" prost-types = "0.13" pulldown-cmark = "0.13.0" -pyo3 = { version = "0.25.1", features = [ - "extension-module", - "abi3", - "abi3-py39", -] } +pyo3 = { version = "0.25.1", features = ["extension-module", "abi3", "abi3-py39"] } rand = "0.9.1" rayon = "1.10.0" regex = "1.11.1" -reqwest = { version = "0.12.20", default-features = false, features = [ - "json", - "socks", - "stream", - "multipart", -] } -rusqlite = { version = "0.36.0", features = [ - "trace", - "functions", - "collation", - "bundled", -] } +reqwest = { version = "0.12.20", default-features = false, features = ["json", "socks", "stream", "multipart"] } +rusqlite = { version = "0.36.0", features = ["trace", "functions", "collation", "bundled"] } rustls-pemfile = "2.2.0" scopeguard = "1.2.0" serde = { version = "1.0.219", features = ["derive"] } @@ -146,18 +129,10 @@ syn = { version = "2.0.103", features = ["parsing", "printing"] } tar = "0.4.44" tempfile = "3.20.0" termcolor = "1.4.1" -tokio = { version = "1.45", features = [ - "fs", - "rt-multi-thread", - "macros", - "signal", -] } +tokio = { version = "1.45", features = ["fs", "rt-multi-thread", "macros", "signal"] } tokio-util = { version = "0.7.15", features = ["io"] } tower-http = { version = "0.6.6", features = ["trace"] } -tracing = { version = "0.1.41", features = [ - "max_level_trace", - "release_max_level_debug", -] } +tracing = { version = "0.1.41", features = ["max_level_trace", "release_max_level_debug"] } tracing-appender = "0.2.3" tracing-subscriber = { version = "0.3.20", features = ["fmt", "env-filter"] } unic-langid = { version = "0.9.6", features = ["macros"] } @@ -167,24 +142,10 @@ walkdir = "2.5.0" which = "8.0.0" widestring = "1.1.0" winapi = { version = "0.3", features = ["wincon", "winreg"] } -windows = { version = "0.61.3", features = [ - "Media_SpeechSynthesis", - "Media_Core", - "Foundation_Collections", - "Storage_Streams", - "Win32_System_Console", - "Win32_System_Registry", - "Win32_System_SystemInformation", - "Win32_Foundation", - "Win32_UI_Shell", - "Wdk_System_SystemServices", -] } +windows = { version = "0.61.3", features = ["Media_SpeechSynthesis", "Media_Core", "Foundation_Collections", "Storage_Streams", "Win32_System_Console", "Win32_System_Registry", "Win32_System_SystemInformation", "Win32_Foundation", "Win32_UI_Shell", "Wdk_System_SystemServices"] } wiremock = "0.6.3" xz2 = "0.1.7" -zip = { version = "4.1.0", default-features = false, features = [ - "deflate", - "time", -] } +zip = { version = "4.1.0", default-features = false, features = ["deflate", "time"] } zstd = { version = "0.13.3", features = ["zstdmt"] } # Apply mild optimizations to our dependencies in dev mode, which among other things diff --git a/rslib/src/scheduler/fsrs/memory_state.rs b/rslib/src/scheduler/fsrs/memory_state.rs index c213e2ec0..a65c1c79f 100644 --- a/rslib/src/scheduler/fsrs/memory_state.rs +++ b/rslib/src/scheduler/fsrs/memory_state.rs @@ -9,7 +9,8 @@ use fsrs::MemoryState; use fsrs::FSRS; use fsrs::FSRS5_DEFAULT_DECAY; use fsrs::FSRS6_DEFAULT_DECAY; -use itertools::{Either, Itertools}; +use itertools::Either; +use itertools::Itertools; use super::params::ignore_revlogs_before_ms_from_config; use super::rescheduler::Rescheduler; @@ -309,8 +310,9 @@ impl Collection { starting_states.push(item.starting_state); } - // fsrs.memory_state_batch is O(nm) where n is the number of cards and m is the max review count between all items. - // Therefore we want to pass batches to fsrs.memory_state_batch where the review count is relatively even. + // fsrs.memory_state_batch is O(nm) where n is the number of cards and m is the + // max review count between all items. Therefore we want to pass batches + // to fsrs.memory_state_batch where the review count is relatively even. let mut p = permutation::sort_unstable_by_key(&fsrs_items, |item| item.reviews.len()); p.apply_slice_in_place(&mut to_update); p.apply_slice_in_place(&mut fsrs_items); @@ -640,9 +642,8 @@ mod tests { } mod update_memory_state { - use crate::collection::CollectionBuilder; - use super::*; + use crate::collection::CollectionBuilder; #[test] fn smoke() {