From ca7c0c5c09f6e6a89e054e737c3f0634932aefb5 Mon Sep 17 00:00:00 2001 From: kjuulh Date: Sun, 24 Sep 2023 22:10:38 +0200 Subject: [PATCH] feat: clippy Signed-off-by: kjuulh --- crates/crunch-cli/src/main.rs | 2 +- crates/crunch-codegen/src/lib.rs | 6 +++--- crates/crunch/examples/basic.rs | 2 +- crates/crunch/examples/counter.rs | 2 +- examples/basic-setup/src/gencrunch/mod.rs | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/crates/crunch-cli/src/main.rs b/crates/crunch-cli/src/main.rs index aa17db9..26ede48 100644 --- a/crates/crunch-cli/src/main.rs +++ b/crates/crunch-cli/src/main.rs @@ -1,6 +1,6 @@ mod logging; -use std::path::{Path, PathBuf}; +use std::path::{PathBuf}; use anyhow::anyhow; use clap::{Args, Parser, Subcommand}; diff --git a/crates/crunch-codegen/src/lib.rs b/crates/crunch-codegen/src/lib.rs index a7d8fb5..a560b78 100644 --- a/crates/crunch-codegen/src/lib.rs +++ b/crates/crunch-codegen/src/lib.rs @@ -32,7 +32,7 @@ impl Node { let file_name_content = file_name_content.file_stem().unwrap(); let file_name_content = file_name_content.to_string_lossy().to_lowercase(); - let segments = file_name_content.split(".").collect::>(); + let segments = file_name_content.split('.').collect::>(); for (i, segment) in segments.iter().enumerate() { node = node.children.entry(segment.to_string()).or_insert_with(|| { Node::new( @@ -214,10 +214,10 @@ impl Codegen { let result: anyhow::Result<()> = handle.await?; result?; - let mut output_paths = self.discover_files(&out_tempdir_path, "rs")?; + let mut output_paths = self.discover_files(out_tempdir_path, "rs")?; let mod_path = self - .generate_mod_file(&out_tempdir_path, &output_paths) + .generate_mod_file(out_tempdir_path, &output_paths) .await?; output_paths.push(mod_path); diff --git a/crates/crunch/examples/basic.rs b/crates/crunch/examples/basic.rs index 88ecd97..2c94b55 100644 --- a/crates/crunch/examples/basic.rs +++ b/crates/crunch/examples/basic.rs @@ -37,7 +37,7 @@ impl crunch::traits::Event for SomeEvent { async fn main() -> anyhow::Result<()> { tracing_subscriber::fmt::init(); - let crunch = crunch::builder::Builder::default().build()?; + let crunch = crunch::Builder::default().build()?; crunch .subscribe(move |item: SomeEvent| async move { tracing::info!( diff --git a/crates/crunch/examples/counter.rs b/crates/crunch/examples/counter.rs index 1d96307..7e3fc6b 100644 --- a/crates/crunch/examples/counter.rs +++ b/crates/crunch/examples/counter.rs @@ -37,7 +37,7 @@ impl crunch::traits::Event for SomeEvent { async fn main() -> anyhow::Result<()> { tracing_subscriber::fmt::init(); - let crunch = crunch::builder::Builder::default().build()?; + let crunch = crunch::Builder::default().build()?; let counter = std::sync::Arc::new(std::sync::atomic::AtomicUsize::new(0)); let inner_counter = counter.clone(); diff --git a/examples/basic-setup/src/gencrunch/mod.rs b/examples/basic-setup/src/gencrunch/mod.rs index 753a440..2c69f05 100644 --- a/examples/basic-setup/src/gencrunch/mod.rs +++ b/examples/basic-setup/src/gencrunch/mod.rs @@ -13,7 +13,7 @@ pub mod basic { where Self: Sized, { - let output = Self::decode(raw.as_slice()).map_err(|e| ::crunch::errors::DeserializeError::ProtoErr(e))?; + let output = Self::decode(raw.as_slice()).map_err(::crunch::errors::DeserializeError::ProtoErr)?; Ok(output) } } @@ -42,7 +42,7 @@ pub mod basic { where Self: Sized, { - let output = Self::decode(raw.as_slice()).map_err(|e| ::crunch::errors::DeserializeError::ProtoErr(e))?; + let output = Self::decode(raw.as_slice()).map_err(::crunch::errors::DeserializeError::ProtoErr)?; Ok(output) } }