diff --git a/Cargo.toml b/Cargo.toml --- a/Cargo.toml +++ b/Cargo.toml @@ -18,4 +18,4 @@ ] [workspace.package] -rust-version = "1.72.0" +rust-version = "1.76.0" diff --git a/chronik/CMakeLists.txt b/chronik/CMakeLists.txt --- a/chronik/CMakeLists.txt +++ b/chronik/CMakeLists.txt @@ -11,10 +11,11 @@ ) FetchContent_MakeAvailable(Corrosion) -set(REQUIRED_RUST_VERSION "1.72.0") +set(REQUIRED_RUST_VERSION "1.76.0") if(Rust_VERSION VERSION_LESS REQUIRED_RUST_VERSION) message(FATAL_ERROR "Minimum required Rust version is " - "${REQUIRED_RUST_VERSION}, but found ${Rust_VERSION}") + "${REQUIRED_RUST_VERSION}, but found ${Rust_VERSION}. " + "Use `rustup update stable` to update.") endif() set(CARGO_BUILD_DIR "${CMAKE_BINARY_DIR}/cargo/build") diff --git a/chronik/bitcoinsuite-slp/src/color.rs b/chronik/bitcoinsuite-slp/src/color.rs --- a/chronik/bitcoinsuite-slp/src/color.rs +++ b/chronik/bitcoinsuite-slp/src/color.rs @@ -192,7 +192,7 @@ impl ColoredTx { /// Parse the OP_RETURN of the tx and color its outputs pub fn color_tx(tx: &Tx) -> Option { - let op_return = match tx.outputs.get(0) { + let op_return = match tx.outputs.first() { Some(output) if output.script.is_opreturn() => &output.script, _ => return None, }; diff --git a/chronik/bitcoinsuite-slp/src/verify.rs b/chronik/bitcoinsuite-slp/src/verify.rs --- a/chronik/bitcoinsuite-slp/src/verify.rs +++ b/chronik/bitcoinsuite-slp/src/verify.rs @@ -234,7 +234,7 @@ if section.meta.token_type == TokenType::Slp(SlpTokenType::Nft1Child) => { - match self.spent_tokens.get(0) { + match self.spent_tokens.first() { Some(Some(spent_token)) if spent_token.token.meta.token_type == TokenType::Slp(SlpTokenType::Nft1Group) diff --git a/chronik/chronik-db/src/io/spent_by.rs b/chronik/chronik-db/src/io/spent_by.rs --- a/chronik/chronik-db/src/io/spent_by.rs +++ b/chronik/chronik-db/src/io/spent_by.rs @@ -230,10 +230,7 @@ tx_num: tx.tx_num, input_idx: input_idx as u32, }; - spent_by_map - .entry(input_tx_num) - .or_insert(vec![]) - .push(spent_by); + spent_by_map.entry(input_tx_num).or_default().push(spent_by); } } for (tx_num, entries) in spent_by_map { diff --git a/chronik/chronik-db/src/io/token/batch.rs b/chronik/chronik-db/src/io/token/batch.rs --- a/chronik/chronik-db/src/io/token/batch.rs +++ b/chronik/chronik-db/src/io/token/batch.rs @@ -212,7 +212,7 @@ } // Add new tokens from GENESIS txs - if let Some(entry) = valid_tx.entries.get(0) { + if let Some(entry) = valid_tx.entries.first() { // Skip invalid GENESIS txs if !entry.is_invalid { if let Some(info) = &entry.genesis_info { @@ -255,7 +255,7 @@ let mut flags = 0; if is_mint_vault_mint { - let first_entry = valid_tx.entries.get(0); + let first_entry = valid_tx.entries.first(); let has_mint_vault = first_entry.map_or(false, |entry| !entry.is_invalid); if has_mint_vault { diff --git a/contrib/gitian-descriptors/gitian-linux.yml b/contrib/gitian-descriptors/gitian-linux.yml --- a/contrib/gitian-descriptors/gitian-linux.yml +++ b/contrib/gitian-descriptors/gitian-linux.yml @@ -177,7 +177,7 @@ curl -sSf https://static.rust-lang.org/rustup/archive/1.26.0/x86_64-unknown-linux-gnu/rustup-init -o rustup-init echo "0b2f6c8f85a3d02fde2efc0ced4657869d73fccfce59defb4e8d29233116e6db rustup-init" | sha256sum -c chmod +x rustup-init - ./rustup-init -y --default-toolchain=1.72.0 + ./rustup-init -y --default-toolchain=1.76.0 # Rust target name differs from our host name, let's map declare -A RUST_TARGET diff --git a/contrib/utils/install-dependencies-bullseye.sh b/contrib/utils/install-dependencies-bullseye.sh --- a/contrib/utils/install-dependencies-bullseye.sh +++ b/contrib/utils/install-dependencies-bullseye.sh @@ -167,11 +167,11 @@ # Install nyc for mocha unit test reporting npm i -g nyc -# Install Rust stable 1.72.0 and nightly from the 2023-12-29 +# Install Rust stable 1.76.0 and nightly from the 2023-12-29 curl -sSf https://static.rust-lang.org/rustup/archive/1.26.0/x86_64-unknown-linux-gnu/rustup-init -o rustup-init echo "0b2f6c8f85a3d02fde2efc0ced4657869d73fccfce59defb4e8d29233116e6db rustup-init" | sha256sum -c chmod +x rustup-init -./rustup-init -y --default-toolchain=1.72.0 +./rustup-init -y --default-toolchain=1.76.0 RUST_HOME="${HOME}/.cargo/bin" RUST_NIGHTLY_DATE=2023-12-29 "${RUST_HOME}/rustup" install nightly-${RUST_NIGHTLY_DATE}