From fabd57033dbbf79d463fc3129c9cc4a109280cab Mon Sep 17 00:00:00 2001 From: Sergei Blinov Date: Thu, 5 Oct 2023 21:34:19 +0200 Subject: [PATCH] lint + fmt (#5) --- .github/workflows/rust.yml | 11 +++++------ .../src/cargo_components/helper.rs | 5 ++--- clippy.toml | 2 +- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 8891d24..2d84723 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -11,12 +11,11 @@ env: jobs: build: - runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - name: Build - run: cargo build --verbose - - name: Run tests - run: cargo test --verbose + - uses: actions/checkout@v3 + - name: Build + run: cargo build --verbose + - name: Run tests + run: cargo test --verbose diff --git a/anytree-plugin-cargo-dependencies/src/cargo_components/helper.rs b/anytree-plugin-cargo-dependencies/src/cargo_components/helper.rs index 461f3e8..32a88d9 100644 --- a/anytree-plugin-cargo-dependencies/src/cargo_components/helper.rs +++ b/anytree-plugin-cargo-dependencies/src/cargo_components/helper.rs @@ -25,13 +25,12 @@ pub fn name_to_index_path(crate_name: &str) -> String { 1 => format!("1/{}", crate_name), 2 => format!("2/{}", crate_name), 3 => { - let mut first_char = crate_name.clone().to_string(); + let mut first_char = crate_name.to_string(); first_char.truncate(1); format!("3/{}/{}", first_char, crate_name) } _ => { - let mut header_iter = - crate_name.clone().as_bytes().chunks(2).map(String::from_utf8_lossy); + let mut header_iter = crate_name.as_bytes().chunks(2).map(String::from_utf8_lossy); format!( "{}/{}/{}", header_iter.next().unwrap(), diff --git a/clippy.toml b/clippy.toml index 75120de..81b249b 100644 --- a/clippy.toml +++ b/clippy.toml @@ -18,7 +18,7 @@ disallowed-methods = [ "std::env::temp_dir", # Use the tempdir crate instead # There are many things that aren"t allowed on wasm, # but we cannot disable them all here (because of e.g. https://github.com/rust-lang/rust-clippy/issues/10406) # so we do that in `clipppy_wasm.toml` instead. - "std::thread::spawn", # Use `std::thread::Builder` and name the thread + "std::thread::spawn", # Use `std::thread::Builder` and name the thread ## INFO: in anytree project we have to use this algo anyway # "sha1::Digest::new", # SHA1 is cryptographically broken "std::panic::catch_unwind", # We compile with `panic = "abort"`