Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump to rust 1.83 and fix lints #110

Open
wants to merge 1 commit into
base: mempool
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/actions/ci-rust-setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.80
1.83
8 changes: 4 additions & 4 deletions src/new_index/db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<DBRow> {
Expand All @@ -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<DBRow> {
Expand Down Expand Up @@ -84,7 +84,7 @@ impl<'a> ReverseScanGroupIterator<'a> {
pub fn new(
mut iters: Vec<ReverseScanIterator<'a>>,
value_offset: usize,
) -> ReverseScanGroupIterator {
) -> ReverseScanGroupIterator<'a> {
let mut next_rows: Vec<Option<DBRow>> = Vec::with_capacity(iters.len());
for iter in &mut iters {
let next = iter.next();
Expand All @@ -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<DBRow> {
Expand Down
2 changes: 1 addition & 1 deletion src/new_index/mempool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ impl Mempool {
}

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

pub fn update(mempool: &RwLock<Mempool>, daemon: &Daemon) -> Result<()> {
Expand Down
4 changes: 1 addition & 3 deletions src/rest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
3 changes: 1 addition & 2 deletions src/util/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
})
}

Expand Down
2 changes: 1 addition & 1 deletion src/util/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ pub mod serde_hex {
use serde::de::Error;
use serde::{Deserializer, Serializer};

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

Expand Down
Loading