diff --git a/Cargo.lock b/Cargo.lock index cb49075..7956657 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -64,9 +64,9 @@ checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5" [[package]] name = "cc" -version = "1.1.15" +version = "1.1.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57b6a275aa2903740dc87da01c62040406b8812552e97129a63ea8850a17c6e6" +checksum = "a93fe60e2fc87b6ba2c117f67ae14f66e3fc7d6a1e612a25adb238cc980eadb3" dependencies = [ "shlex", ] @@ -120,18 +120,18 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.16" +version = "4.5.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed6719fffa43d0d87e5fd8caeab59be1554fb028cd30edc88fc4369b17971019" +checksum = "3e5a21b8495e732f1b3c364c9949b201ca7bae518c502c80256c96ad79eaf6ac" dependencies = [ "clap_builder", ] [[package]] name = "clap_builder" -version = "4.5.15" +version = "4.5.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "216aec2b177652e3846684cbfe25c9964d18ec45234f0f5da5157b207ed1aab6" +checksum = "8cf2dd12af7a047ad9d6da2b6b249759a22a7abc0f474c1dae1777afa4b21a73" dependencies = [ "anstyle", "clap_lex", @@ -527,18 +527,18 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.209" +version = "1.0.210" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99fce0ffe7310761ca6bf9faf5115afbc19688edd00171d81b1bb1b116c63e09" +checksum = "c8e3592472072e6e22e0a54d5904d9febf8508f65fb8552499a1abc7d1078c3a" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.209" +version = "1.0.210" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5831b979fd7b5439637af1752d535ff49f4860c0f341d1baeb6faf0f4242170" +checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f" dependencies = [ "proc-macro2", "quote", @@ -547,9 +547,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.127" +version = "1.0.128" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8043c06d9f82bd7271361ed64f415fe5e12a77fdb52e573e7f06a516dea329ad" +checksum = "6ff5456707a1de34e7e37f2a6fd3d3f808c318259cbd01ab6377795054b483d8" dependencies = [ "itoa", "memchr", diff --git a/Cargo.toml b/Cargo.toml index 1efec1b..290dc68 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,7 @@ name = "endsong" version = "0.2.0" authors = ["Filip Tomaśko "] edition = "2021" -rust-version = "1.78" +rust-version = "1.81" description = "Library for getting data from Spotify endsong.json files" readme = "README.md" diff --git a/endsong_ui/Cargo.lock b/endsong_ui/Cargo.lock index 6e99eb8..7f7cf18 100644 --- a/endsong_ui/Cargo.lock +++ b/endsong_ui/Cargo.lock @@ -2,6 +2,19 @@ # It is not intended for manual editing. version = 3 +[[package]] +name = "ahash" +version = "0.8.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" +dependencies = [ + "cfg-if", + "getrandom", + "once_cell", + "version_check", + "zerocopy", +] + [[package]] name = "aho-corasick" version = "1.1.3" @@ -38,52 +51,6 @@ version = "1.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1bec1de6f59aedf83baf9ff929c98f2ad654b97c9510f4e70cf6f661d49fd5b1" -[[package]] -name = "askama" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b79091df18a97caea757e28cd2d5fda49c6cd4bd01ddffd7ff01ace0c0ad2c28" -dependencies = [ - "askama_derive", - "askama_escape", - "humansize", - "num-traits", - "percent-encoding", - "serde", - "serde_json", -] - -[[package]] -name = "askama_derive" -version = "0.12.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19fe8d6cb13c4714962c072ea496f3392015f0989b1a2847bb4b2d9effd71d83" -dependencies = [ - "askama_parser", - "basic-toml", - "mime", - "mime_guess", - "proc-macro2", - "quote", - "serde", - "syn", -] - -[[package]] -name = "askama_escape" -version = "0.10.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "619743e34b5ba4e9703bba34deac3427c72507c7159f5fd030aea8cac0cfe341" - -[[package]] -name = "askama_parser" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acb1161c6b64d1c3d83108213c2a2533a342ac225aabd0bda218278c2ddb00c0" -dependencies = [ - "nom", -] - [[package]] name = "autocfg" version = "1.3.0" @@ -131,9 +98,9 @@ checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5" [[package]] name = "cc" -version = "1.1.14" +version = "1.1.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50d2eb3cd3d1bf4529e31c215ee6f93ec5a3d536d9f578f93d9d33ee19562932" +checksum = "a93fe60e2fc87b6ba2c117f67ae14f66e3fc7d6a1e612a25adb238cc980eadb3" dependencies = [ "shlex", ] @@ -194,18 +161,18 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.16" +version = "4.5.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed6719fffa43d0d87e5fd8caeab59be1554fb028cd30edc88fc4369b17971019" +checksum = "3e5a21b8495e732f1b3c364c9949b201ca7bae518c502c80256c96ad79eaf6ac" dependencies = [ "clap_builder", ] [[package]] name = "clap_builder" -version = "4.5.15" +version = "4.5.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "216aec2b177652e3846684cbfe25c9964d18ec45234f0f5da5157b207ed1aab6" +checksum = "8cf2dd12af7a047ad9d6da2b6b249759a22a7abc0f474c1dae1777afa4b21a73" dependencies = [ "anstyle", "clap_lex", @@ -553,9 +520,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.4.0" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93ead53efc7ea8ed3cfb0c79fc8023fbb782a5432b52830b6518941cebe6505c" +checksum = "68b900aa2f7301e21c36462b170ee99994de34dff39a4a6a528e80e7376d07e5" dependencies = [ "equivalent", "hashbrown 0.14.5", @@ -630,6 +597,16 @@ version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" +[[package]] +name = "lock_api" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17" +dependencies = [ + "autocfg", + "scopeguard", +] + [[package]] name = "log" version = "0.4.22" @@ -735,6 +712,18 @@ version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" +[[package]] +name = "once_map" +version = "0.4.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30c7f82d6d446dd295845094f3a76bcdc5e6183b66667334e169f019cd05e5a0" +dependencies = [ + "ahash", + "hashbrown 0.14.5", + "parking_lot", + "stable_deref_trait", +] + [[package]] name = "oorandom" version = "11.1.4" @@ -747,6 +736,29 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" +[[package]] +name = "parking_lot" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1bf18183cf54e8d6059647fc3063646a1801cf30896933ec2311622cc4b9a27" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "smallvec", + "windows-targets", +] + [[package]] name = "percent-encoding" version = "2.3.1" @@ -761,16 +773,16 @@ checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02" [[package]] name = "plotly" -version = "0.9.0" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25b8fd16c14ce31e4d48a31970530c2e3152b965e8567469e292712af7c9536f" +checksum = "d944e5f68193cb484fa63cfff0b22e5d1c2773221ff242f30d18645873fbdbfa" dependencies = [ - "askama", "dyn-clone", "erased-serde", "once_cell", "plotly_derive", "rand", + "rinja", "serde", "serde_json", "serde_repr", @@ -779,9 +791,9 @@ dependencies = [ [[package]] name = "plotly_derive" -version = "0.9.0" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7817cbbd497db67dc5d21206fd0f4cab0cd6974b6fd2791f012c5455245b0e65" +checksum = "dd8a29f91d6bfbba26a2ad35baecd507f59b87dacfdf90c21c04404e621e5d78" dependencies = [ "darling", "proc-macro2", @@ -910,6 +922,15 @@ dependencies = [ "crossbeam-utils", ] +[[package]] +name = "redox_syscall" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a908a6e00f1fdd0dfd9c0eb08ce85126f6d8bbda50017e74bc4a4b7d4a926a4" +dependencies = [ + "bitflags", +] + [[package]] name = "regex" version = "1.10.6" @@ -954,11 +975,62 @@ version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b" +[[package]] +name = "rinja" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5bf96e290b3578af4ca20699abca2b90d5aba9eeae4acd123fd83c8547165eb4" +dependencies = [ + "humansize", + "itoa", + "num-traits", + "percent-encoding", + "rinja_derive", + "serde", + "serde_json", +] + +[[package]] +name = "rinja_derive" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2fa31df46c7a8c125cfe8ec5f0b1d2689b65d4652fd8de9bf0ac41d6e0ac68f3" +dependencies = [ + "basic-toml", + "memchr", + "mime", + "mime_guess", + "once_map", + "proc-macro2", + "quote", + "rinja_parser", + "rustc-hash", + "serde", + "syn", +] + +[[package]] +name = "rinja_parser" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ee3ef25da2517861878f58ecbd7b8ba6bebd5634fe1b4421df20d100fb75745" +dependencies = [ + "memchr", + "nom", + "serde", +] + +[[package]] +name = "rustc-hash" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "583034fd73374156e66797ed8e5b0d5690409c9226b22d87cb7f19821c05d152" + [[package]] name = "rustix" -version = "0.38.34" +version = "0.38.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f" +checksum = "3f55e80d50763938498dd5ebb18647174e0c76dc38c5505294bb224624f30f36" dependencies = [ "bitflags", "errno", @@ -1016,20 +1088,26 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + [[package]] name = "serde" -version = "1.0.209" +version = "1.0.210" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99fce0ffe7310761ca6bf9faf5115afbc19688edd00171d81b1bb1b116c63e09" +checksum = "c8e3592472072e6e22e0a54d5904d9febf8508f65fb8552499a1abc7d1078c3a" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.209" +version = "1.0.210" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5831b979fd7b5439637af1752d535ff49f4860c0f341d1baeb6faf0f4242170" +checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f" dependencies = [ "proc-macro2", "quote", @@ -1038,9 +1116,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.127" +version = "1.0.128" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8043c06d9f82bd7271361ed64f415fe5e12a77fdb52e573e7f06a516dea329ad" +checksum = "6ff5456707a1de34e7e37f2a6fd3d3f808c318259cbd01ab6377795054b483d8" dependencies = [ "itoa", "memchr", @@ -1069,7 +1147,7 @@ dependencies = [ "chrono", "hex", "indexmap 1.9.3", - "indexmap 2.4.0", + "indexmap 2.5.0", "serde", "serde_derive", "serde_json", @@ -1116,6 +1194,12 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b7c388c1b5e93756d0c740965c41e8822f866621d41acbdf6336a6a168f8840c" +[[package]] +name = "stable_deref_trait" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" + [[package]] name = "strsim" version = "0.11.1" @@ -1124,9 +1208,9 @@ checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" [[package]] name = "syn" -version = "2.0.76" +version = "2.0.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "578e081a14e0cefc3279b0472138c513f37b41a08d5a3cca9b6e4e8ceb6cd525" +checksum = "9f35bcdf61fd8e7be6caf75f429fdca8beb3ed76584befb503b1569faee373ed" dependencies = [ "proc-macro2", "quote", diff --git a/endsong_ui/endsong_macros/Cargo.lock b/endsong_ui/endsong_macros/Cargo.lock index aaec347..87d3e20 100644 --- a/endsong_ui/endsong_macros/Cargo.lock +++ b/endsong_ui/endsong_macros/Cargo.lock @@ -30,9 +30,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.76" +version = "2.0.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "578e081a14e0cefc3279b0472138c513f37b41a08d5a3cca9b6e4e8ceb6cd525" +checksum = "9f35bcdf61fd8e7be6caf75f429fdca8beb3ed76584befb503b1569faee373ed" dependencies = [ "proc-macro2", "quote", diff --git a/endsong_ui/src/lib.rs b/endsong_ui/src/lib.rs index 8cdd9ae..5b49c44 100644 --- a/endsong_ui/src/lib.rs +++ b/endsong_ui/src/lib.rs @@ -7,7 +7,7 @@ // unsafe code is bad #![deny(unsafe_code)] // can be a pain, but it's worth it -// for stupid suggestions use #[allow(clippy::...)] +// don't forget to use #[expect(clippy::...)] when sensible #![warn(clippy::pedantic)] // because I want to be explicit when cloning is cheap #![warn(clippy::clone_on_ref_ptr)] @@ -17,6 +17,9 @@ // https://doc.rust-lang.org/rustdoc/lints.html // other good ones are warn by default #![warn(rustdoc::missing_crate_level_docs, rustdoc::unescaped_backticks)] +// https://blog.rust-lang.org/2024/09/05/Rust-1.81.0.html#expectlint +#![warn(clippy::allow_attributes_without_reason)] +#![warn(clippy::allow_attributes)] pub mod plot; pub mod print; diff --git a/endsong_ui/src/print.rs b/endsong_ui/src/print.rs index 4eaba56..e48c703 100644 --- a/endsong_ui/src/print.rs +++ b/endsong_ui/src/print.rs @@ -329,7 +329,7 @@ pub fn aspect_date( } /// Prints the total time played -#[allow(clippy::missing_panics_doc)] +#[expect(clippy::missing_panics_doc, reason = "unwrap fine")] pub fn time_played(entries: &SongEntries) { time_played_date( entries, @@ -345,7 +345,8 @@ pub fn time_played(entries: &SongEntries) { /// # Panics /// /// Panics if `start` is after or equal to `end` -#[allow(clippy::cast_precision_loss, clippy::cast_possible_wrap)] +#[expect(clippy::cast_precision_loss, reason = "casting i64 to f64")] +#[expect(clippy::cast_possible_wrap, reason = "casting usize to i64")] pub fn time_played_date(entries: &SongEntries, start: &DateTime, end: &DateTime) { assert!(start <= end, "Start date is after end date!"); let duration = gather::listening_time(entries.between(start, end)); diff --git a/endsong_ui/src/trace.rs b/endsong_ui/src/trace.rs index f47470c..1a9c678 100644 --- a/endsong_ui/src/trace.rs +++ b/endsong_ui/src/trace.rs @@ -5,7 +5,7 @@ use plotly::{Scatter, Trace}; /// Wrapper to use instead of [`Box`][plotly::Trace] /// to access internal methods -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions, reason = "no better name")] pub enum TraceType { /// trace of absolute amount of plays Absolute(Box>), diff --git a/endsong_ui/src/ui/mod.rs b/endsong_ui/src/ui/mod.rs index 1b8a0d7..c6fe735 100644 --- a/endsong_ui/src/ui/mod.rs +++ b/endsong_ui/src/ui/mod.rs @@ -218,7 +218,7 @@ fn string_vec(slice: &[&str]) -> Vec> { } /// Starts the CLI/shell instance -#[allow(clippy::missing_panics_doc)] +#[expect(clippy::missing_panics_doc, reason = "unwrap fine")] pub fn start(entries: &SongEntries) { println!("=== INTERACTIVE MODE ACTIVATED ==="); println!("PRESS 'CTRL+C' TO EXIT THE PROGRAM"); diff --git a/src/entry.rs b/src/entry.rs index 397036f..8da740a 100644 --- a/src/entry.rs +++ b/src/entry.rs @@ -38,7 +38,7 @@ use parse::{parse, ParseError}; /// /// Contains the relevant metadata of each entry song entry in endsong.json #[derive(Clone, Debug)] -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions, reason = "good name")] pub struct SongEntry { /// the time at which the song has been played pub timestamp: DateTime, @@ -149,7 +149,7 @@ impl SongEntries { /// /// [issue #65]: https://github.com/fsktom/rusty-endsong-parser/issues/65 #[must_use] - #[allow(clippy::missing_panics_doc)] + #[expect(clippy::missing_panics_doc, reason = "unwrap fine")] pub fn sum_different_capitalization(mut self) -> Self { info!("Summing up different capitalization..."); diff --git a/src/lib.rs b/src/lib.rs index 79e2532..5de73b2 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -3,7 +3,7 @@ // unsafe code is bad #![deny(unsafe_code)] // can be a pain, but it's worth it -// for stupid suggestions use #[allow(clippy::...)] +// don't forget to use #[expect(clippy::...)] when sensible #![warn(clippy::pedantic)] // because I want to be explicit when cloning is cheap #![warn(clippy::clone_on_ref_ptr)] @@ -13,6 +13,9 @@ // https://doc.rust-lang.org/rustdoc/lints.html // other good ones are warn by default #![warn(rustdoc::missing_crate_level_docs, rustdoc::unescaped_backticks)] +// https://blog.rust-lang.org/2024/09/05/Rust-1.81.0.html#expectlint +#![warn(clippy::allow_attributes_without_reason)] +#![warn(clippy::allow_attributes)] pub mod aspect; pub mod entry; @@ -114,7 +117,7 @@ pub fn parse_date(date: &str) -> Result, chrono::format::ParseEr /// and then the name alphabetically /// /// Use with maps gotten through [`gather`] functions -#[allow(clippy::implicit_hasher)] +#[expect(clippy::implicit_hasher, reason = "uniform HashMap across crate")] #[must_use] pub fn get_sorted_list(map: HashMap) -> Vec { map.into_iter() @@ -127,7 +130,7 @@ pub fn get_sorted_list(map: HashMap) -> Vec { /// and then the name alphabetically /// /// Use with maps gotten through [`gather`] functions -#[allow(clippy::implicit_hasher)] +#[expect(clippy::implicit_hasher, reason = "uniform HashMap across crate")] #[must_use] pub fn get_sorted_ref_list(map: &HashMap) -> Vec<&Asp> { map.iter() diff --git a/src/parse.rs b/src/parse.rs index 5ed01bd..3e733bf 100644 --- a/src/parse.rs +++ b/src/parse.rs @@ -29,7 +29,7 @@ enum SingleParseError { /// Errors that can occur when parsing the endsong.json files #[derive(Error, Debug)] -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions, reason = "no better name")] pub enum ParseError { /// Used when serde deserialization fails #[error("Error while parsing {1}: {0}")]