consensus-context: enable workspace lints (#321)
Some checks failed
Audit / audit (push) Has been cancelled
CI / fmt (push) Has been cancelled
CI / typo (push) Has been cancelled
Deny / audit (push) Has been cancelled
Doc / build (push) Has been cancelled
CI / ci (macos-latest, stable, bash) (push) Has been cancelled
CI / ci (ubuntu-latest, stable, bash) (push) Has been cancelled
CI / ci (windows-latest, stable-x86_64-pc-windows-gnu, msys2 {0}) (push) Has been cancelled
Doc / deploy (push) Has been cancelled

enable lints, fix 1.82 clippy
This commit is contained in:
hinto-janai 2024-10-22 12:35:54 -04:00 committed by GitHub
parent 978d72b6c1
commit 4b350e897d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 15 additions and 8 deletions

View file

@ -7,8 +7,8 @@ authors = ["SyntheticBird","Boog900"]
[dependencies] [dependencies]
cuprate-consensus-rules = { path = "../rules", features = ["proptest"]} cuprate-consensus-rules = { path = "../rules", features = ["proptest"]}
cuprate-helper = { path = "../../helper", default-features = false, features = ["std", "cast"] } cuprate-helper = { path = "../../helper", default-features = false, features = ["std", "cast", "num", "asynch"] }
cuprate-types = { path = "../../types", default-features = false } cuprate-types = { path = "../../types", default-features = false, features = ["blockchain"] }
futures = { workspace = true, features = ["std", "async-await"] } futures = { workspace = true, features = ["std", "async-await"] }
tokio = { workspace = true, features = ["rt-multi-thread", "macros"]} tokio = { workspace = true, features = ["rt-multi-thread", "macros"]}
@ -22,3 +22,6 @@ randomx-rs = { workspace = true }
rayon = { workspace = true } rayon = { workspace = true }
thread_local = { workspace = true } thread_local = { workspace = true }
hex = { 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? // 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. /// 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 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 //! This is used during contextual validation, this does not have all the data for contextual validation
//! (outputs) for that you will need a [`Database`]. //! (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::{ use std::{
cmp::min, cmp::min,
collections::HashMap, collections::HashMap,

View file

@ -11,7 +11,7 @@ proptest = ["cuprate-types/proptest"]
rayon = ["dep:rayon"] rayon = ["dep:rayon"]
[dependencies] [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-helper = { path = "../../helper", default-features = false, features = ["std", "cast"] }
cuprate-types = { path = "../../types", default-features = false } cuprate-types = { path = "../../types", default-features = false }
cuprate-cryptonight = {path = "../../cryptonight"} cuprate-cryptonight = {path = "../../cryptonight"}

View file

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

View file

@ -68,7 +68,7 @@ pub fn calculate_block_reward(
.unwrap(); .unwrap();
let effective_median_bw: u128 = median_bw.try_into().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() .try_into()
.unwrap() .unwrap()
} }