diff --git a/.github/actions/ci-rust-setup/action.yml b/.github/actions/ci-rust-setup/action.yml index 03b548bb..39fc10da 100644 --- a/.github/actions/ci-rust-setup/action.yml +++ b/.github/actions/ci-rust-setup/action.yml @@ -33,8 +33,8 @@ runs: echo "toolchain=\"${RUST_TOOLCHAIN}\"" >> $GITHUB_OUTPUT - name: Install ${{ steps.gettoolchain.outputs.toolchain }} Rust toolchain id: toolchain - # Commit date is Sep 19, 2023 - uses: dtolnay/rust-toolchain@439cf607258077187679211f12aa6f19af4a0af7 + # Commit date is Nov 18, 2024 + uses: dtolnay/rust-toolchain@315e265cd78dad1e1dcf3a5074f6d6c47029d5aa with: toolchain: ${{ steps.gettoolchain.outputs.toolchain }} targets: ${{ inputs.targets }} diff --git a/rust-toolchain b/rust-toolchain index d456f745..74c280fb 100644 --- a/rust-toolchain +++ b/rust-toolchain @@ -1 +1 @@ -1.80 +1.83 diff --git a/src/new_index/db.rs b/src/new_index/db.rs index 98de2d30..b52ec136 100644 --- a/src/new_index/db.rs +++ b/src/new_index/db.rs @@ -23,7 +23,7 @@ pub struct ScanIterator<'a> { done: bool, } -impl<'a> Iterator for ScanIterator<'a> { +impl Iterator for ScanIterator<'_> { type Item = DBRow; fn next(&mut self) -> Option { @@ -48,7 +48,7 @@ pub struct ReverseScanIterator<'a> { done: bool, } -impl<'a> Iterator for ReverseScanIterator<'a> { +impl Iterator for ReverseScanIterator<'_> { type Item = DBRow; fn next(&mut self) -> Option { @@ -84,7 +84,7 @@ impl<'a> ReverseScanGroupIterator<'a> { pub fn new( mut iters: Vec>, value_offset: usize, - ) -> ReverseScanGroupIterator { + ) -> ReverseScanGroupIterator<'a> { let mut next_rows: Vec> = Vec::with_capacity(iters.len()); for iter in &mut iters { let next = iter.next(); @@ -100,7 +100,7 @@ impl<'a> ReverseScanGroupIterator<'a> { } } -impl<'a> Iterator for ReverseScanGroupIterator<'a> { +impl Iterator for ReverseScanGroupIterator<'_> { type Item = DBRow; fn next(&mut self) -> Option { diff --git a/src/new_index/mempool.rs b/src/new_index/mempool.rs index 32d27c1f..7d5d3406 100644 --- a/src/new_index/mempool.rs +++ b/src/new_index/mempool.rs @@ -387,7 +387,7 @@ impl Mempool { } pub fn unique_txids(&self) -> HashSet { - return HashSet::from_iter(self.txstore.keys().cloned()); + HashSet::from_iter(self.txstore.keys().cloned()) } pub fn update(mempool: &RwLock, daemon: &Daemon) -> Result<()> { diff --git a/src/rest.rs b/src/rest.rs index 8cdec5d1..3dcbcac6 100644 --- a/src/rest.rs +++ b/src/rest.rs @@ -838,9 +838,7 @@ fn handle_request( .get_block_txids(&hash) .ok_or_else(|| HttpError::not_found("Block not found".to_string()))?; - let start_index = start_index - .map_or(0u32, |el| el.parse().unwrap_or(0)) - .max(0u32) as usize; + let start_index = start_index.map_or(0u32, |el| el.parse().unwrap_or(0)) as usize; if start_index >= txids.len() { bail!(HttpError::not_found("start index out of range".to_string())); } else if start_index % config.rest_default_chain_txs_per_page != 0 { diff --git a/src/util/block.rs b/src/util/block.rs index 66d5a5c5..ff5c1223 100644 --- a/src/util/block.rs +++ b/src/util/block.rs @@ -203,9 +203,8 @@ impl HeaderList { } pub fn header_by_height(&self, height: usize) -> Option<&HeaderEntry> { - self.headers.get(height).map(|entry| { + self.headers.get(height).inspect(|entry| { assert_eq!(entry.height(), height); - entry }) } diff --git a/src/util/mod.rs b/src/util/mod.rs index 22775911..b7c7de4f 100644 --- a/src/util/mod.rs +++ b/src/util/mod.rs @@ -198,7 +198,7 @@ pub mod serde_hex { use serde::de::Error; use serde::{Deserializer, Serializer}; - pub fn serialize(b: &Vec, s: S) -> Result { + pub fn serialize(b: &[u8], s: S) -> Result { s.serialize_str(&b.to_hex()) }