diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9b9a177..5ff98d6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -29,12 +29,15 @@ jobs: fmt: runs-on: ubuntu-latest steps: - - name: Checkout - uses: actions/checkout@v4 - with: - submodules: recursive - - name: Format - run: cargo fmt --all --check + - name: Checkout + uses: actions/checkout@v4 + - name: Install Rust + uses: dtolnay/rust-toolchain@master + with: + toolchain: stable + components: rustfmt + - name: Format + run: cargo fmt --all --check # Run typo checker separately. # This will fast-cancel other CI early if this fails. diff --git a/Cargo.toml b/Cargo.toml index 1813057..792bded 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,5 @@ [workspace] -resolver = "2" +resolver = "3" members = [ # Binaries "binaries/cuprated", @@ -284,6 +284,9 @@ zero_repeat_side_effects = "deny" non_zero_suggestions = "deny" manual_is_power_of_two = "deny" used_underscore_items = "deny" +unnecessary_map_or = "deny" +map_all_any_identity = "deny" +unnecessary_literal_bound = "deny" # Warm cast_possible_truncation = "deny" diff --git a/clippy.toml b/clippy.toml index cc94ec5..e20b56d 100644 --- a/clippy.toml +++ b/clippy.toml @@ -1 +1,2 @@ -upper-case-acronyms-aggressive = true +# +upper-case-acronyms-aggressive = true \ No newline at end of file diff --git a/constants/build.rs b/constants/build.rs index a680714..518f2a3 100644 --- a/constants/build.rs +++ b/constants/build.rs @@ -24,7 +24,7 @@ fn set_commit_env() { .to_lowercase(); // Commit hash should always be 40 bytes long. - assert_eq!(commit.as_bytes().len(), 40); + assert_eq!(commit.len(), 40); println!("cargo:rustc-env=COMMIT={commit}"); } diff --git a/rpc/json-rpc/src/version.rs b/rpc/json-rpc/src/version.rs index 30e507a..4323700 100644 --- a/rpc/json-rpc/src/version.rs +++ b/rpc/json-rpc/src/version.rs @@ -82,13 +82,13 @@ impl Serialize for Version { impl std::fmt::Display for Version { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(f, r#"{}"#, Self::TWO) + write!(f, "{}", Self::TWO) } } impl std::fmt::Debug for Version { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(f, r#"{}"#, Self::TWO) + write!(f, "{}", Self::TWO) } } diff --git a/storage/database/src/config/config.rs b/storage/database/src/config/config.rs index 8a4ddbf..e245444 100644 --- a/storage/database/src/config/config.rs +++ b/storage/database/src/config/config.rs @@ -15,10 +15,7 @@ use crate::{config::SyncMode, constants::DATABASE_DATA_FILENAME, resize::ResizeA /// use cuprate_database::config::*; /// assert_eq!(READER_THREADS_DEFAULT.get(), 126); /// ``` -pub const READER_THREADS_DEFAULT: NonZeroUsize = match NonZeroUsize::new(126) { - Some(n) => n, - None => unreachable!(), -}; +pub const READER_THREADS_DEFAULT: NonZeroUsize = NonZeroUsize::new(126).unwrap(); //---------------------------------------------------------------------------------------------------- ConfigBuilder /// Builder for [`Config`].