Skip to content

Commit dab16f8

Browse files
committed
Bump to rust 1.83 and fix lints
1 parent ad34572 commit dab16f8

File tree

7 files changed

+11
-14
lines changed

7 files changed

+11
-14
lines changed

.github/actions/ci-rust-setup/action.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ runs:
3333
echo "toolchain=\"${RUST_TOOLCHAIN}\"" >> $GITHUB_OUTPUT
3434
- name: Install ${{ steps.gettoolchain.outputs.toolchain }} Rust toolchain
3535
id: toolchain
36-
# Commit date is Sep 19, 2023
37-
uses: dtolnay/rust-toolchain@439cf607258077187679211f12aa6f19af4a0af7
36+
# Commit date is Nov 18, 2024
37+
uses: dtolnay/rust-toolchain@315e265cd78dad1e1dcf3a5074f6d6c47029d5aa
3838
with:
3939
toolchain: ${{ steps.gettoolchain.outputs.toolchain }}
4040
targets: ${{ inputs.targets }}

rust-toolchain

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.80
1+
1.83

src/new_index/db.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ pub struct ScanIterator<'a> {
2323
done: bool,
2424
}
2525

26-
impl<'a> Iterator for ScanIterator<'a> {
26+
impl Iterator for ScanIterator<'_> {
2727
type Item = DBRow;
2828

2929
fn next(&mut self) -> Option<DBRow> {
@@ -48,7 +48,7 @@ pub struct ReverseScanIterator<'a> {
4848
done: bool,
4949
}
5050

51-
impl<'a> Iterator for ReverseScanIterator<'a> {
51+
impl Iterator for ReverseScanIterator<'_> {
5252
type Item = DBRow;
5353

5454
fn next(&mut self) -> Option<DBRow> {
@@ -84,7 +84,7 @@ impl<'a> ReverseScanGroupIterator<'a> {
8484
pub fn new(
8585
mut iters: Vec<ReverseScanIterator<'a>>,
8686
value_offset: usize,
87-
) -> ReverseScanGroupIterator {
87+
) -> ReverseScanGroupIterator<'a> {
8888
let mut next_rows: Vec<Option<DBRow>> = Vec::with_capacity(iters.len());
8989
for iter in &mut iters {
9090
let next = iter.next();
@@ -100,7 +100,7 @@ impl<'a> ReverseScanGroupIterator<'a> {
100100
}
101101
}
102102

103-
impl<'a> Iterator for ReverseScanGroupIterator<'a> {
103+
impl Iterator for ReverseScanGroupIterator<'_> {
104104
type Item = DBRow;
105105

106106
fn next(&mut self) -> Option<DBRow> {

src/new_index/mempool.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ impl Mempool {
387387
}
388388

389389
pub fn unique_txids(&self) -> HashSet<Txid> {
390-
return HashSet::from_iter(self.txstore.keys().cloned());
390+
HashSet::from_iter(self.txstore.keys().cloned())
391391
}
392392

393393
pub fn update(mempool: &RwLock<Mempool>, daemon: &Daemon) -> Result<()> {

src/rest.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -838,9 +838,7 @@ fn handle_request(
838838
.get_block_txids(&hash)
839839
.ok_or_else(|| HttpError::not_found("Block not found".to_string()))?;
840840

841-
let start_index = start_index
842-
.map_or(0u32, |el| el.parse().unwrap_or(0))
843-
.max(0u32) as usize;
841+
let start_index = start_index.map_or(0u32, |el| el.parse().unwrap_or(0)) as usize;
844842
if start_index >= txids.len() {
845843
bail!(HttpError::not_found("start index out of range".to_string()));
846844
} else if start_index % config.rest_default_chain_txs_per_page != 0 {

src/util/block.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,9 +206,8 @@ impl HeaderList {
206206
}
207207

208208
pub fn header_by_height(&self, height: usize) -> Option<&HeaderEntry> {
209-
self.headers.get(height).map(|entry| {
209+
self.headers.get(height).inspect(|entry| {
210210
assert_eq!(entry.height(), height);
211-
entry
212211
})
213212
}
214213

src/util/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ pub mod serde_hex {
198198
use serde::de::Error;
199199
use serde::{Deserializer, Serializer};
200200

201-
pub fn serialize<S: Serializer>(b: &Vec<u8>, s: S) -> Result<S::Ok, S::Error> {
201+
pub fn serialize<S: Serializer>(b: &[u8], s: S) -> Result<S::Ok, S::Error> {
202202
s.serialize_str(&b.to_hex())
203203
}
204204

0 commit comments

Comments
 (0)