enable lints, fix 1.82 clippy

This commit is contained in:
hinto.janai 2024-10-18 17:10:23 -04:00
parent 978d72b6c1
commit 18033cf479
No known key found for this signature in database
GPG key ID: D47CE05FA175A499
6 changed files with 15 additions and 8 deletions

View file

@ -7,8 +7,8 @@ authors = ["SyntheticBird","Boog900"]
[dependencies]
cuprate-consensus-rules = { path = "../rules", features = ["proptest"]}
cuprate-helper = { path = "../../helper", default-features = false, features = ["std", "cast"] }
cuprate-types = { path = "../../types", default-features = false }
cuprate-helper = { path = "../../helper", default-features = false, features = ["std", "cast", "num", "asynch"] }
cuprate-types = { path = "../../types", default-features = false, features = ["blockchain"] }
futures = { workspace = true, features = ["std", "async-await"] }
tokio = { workspace = true, features = ["rt-multi-thread", "macros"]}
@ -22,3 +22,6 @@ randomx-rs = { workspace = true }
rayon = { workspace = true }
thread_local = { workspace = true }
hex = { workspace = true }
[lints]
workspace = true

View file

@ -329,7 +329,7 @@ fn next_difficulty(
}
// TODO: do checked operations here and unwrap so we don't silently overflow?
(windowed_work * hf.block_time().as_secs() as u128 + time_span - 1) / time_span
(windowed_work * u128::from(hf.block_time().as_secs()) + time_span - 1) / time_span
}
/// Get the start and end of the window to calculate difficulty.

View file

@ -3,7 +3,11 @@
//! This crate contains a service to get cached context from the blockchain: [`BlockChainContext`].
//! This is used during contextual validation, this does not have all the data for contextual validation
//! (outputs) for that you will need a [`Database`].
//!
// Used in documentation references for [`BlockChainContextRequest`]
// FIXME: should we pull in a dependency just to link docs?
use monero_serai as _;
use std::{
cmp::min,
collections::HashMap,

View file

@ -11,7 +11,7 @@ proptest = ["cuprate-types/proptest"]
rayon = ["dep:rayon"]
[dependencies]
cuprate-constants = { path = "../../constants", default-features = false }
cuprate-constants = { path = "../../constants", default-features = false, features = ["block"] }
cuprate-helper = { path = "../../helper", default-features = false, features = ["std", "cast"] }
cuprate-types = { path = "../../types", default-features = false }
cuprate-cryptonight = {path = "../../cryptonight"}

View file

@ -63,9 +63,9 @@ where
/// An internal function that returns an iterator or a parallel iterator if the
/// `rayon` feature is enabled.
#[cfg(not(feature = "rayon"))]
fn try_par_iter<T>(t: T) -> impl std::iter::Iterator<Item = T::Item>
fn try_par_iter<T>(t: T) -> impl Iterator<Item = T::Item>
where
T: std::iter::IntoIterator,
T: IntoIterator,
{
t.into_iter()
}

View file

@ -68,7 +68,7 @@ pub fn calculate_block_reward(
.unwrap();
let effective_median_bw: u128 = median_bw.try_into().unwrap();
(((base_reward as u128 * multiplicand) / effective_median_bw) / effective_median_bw)
(((u128::from(base_reward) * multiplicand) / effective_median_bw) / effective_median_bw)
.try_into()
.unwrap()
}