From 3173029f5a414873e98f6f69df6b62474850c19f Mon Sep 17 00:00:00 2001 From: "Reid \"reidlab" Date: Sun, 8 Dec 2024 18:35:27 -0800 Subject: [PATCH] lint --- .editorconfig | 4 +++- .gitignore | 2 +- README.md | 2 +- flake.nix | 4 ++-- src/config.rs | 4 ++-- src/lastfm.rs | 2 +- src/main.rs | 2 +- src/main_loop.rs | 2 +- src/player.rs | 2 +- src/track.rs | 2 +- 10 files changed, 14 insertions(+), 12 deletions(-) diff --git a/.editorconfig b/.editorconfig index 3e71bac..263e3ee 100644 --- a/.editorconfig +++ b/.editorconfig @@ -4,6 +4,8 @@ root = true end_of_line = lf indent_style = space indent_size = 4 +insert_final_newline = true +trim_trailing_whitespace = true [*.nix] -indent_size = 2 \ No newline at end of file +indent_size = 2 diff --git a/.gitignore b/.gitignore index 1d5f606..46087c4 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ /target /result -.env \ No newline at end of file +.env diff --git a/README.md b/README.md index ff10b86..158cf46 100644 --- a/README.md +++ b/README.md @@ -73,4 +73,4 @@ you also have the option to define your mpris bus name, which will instead wait ```sh cargo build --release - ``` \ No newline at end of file + ``` diff --git a/flake.nix b/flake.nix index 933a91c..c69eaea 100644 --- a/flake.nix +++ b/flake.nix @@ -20,7 +20,7 @@ cargo = toolchain; rustc = toolchain; }; - in + in rec { packages = flake-utils.lib.flattenTree rec { default = lastfmpris; @@ -32,7 +32,7 @@ # very scuffed but endorsed! #cargoSha256 = "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="; cargoSha256 = "sha256-KOMEvg3iGjmMEFxsrIqD4SaDw63ojiNNNqCfzRlbYLw="; - + nativeBuildInputs = with pkgs; [ pkg-config ]; buildInputs = with pkgs; [ openssl dbus ]; diff --git a/src/config.rs b/src/config.rs index db7bed6..2b7d9b1 100644 --- a/src/config.rs +++ b/src/config.rs @@ -43,7 +43,7 @@ pub fn load_config() -> Result { .open(&path) .context("failed to create config file")?; - // write into the config file with the example configuration + // write into the config file with the example configuration // we put inside the base working directory for the project file.write_all(include_str!("../config.example.ini").as_bytes()) .context("failed to write boilerplate config")?; @@ -59,4 +59,4 @@ pub fn load_config() -> Result { .context("failed to deserialize ini into a readable format")?; Ok(config) -} \ No newline at end of file +} diff --git a/src/lastfm.rs b/src/lastfm.rs index 0e009ad..316c000 100644 --- a/src/lastfm.rs +++ b/src/lastfm.rs @@ -12,4 +12,4 @@ pub fn get_scrobbler(config: &Config) -> Result { info!(" successfully authenticated"); return Ok(scrobbler); -} \ No newline at end of file +} diff --git a/src/main.rs b/src/main.rs index 033f331..a7147ae 100644 --- a/src/main.rs +++ b/src/main.rs @@ -29,4 +29,4 @@ fn main() -> Result<()> { main_loop::start(&config, scrobbler)?; Ok(()) -} \ No newline at end of file +} diff --git a/src/main_loop.rs b/src/main_loop.rs index 7b01af0..559db17 100644 --- a/src/main_loop.rs +++ b/src/main_loop.rs @@ -81,7 +81,7 @@ pub fn start(config: &Config, scrobbler: Scrobbler) -> Result<()> { scrobbled_current_song = true } else if length .map(|length| current_play_time >= length) - .unwrap_or(false) + .unwrap_or(false) { current_play_time = Duration::from_secs(0); scrobbled_current_song = false; diff --git a/src/player.rs b/src/player.rs index 4ee1f6b..a277520 100644 --- a/src/player.rs +++ b/src/player.rs @@ -48,4 +48,4 @@ pub fn wait_for_player(config: &Config) -> Result { thread::sleep(INTERVAL); } -} \ No newline at end of file +} diff --git a/src/track.rs b/src/track.rs index 2e9c3f3..bdddb6a 100644 --- a/src/track.rs +++ b/src/track.rs @@ -74,4 +74,4 @@ impl Track { album, } } -} \ No newline at end of file +}