From c817c3b8897863cc1a352ee654fa424469a903ec Mon Sep 17 00:00:00 2001 From: hinto-janai Date: Thu, 16 Jan 2025 10:43:42 -0500 Subject: [PATCH 1/2] workspace: Rust 1.84 (#363) * apply * ci: use stable rust for rustfmt --- .github/workflows/ci.yml | 15 +++++++++------ Cargo.toml | 5 ++++- clippy.toml | 3 ++- constants/build.rs | 2 +- rpc/json-rpc/src/version.rs | 4 ++-- storage/database/src/config/config.rs | 5 +---- 6 files changed, 19 insertions(+), 15 deletions(-) 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`]. From 6320411f60f0612da1ce6ad1ea0c353844720d5b Mon Sep 17 00:00:00 2001 From: hinto-janai Date: Thu, 16 Jan 2025 11:31:55 -0500 Subject: [PATCH 2/2] ci: stable Rust for `deny`, remove `boost` dep for docs (#364) * doc.yml: remove boost dep * deny.yml: install stable rust --- .github/workflows/deny.yml | 7 +++++++ .github/workflows/doc.yml | 6 ------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/workflows/deny.yml b/.github/workflows/deny.yml index 2ff2b6f..497097d 100644 --- a/.github/workflows/deny.yml +++ b/.github/workflows/deny.yml @@ -25,9 +25,16 @@ jobs: ~/.cargo target key: deny + + - name: Install Rust + uses: dtolnay/rust-toolchain@master + with: + toolchain: stable + - uses: actions/checkout@v4 with: submodules: recursive + - name: Install dependencies run: cargo install cargo-deny --locked - name: Deny diff --git a/.github/workflows/doc.yml b/.github/workflows/doc.yml index 8ed932a..c317e2b 100644 --- a/.github/workflows/doc.yml +++ b/.github/workflows/doc.yml @@ -40,12 +40,6 @@ jobs: path: target/debug key: doc - # Packages other than `Boost` used by `Monero` are listed here. - # https://github.com/monero-project/monero/blob/c444a7e002036e834bfb4c68f04a121ce1af5825/.github/workflows/build.yml#L71 - - - name: Install dependencies (Linux) - run: sudo apt install -y libboost-dev - - name: Documentation run: cargo +nightly doc --workspace --all-features