mirror of
https://github.com/hinto-janai/cuprate.git
synced 2024-11-16 15:58:14 +00:00
lints: replace allow
with expect
(#285)
Some checks are pending
Audit / audit (push) Waiting to run
CI / fmt (push) Waiting to run
CI / typo (push) Waiting to run
CI / ci (macos-latest, stable, bash) (push) Waiting to run
CI / ci (ubuntu-latest, stable, bash) (push) Waiting to run
CI / ci (windows-latest, stable-x86_64-pc-windows-gnu, msys2 {0}) (push) Waiting to run
Deny / audit (push) Waiting to run
Doc / build (push) Waiting to run
Doc / deploy (push) Blocked by required conditions
Some checks are pending
Audit / audit (push) Waiting to run
CI / fmt (push) Waiting to run
CI / typo (push) Waiting to run
CI / ci (macos-latest, stable, bash) (push) Waiting to run
CI / ci (ubuntu-latest, stable, bash) (push) Waiting to run
CI / ci (windows-latest, stable-x86_64-pc-windows-gnu, msys2 {0}) (push) Waiting to run
Deny / audit (push) Waiting to run
Doc / build (push) Waiting to run
Doc / deploy (push) Blocked by required conditions
* cargo.toml: add `allow_attributes` lint * fix lints * fixes * fmt * fix docs * fix docs * fix expect msg
This commit is contained in:
parent
2291a96795
commit
6502729d8c
35 changed files with 94 additions and 84 deletions
|
@ -264,6 +264,7 @@ empty_enum_variants_with_brackets = "deny"
|
||||||
empty_drop = "deny"
|
empty_drop = "deny"
|
||||||
clone_on_ref_ptr = "deny"
|
clone_on_ref_ptr = "deny"
|
||||||
upper_case_acronyms = "deny"
|
upper_case_acronyms = "deny"
|
||||||
|
allow_attributes = "deny"
|
||||||
|
|
||||||
# Hot
|
# Hot
|
||||||
# inline_always = "deny"
|
# inline_always = "deny"
|
||||||
|
|
|
@ -5,9 +5,6 @@
|
||||||
//---------------------------------------------------------------------------------------------------- Use
|
//---------------------------------------------------------------------------------------------------- Use
|
||||||
use crossbeam::atomic::AtomicCell;
|
use crossbeam::atomic::AtomicCell;
|
||||||
|
|
||||||
#[allow(unused_imports)] // docs
|
|
||||||
use std::sync::atomic::{Ordering, Ordering::Acquire, Ordering::Release};
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------- Atomic Float
|
//---------------------------------------------------------------------------------------------------- Atomic Float
|
||||||
/// Compile-time assertion that our floats are
|
/// Compile-time assertion that our floats are
|
||||||
/// lock-free for the target we're building for.
|
/// lock-free for the target we're building for.
|
||||||
|
@ -31,9 +28,13 @@ const _: () = {
|
||||||
/// This is an alias for
|
/// This is an alias for
|
||||||
/// [`crossbeam::atomic::AtomicCell<f32>`](https://docs.rs/crossbeam/latest/crossbeam/atomic/struct.AtomicCell.html).
|
/// [`crossbeam::atomic::AtomicCell<f32>`](https://docs.rs/crossbeam/latest/crossbeam/atomic/struct.AtomicCell.html).
|
||||||
///
|
///
|
||||||
/// Note that there are no [`Ordering`] parameters,
|
/// Note that there are no [Ordering] parameters,
|
||||||
/// atomic loads use [`Acquire`],
|
/// atomic loads use [Acquire],
|
||||||
/// and atomic stores use [`Release`].
|
/// and atomic stores use [Release].
|
||||||
|
///
|
||||||
|
/// [Ordering]: std::sync::atomic::Ordering
|
||||||
|
/// [Acquire]: std::sync::atomic::Ordering::Acquire
|
||||||
|
/// [Release]: std::sync::atomic::Ordering::Release
|
||||||
pub type AtomicF32 = AtomicCell<f32>;
|
pub type AtomicF32 = AtomicCell<f32>;
|
||||||
|
|
||||||
/// An atomic [`f64`].
|
/// An atomic [`f64`].
|
||||||
|
@ -41,9 +42,13 @@ pub type AtomicF32 = AtomicCell<f32>;
|
||||||
/// This is an alias for
|
/// This is an alias for
|
||||||
/// [`crossbeam::atomic::AtomicCell<f64>`](https://docs.rs/crossbeam/latest/crossbeam/atomic/struct.AtomicCell.html).
|
/// [`crossbeam::atomic::AtomicCell<f64>`](https://docs.rs/crossbeam/latest/crossbeam/atomic/struct.AtomicCell.html).
|
||||||
///
|
///
|
||||||
/// Note that there are no [`Ordering`] parameters,
|
/// Note that there are no [Ordering] parameters,
|
||||||
/// atomic loads use [`Acquire`],
|
/// atomic loads use [Acquire],
|
||||||
/// and atomic stores use [`Release`].
|
/// and atomic stores use [Release].
|
||||||
|
///
|
||||||
|
/// [Ordering]: std::sync::atomic::Ordering
|
||||||
|
/// [Acquire]: std::sync::atomic::Ordering::Acquire
|
||||||
|
/// [Release]: std::sync::atomic::Ordering::Release
|
||||||
pub type AtomicF64 = AtomicCell<f64>;
|
pub type AtomicF64 = AtomicCell<f64>;
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------- TESTS
|
//---------------------------------------------------------------------------------------------------- TESTS
|
||||||
|
|
|
@ -29,7 +29,7 @@ use crate::cast::{u64_to_usize, usize_to_u64};
|
||||||
/// ```
|
/// ```
|
||||||
#[inline]
|
#[inline]
|
||||||
pub const fn split_u128_into_low_high_bits(value: u128) -> (u64, u64) {
|
pub const fn split_u128_into_low_high_bits(value: u128) -> (u64, u64) {
|
||||||
#[allow(clippy::cast_possible_truncation)]
|
#[expect(clippy::cast_possible_truncation)]
|
||||||
(value as u64, (value >> 64) as u64)
|
(value as u64, (value >> 64) as u64)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -91,7 +91,7 @@ where
|
||||||
///
|
///
|
||||||
/// # Invariant
|
/// # Invariant
|
||||||
/// If not sorted the output will be invalid.
|
/// If not sorted the output will be invalid.
|
||||||
#[allow(clippy::debug_assert_with_mut_call)]
|
#[expect(clippy::debug_assert_with_mut_call)]
|
||||||
pub fn median<T>(array: impl AsRef<[T]>) -> T
|
pub fn median<T>(array: impl AsRef<[T]>) -> T
|
||||||
where
|
where
|
||||||
T: Add<Output = T>
|
T: Add<Output = T>
|
||||||
|
|
|
@ -6,7 +6,6 @@
|
||||||
use std::{cmp::max, num::NonZeroUsize};
|
use std::{cmp::max, num::NonZeroUsize};
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------- Thread Count & Percent
|
//---------------------------------------------------------------------------------------------------- Thread Count & Percent
|
||||||
#[allow(non_snake_case)]
|
|
||||||
/// Get the total amount of system threads.
|
/// Get the total amount of system threads.
|
||||||
///
|
///
|
||||||
/// ```rust
|
/// ```rust
|
||||||
|
@ -28,10 +27,15 @@ macro_rules! impl_thread_percent {
|
||||||
$(
|
$(
|
||||||
$(#[$doc])*
|
$(#[$doc])*
|
||||||
pub fn $fn_name() -> NonZeroUsize {
|
pub fn $fn_name() -> NonZeroUsize {
|
||||||
// unwrap here is okay because:
|
// unwrap here is okay because:
|
||||||
// - THREADS().get() is always non-zero
|
// - THREADS().get() is always non-zero
|
||||||
// - max() guards against 0
|
// - max() guards against 0
|
||||||
#[allow(clippy::cast_possible_truncation, clippy::cast_sign_loss, clippy::cast_precision_loss)]
|
#[expect(
|
||||||
|
clippy::cast_possible_truncation,
|
||||||
|
clippy::cast_sign_loss,
|
||||||
|
clippy::cast_precision_loss,
|
||||||
|
reason = "we need to round integers"
|
||||||
|
)]
|
||||||
NonZeroUsize::new(max(1, (threads().get() as f64 * $percent).floor() as usize)).unwrap()
|
NonZeroUsize::new(max(1, (threads().get() as f64 * $percent).floor() as usize)).unwrap()
|
||||||
}
|
}
|
||||||
)*
|
)*
|
||||||
|
|
|
@ -129,7 +129,7 @@ pub const fn secs_to_clock(seconds: u32) -> (u8, u8, u8) {
|
||||||
debug_assert!(m < 60);
|
debug_assert!(m < 60);
|
||||||
debug_assert!(s < 60);
|
debug_assert!(s < 60);
|
||||||
|
|
||||||
#[allow(clippy::cast_possible_truncation)] // checked above
|
#[expect(clippy::cast_possible_truncation, reason = "checked above")]
|
||||||
(h as u8, m, s)
|
(h as u8, m, s)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -154,7 +154,7 @@ pub fn time() -> u32 {
|
||||||
///
|
///
|
||||||
/// This is guaranteed to return a value between `0..=86399`
|
/// This is guaranteed to return a value between `0..=86399`
|
||||||
pub fn time_utc() -> u32 {
|
pub fn time_utc() -> u32 {
|
||||||
#[allow(clippy::cast_sign_loss)] // checked in function calls
|
#[expect(clippy::cast_sign_loss, reason = "checked in function calls")]
|
||||||
unix_clock(chrono::offset::Local::now().timestamp() as u64)
|
unix_clock(chrono::offset::Local::now().timestamp() as u64)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,6 @@ macro_rules! generate_endpoints_with_input {
|
||||||
),*) => { paste::paste! {
|
),*) => { paste::paste! {
|
||||||
$(
|
$(
|
||||||
/// TODO
|
/// TODO
|
||||||
#[allow(unused_mut)]
|
|
||||||
pub(crate) async fn $endpoint<H: RpcHandler>(
|
pub(crate) async fn $endpoint<H: RpcHandler>(
|
||||||
State(handler): State<H>,
|
State(handler): State<H>,
|
||||||
mut request: Bytes,
|
mut request: Bytes,
|
||||||
|
@ -55,7 +54,6 @@ macro_rules! generate_endpoints_with_no_input {
|
||||||
),*) => { paste::paste! {
|
),*) => { paste::paste! {
|
||||||
$(
|
$(
|
||||||
/// TODO
|
/// TODO
|
||||||
#[allow(unused_mut)]
|
|
||||||
pub(crate) async fn $endpoint<H: RpcHandler>(
|
pub(crate) async fn $endpoint<H: RpcHandler>(
|
||||||
State(handler): State<H>,
|
State(handler): State<H>,
|
||||||
) -> Result<Bytes, StatusCode> {
|
) -> Result<Bytes, StatusCode> {
|
||||||
|
|
|
@ -69,7 +69,6 @@ macro_rules! generate_router_builder {
|
||||||
/// .all()
|
/// .all()
|
||||||
/// .build();
|
/// .build();
|
||||||
/// ```
|
/// ```
|
||||||
#[allow(clippy::struct_excessive_bools)]
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct RouterBuilder<H: RpcHandler> {
|
pub struct RouterBuilder<H: RpcHandler> {
|
||||||
router: Router<H>,
|
router: Router<H>,
|
||||||
|
|
|
@ -57,7 +57,7 @@ impl Service<JsonRpcRequest> for RpcHandlerDummy {
|
||||||
use cuprate_rpc_types::json::JsonRpcRequest as Req;
|
use cuprate_rpc_types::json::JsonRpcRequest as Req;
|
||||||
use cuprate_rpc_types::json::JsonRpcResponse as Resp;
|
use cuprate_rpc_types::json::JsonRpcResponse as Resp;
|
||||||
|
|
||||||
#[allow(clippy::default_trait_access)]
|
#[expect(clippy::default_trait_access)]
|
||||||
let resp = match req {
|
let resp = match req {
|
||||||
Req::GetBlockCount(_) => Resp::GetBlockCount(Default::default()),
|
Req::GetBlockCount(_) => Resp::GetBlockCount(Default::default()),
|
||||||
Req::OnGetBlockHash(_) => Resp::OnGetBlockHash(Default::default()),
|
Req::OnGetBlockHash(_) => Resp::OnGetBlockHash(Default::default()),
|
||||||
|
@ -112,7 +112,7 @@ impl Service<BinRequest> for RpcHandlerDummy {
|
||||||
use cuprate_rpc_types::bin::BinRequest as Req;
|
use cuprate_rpc_types::bin::BinRequest as Req;
|
||||||
use cuprate_rpc_types::bin::BinResponse as Resp;
|
use cuprate_rpc_types::bin::BinResponse as Resp;
|
||||||
|
|
||||||
#[allow(clippy::default_trait_access)]
|
#[expect(clippy::default_trait_access)]
|
||||||
let resp = match req {
|
let resp = match req {
|
||||||
Req::GetBlocks(_) => Resp::GetBlocks(Default::default()),
|
Req::GetBlocks(_) => Resp::GetBlocks(Default::default()),
|
||||||
Req::GetBlocksByHeight(_) => Resp::GetBlocksByHeight(Default::default()),
|
Req::GetBlocksByHeight(_) => Resp::GetBlocksByHeight(Default::default()),
|
||||||
|
@ -142,7 +142,7 @@ impl Service<OtherRequest> for RpcHandlerDummy {
|
||||||
use cuprate_rpc_types::other::OtherRequest as Req;
|
use cuprate_rpc_types::other::OtherRequest as Req;
|
||||||
use cuprate_rpc_types::other::OtherResponse as Resp;
|
use cuprate_rpc_types::other::OtherResponse as Resp;
|
||||||
|
|
||||||
#[allow(clippy::default_trait_access)]
|
#[expect(clippy::default_trait_access)]
|
||||||
let resp = match req {
|
let resp = match req {
|
||||||
Req::GetHeight(_) => Resp::GetHeight(Default::default()),
|
Req::GetHeight(_) => Resp::GetHeight(Default::default()),
|
||||||
Req::GetTransactions(_) => Resp::GetTransactions(Default::default()),
|
Req::GetTransactions(_) => Resp::GetTransactions(Default::default()),
|
||||||
|
|
|
@ -52,7 +52,7 @@ where
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Tests an input JSON string matches an expected type `T`.
|
/// Tests an input JSON string matches an expected type `T`.
|
||||||
#[allow(clippy::needless_pass_by_value)] // serde signature
|
#[expect(clippy::needless_pass_by_value, reason = "serde signature")]
|
||||||
fn assert_de<T>(json: &'static str, expected: T)
|
fn assert_de<T>(json: &'static str, expected: T)
|
||||||
where
|
where
|
||||||
T: DeserializeOwned + std::fmt::Debug + Clone + PartialEq,
|
T: DeserializeOwned + std::fmt::Debug + Clone + PartialEq,
|
||||||
|
|
|
@ -138,7 +138,6 @@ define_request! {
|
||||||
)]
|
)]
|
||||||
///
|
///
|
||||||
/// This response's variant depends upon [`PoolInfoExtent`].
|
/// This response's variant depends upon [`PoolInfoExtent`].
|
||||||
#[allow(dead_code, missing_docs)]
|
|
||||||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||||
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||||
pub enum GetBlocksResponse {
|
pub enum GetBlocksResponse {
|
||||||
|
@ -157,7 +156,6 @@ impl Default for GetBlocksResponse {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Data within [`GetBlocksResponse::PoolInfoNone`].
|
/// Data within [`GetBlocksResponse::PoolInfoNone`].
|
||||||
#[allow(dead_code, missing_docs)]
|
|
||||||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||||
#[derive(Clone, Default, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
#[derive(Clone, Default, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||||
pub struct GetBlocksResponsePoolInfoNone {
|
pub struct GetBlocksResponsePoolInfoNone {
|
||||||
|
@ -183,7 +181,6 @@ epee_object! {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Data within [`GetBlocksResponse::PoolInfoIncremental`].
|
/// Data within [`GetBlocksResponse::PoolInfoIncremental`].
|
||||||
#[allow(dead_code, missing_docs)]
|
|
||||||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||||
#[derive(Clone, Default, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
#[derive(Clone, Default, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||||
pub struct GetBlocksResponsePoolInfoIncremental {
|
pub struct GetBlocksResponsePoolInfoIncremental {
|
||||||
|
@ -215,7 +212,6 @@ epee_object! {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Data within [`GetBlocksResponse::PoolInfoFull`].
|
/// Data within [`GetBlocksResponse::PoolInfoFull`].
|
||||||
#[allow(dead_code, missing_docs)]
|
|
||||||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||||
#[derive(Clone, Default, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
#[derive(Clone, Default, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||||
pub struct GetBlocksResponsePoolInfoFull {
|
pub struct GetBlocksResponsePoolInfoFull {
|
||||||
|
@ -248,7 +244,6 @@ epee_object! {
|
||||||
/// [`EpeeObjectBuilder`] for [`GetBlocksResponse`].
|
/// [`EpeeObjectBuilder`] for [`GetBlocksResponse`].
|
||||||
///
|
///
|
||||||
/// Not for public usage.
|
/// Not for public usage.
|
||||||
#[allow(dead_code, missing_docs)]
|
|
||||||
#[derive(Clone, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
#[derive(Clone, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||||
pub struct __GetBlocksResponseEpeeBuilder {
|
pub struct __GetBlocksResponseEpeeBuilder {
|
||||||
|
@ -354,7 +349,6 @@ impl EpeeObjectBuilder<GetBlocksResponse> for __GetBlocksResponseEpeeBuilder {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "epee")]
|
#[cfg(feature = "epee")]
|
||||||
#[allow(clippy::cognitive_complexity)]
|
|
||||||
impl EpeeObject for GetBlocksResponse {
|
impl EpeeObject for GetBlocksResponse {
|
||||||
type Builder = __GetBlocksResponseEpeeBuilder;
|
type Builder = __GetBlocksResponseEpeeBuilder;
|
||||||
|
|
||||||
|
@ -397,7 +391,6 @@ impl EpeeObject for GetBlocksResponse {
|
||||||
/// See also: [`BinResponse`].
|
/// See also: [`BinResponse`].
|
||||||
#[cfg_attr(feature = "serde", derive(Deserialize, Serialize))]
|
#[cfg_attr(feature = "serde", derive(Deserialize, Serialize))]
|
||||||
#[cfg_attr(feature = "serde", serde(untagged))]
|
#[cfg_attr(feature = "serde", serde(untagged))]
|
||||||
#[allow(missing_docs)]
|
|
||||||
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||||
pub enum BinRequest {
|
pub enum BinRequest {
|
||||||
GetBlocks(GetBlocksRequest),
|
GetBlocks(GetBlocksRequest),
|
||||||
|
@ -444,7 +437,6 @@ impl RpcCallValue for BinRequest {
|
||||||
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||||
#[cfg_attr(feature = "serde", derive(Deserialize, Serialize))]
|
#[cfg_attr(feature = "serde", derive(Deserialize, Serialize))]
|
||||||
#[cfg_attr(feature = "serde", serde(untagged))]
|
#[cfg_attr(feature = "serde", serde(untagged))]
|
||||||
#[allow(missing_docs)]
|
|
||||||
pub enum BinResponse {
|
pub enum BinResponse {
|
||||||
GetBlocks(GetBlocksResponse),
|
GetBlocks(GetBlocksResponse),
|
||||||
GetBlocksByHeight(GetBlocksByHeightResponse),
|
GetBlocksByHeight(GetBlocksByHeightResponse),
|
||||||
|
|
|
@ -5,16 +5,16 @@
|
||||||
|
|
||||||
/// Returns `true` if the input `u` is equal to `0`.
|
/// Returns `true` if the input `u` is equal to `0`.
|
||||||
#[inline]
|
#[inline]
|
||||||
#[allow(clippy::trivially_copy_pass_by_ref)] // serde needs `&`
|
#[expect(clippy::trivially_copy_pass_by_ref, reason = "serde signature")]
|
||||||
#[allow(dead_code)] // TODO: see if needed after handlers.
|
#[expect(dead_code, reason = "TODO: see if needed after handlers.")]
|
||||||
pub(crate) const fn is_zero(u: &u64) -> bool {
|
pub(crate) const fn is_zero(u: &u64) -> bool {
|
||||||
*u == 0
|
*u == 0
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns `true` the input `u` is equal to `1`.
|
/// Returns `true` the input `u` is equal to `1`.
|
||||||
#[inline]
|
#[inline]
|
||||||
#[allow(clippy::trivially_copy_pass_by_ref)] // serde needs `&`
|
#[expect(clippy::trivially_copy_pass_by_ref, reason = "serde signature")]
|
||||||
#[allow(dead_code)] // TODO: see if needed after handlers.
|
#[expect(dead_code, reason = "TODO: see if needed after handlers.")]
|
||||||
pub(crate) const fn is_one(u: &u64) -> bool {
|
pub(crate) const fn is_one(u: &u64) -> bool {
|
||||||
*u == 1
|
*u == 1
|
||||||
}
|
}
|
||||||
|
|
|
@ -1581,7 +1581,6 @@ define_request_and_response! {
|
||||||
feature = "serde",
|
feature = "serde",
|
||||||
serde(rename_all = "snake_case", tag = "method", content = "params")
|
serde(rename_all = "snake_case", tag = "method", content = "params")
|
||||||
)]
|
)]
|
||||||
#[allow(missing_docs)]
|
|
||||||
pub enum JsonRpcRequest {
|
pub enum JsonRpcRequest {
|
||||||
GetBlockCount(GetBlockCountRequest),
|
GetBlockCount(GetBlockCountRequest),
|
||||||
OnGetBlockHash(OnGetBlockHashRequest),
|
OnGetBlockHash(OnGetBlockHashRequest),
|
||||||
|
@ -1714,7 +1713,6 @@ impl RpcCallValue for JsonRpcRequest {
|
||||||
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||||
#[cfg_attr(feature = "serde", derive(Deserialize, Serialize))]
|
#[cfg_attr(feature = "serde", derive(Deserialize, Serialize))]
|
||||||
#[cfg_attr(feature = "serde", serde(untagged, rename_all = "snake_case"))]
|
#[cfg_attr(feature = "serde", serde(untagged, rename_all = "snake_case"))]
|
||||||
#[allow(missing_docs)]
|
|
||||||
pub enum JsonRpcResponse {
|
pub enum JsonRpcResponse {
|
||||||
GetBlockCount(GetBlockCountResponse),
|
GetBlockCount(GetBlockCountResponse),
|
||||||
OnGetBlockHash(OnGetBlockHashResponse),
|
OnGetBlockHash(OnGetBlockHashResponse),
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
#![doc = include_str!("../README.md")]
|
#![doc = include_str!("../README.md")]
|
||||||
#![cfg_attr(docsrs, feature(doc_cfg))]
|
#![cfg_attr(docsrs, feature(doc_cfg))]
|
||||||
|
#![allow(
|
||||||
|
clippy::allow_attributes,
|
||||||
|
reason = "macros (internal + serde) make this lint hard to satisfy"
|
||||||
|
)]
|
||||||
|
|
||||||
mod constants;
|
mod constants;
|
||||||
mod defaults;
|
mod defaults;
|
||||||
|
|
|
@ -94,6 +94,7 @@ macro_rules! define_request_and_response {
|
||||||
}
|
}
|
||||||
) => { paste::paste! {
|
) => { paste::paste! {
|
||||||
$crate::macros::define_request! {
|
$crate::macros::define_request! {
|
||||||
|
#[allow(dead_code, missing_docs, reason = "inside a macro")]
|
||||||
#[doc = $crate::macros::define_request_and_response_doc!(
|
#[doc = $crate::macros::define_request_and_response_doc!(
|
||||||
"response" => [<$type_name Response>],
|
"response" => [<$type_name Response>],
|
||||||
$monero_daemon_rpc_doc_link,
|
$monero_daemon_rpc_doc_link,
|
||||||
|
@ -118,8 +119,7 @@ macro_rules! define_request_and_response {
|
||||||
}
|
}
|
||||||
|
|
||||||
$crate::macros::define_response! {
|
$crate::macros::define_response! {
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code, missing_docs, reason = "inside a macro")]
|
||||||
#[allow(missing_docs)]
|
|
||||||
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
|
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
|
||||||
#[derive(Clone, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
#[derive(Clone, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||||
#[doc = $crate::macros::define_request_and_response_doc!(
|
#[doc = $crate::macros::define_request_and_response_doc!(
|
||||||
|
@ -236,7 +236,7 @@ macro_rules! define_request {
|
||||||
)*
|
)*
|
||||||
}
|
}
|
||||||
) => {
|
) => {
|
||||||
#[allow(dead_code, missing_docs)]
|
#[allow(dead_code, missing_docs, reason = "inside a macro")]
|
||||||
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
|
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
|
||||||
#[derive(Clone, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
#[derive(Clone, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||||
$( #[$attr] )*
|
$( #[$attr] )*
|
||||||
|
|
|
@ -76,7 +76,6 @@ impl Default for Distribution {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Data within [`Distribution::Uncompressed`].
|
/// Data within [`Distribution::Uncompressed`].
|
||||||
#[allow(dead_code, missing_docs)]
|
|
||||||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||||
#[derive(Clone, Default, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
#[derive(Clone, Default, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||||
pub struct DistributionUncompressed {
|
pub struct DistributionUncompressed {
|
||||||
|
@ -99,7 +98,6 @@ epee_object! {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Data within [`Distribution::CompressedBinary`].
|
/// Data within [`Distribution::CompressedBinary`].
|
||||||
#[allow(dead_code, missing_docs)]
|
|
||||||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||||
#[derive(Clone, Default, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
#[derive(Clone, Default, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||||
pub struct DistributionCompressedBinary {
|
pub struct DistributionCompressedBinary {
|
||||||
|
@ -132,7 +130,7 @@ epee_object! {
|
||||||
/// 1. Compresses the distribution array
|
/// 1. Compresses the distribution array
|
||||||
/// 2. Serializes the compressed data
|
/// 2. Serializes the compressed data
|
||||||
#[cfg(feature = "serde")]
|
#[cfg(feature = "serde")]
|
||||||
#[allow(clippy::ptr_arg)]
|
#[expect(clippy::ptr_arg)]
|
||||||
fn serialize_distribution_as_compressed_data<S>(v: &Vec<u64>, s: S) -> Result<S::Ok, S::Error>
|
fn serialize_distribution_as_compressed_data<S>(v: &Vec<u64>, s: S) -> Result<S::Ok, S::Error>
|
||||||
where
|
where
|
||||||
S: serde::Serializer,
|
S: serde::Serializer,
|
||||||
|
@ -162,7 +160,6 @@ where
|
||||||
/// [`EpeeObjectBuilder`] for [`Distribution`].
|
/// [`EpeeObjectBuilder`] for [`Distribution`].
|
||||||
///
|
///
|
||||||
/// Not for public usage.
|
/// Not for public usage.
|
||||||
#[allow(dead_code, missing_docs)]
|
|
||||||
#[derive(Clone, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
#[derive(Clone, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||||
pub struct __DistributionEpeeBuilder {
|
pub struct __DistributionEpeeBuilder {
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
mod binary_string;
|
mod binary_string;
|
||||||
mod distribution;
|
mod distribution;
|
||||||
mod key_image_spent_status;
|
mod key_image_spent_status;
|
||||||
#[allow(clippy::module_inception)]
|
#[expect(clippy::module_inception)]
|
||||||
mod misc;
|
mod misc;
|
||||||
mod pool_info_extent;
|
mod pool_info_extent;
|
||||||
mod status;
|
mod status;
|
||||||
|
|
|
@ -973,7 +973,6 @@ define_request_and_response! {
|
||||||
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||||
#[cfg_attr(feature = "serde", derive(Deserialize, Serialize))]
|
#[cfg_attr(feature = "serde", derive(Deserialize, Serialize))]
|
||||||
#[cfg_attr(feature = "serde", serde(untagged))]
|
#[cfg_attr(feature = "serde", serde(untagged))]
|
||||||
#[allow(missing_docs)]
|
|
||||||
pub enum OtherRequest {
|
pub enum OtherRequest {
|
||||||
GetHeight(GetHeightRequest),
|
GetHeight(GetHeightRequest),
|
||||||
GetTransactions(GetTransactionsRequest),
|
GetTransactions(GetTransactionsRequest),
|
||||||
|
@ -1092,7 +1091,6 @@ impl RpcCallValue for OtherRequest {
|
||||||
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||||
#[cfg_attr(feature = "serde", derive(Deserialize, Serialize))]
|
#[cfg_attr(feature = "serde", derive(Deserialize, Serialize))]
|
||||||
#[cfg_attr(feature = "serde", serde(untagged))]
|
#[cfg_attr(feature = "serde", serde(untagged))]
|
||||||
#[allow(missing_docs)]
|
|
||||||
pub enum OtherResponse {
|
pub enum OtherResponse {
|
||||||
GetHeight(GetHeightResponse),
|
GetHeight(GetHeightResponse),
|
||||||
GetTransactions(GetTransactionsResponse),
|
GetTransactions(GetTransactionsResponse),
|
||||||
|
|
|
@ -183,7 +183,10 @@ pub fn get_block_extended_header(
|
||||||
|
|
||||||
/// Same as [`get_block_extended_header`] but with a [`BlockHeight`].
|
/// Same as [`get_block_extended_header`] but with a [`BlockHeight`].
|
||||||
#[doc = doc_error!()]
|
#[doc = doc_error!()]
|
||||||
#[allow(clippy::missing_panics_doc)] // The panic is only possible with a corrupt DB
|
#[expect(
|
||||||
|
clippy::missing_panics_doc,
|
||||||
|
reason = "The panic is only possible with a corrupt DB"
|
||||||
|
)]
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn get_block_extended_header_from_height(
|
pub fn get_block_extended_header_from_height(
|
||||||
block_height: &BlockHeight,
|
block_height: &BlockHeight,
|
||||||
|
@ -198,8 +201,10 @@ pub fn get_block_extended_header_from_height(
|
||||||
block_info.cumulative_difficulty_high,
|
block_info.cumulative_difficulty_high,
|
||||||
);
|
);
|
||||||
|
|
||||||
// INVARIANT: #[cfg] @ lib.rs asserts `usize == u64`
|
#[expect(
|
||||||
#[allow(clippy::cast_possible_truncation)]
|
clippy::cast_possible_truncation,
|
||||||
|
reason = "INVARIANT: #[cfg] @ lib.rs asserts `usize == u64`"
|
||||||
|
)]
|
||||||
Ok(ExtendedBlockHeader {
|
Ok(ExtendedBlockHeader {
|
||||||
cumulative_difficulty,
|
cumulative_difficulty,
|
||||||
version: HardFork::from_version(block.header.hardfork_version)
|
version: HardFork::from_version(block.header.hardfork_version)
|
||||||
|
@ -260,11 +265,7 @@ pub fn block_exists(
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------- Tests
|
//---------------------------------------------------------------------------------------------------- Tests
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
#[allow(
|
#[expect(clippy::significant_drop_tightening, clippy::too_many_lines)]
|
||||||
clippy::significant_drop_tightening,
|
|
||||||
clippy::cognitive_complexity,
|
|
||||||
clippy::too_many_lines
|
|
||||||
)]
|
|
||||||
mod test {
|
mod test {
|
||||||
use pretty_assertions::assert_eq;
|
use pretty_assertions::assert_eq;
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ use crate::{
|
||||||
pub fn chain_height(
|
pub fn chain_height(
|
||||||
table_block_heights: &impl DatabaseRo<BlockHeights>,
|
table_block_heights: &impl DatabaseRo<BlockHeights>,
|
||||||
) -> Result<BlockHeight, RuntimeError> {
|
) -> Result<BlockHeight, RuntimeError> {
|
||||||
#[allow(clippy::cast_possible_truncation)] // we enforce 64-bit
|
#[expect(clippy::cast_possible_truncation, reason = "we enforce 64-bit")]
|
||||||
table_block_heights.len().map(|height| height as usize)
|
table_block_heights.len().map(|height| height as usize)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ pub fn top_block_height(
|
||||||
) -> Result<BlockHeight, RuntimeError> {
|
) -> Result<BlockHeight, RuntimeError> {
|
||||||
match table_block_heights.len()? {
|
match table_block_heights.len()? {
|
||||||
0 => Err(RuntimeError::KeyNotFound),
|
0 => Err(RuntimeError::KeyNotFound),
|
||||||
#[allow(clippy::cast_possible_truncation)] // we enforce 64-bit
|
#[expect(clippy::cast_possible_truncation, reason = "we enforce 64-bit")]
|
||||||
height => Ok(height as usize - 1),
|
height => Ok(height as usize - 1),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -142,7 +142,6 @@ fn thread_local<T: Send>(env: &impl Env) -> ThreadLocal<T> {
|
||||||
macro_rules! get_tables {
|
macro_rules! get_tables {
|
||||||
($env_inner:ident, $tx_ro:ident, $tables:ident) => {{
|
($env_inner:ident, $tx_ro:ident, $tables:ident) => {{
|
||||||
$tables.get_or_try(|| {
|
$tables.get_or_try(|| {
|
||||||
#[allow(clippy::significant_drop_in_scrutinee)]
|
|
||||||
match $env_inner.open_tables($tx_ro) {
|
match $env_inner.open_tables($tx_ro) {
|
||||||
// SAFETY: see above macro doc comment.
|
// SAFETY: see above macro doc comment.
|
||||||
Ok(tables) => Ok(unsafe { crate::unsafe_sendable::UnsafeSendable::new(tables) }),
|
Ok(tables) => Ok(unsafe { crate::unsafe_sendable::UnsafeSendable::new(tables) }),
|
||||||
|
@ -339,8 +338,10 @@ fn number_outputs_with_amount(env: &ConcreteEnv, amounts: Vec<Amount>) -> Respon
|
||||||
let tables = thread_local(env);
|
let tables = thread_local(env);
|
||||||
|
|
||||||
// Cache the amount of RCT outputs once.
|
// Cache the amount of RCT outputs once.
|
||||||
// INVARIANT: #[cfg] @ lib.rs asserts `usize == u64`
|
#[expect(
|
||||||
#[allow(clippy::cast_possible_truncation)]
|
clippy::cast_possible_truncation,
|
||||||
|
reason = "INVARIANT: #[cfg] @ lib.rs asserts `usize == u64`"
|
||||||
|
)]
|
||||||
let num_rct_outputs = {
|
let num_rct_outputs = {
|
||||||
let tx_ro = env_inner.tx_ro()?;
|
let tx_ro = env_inner.tx_ro()?;
|
||||||
let tables = env_inner.open_tables(&tx_ro)?;
|
let tables = env_inner.open_tables(&tx_ro)?;
|
||||||
|
@ -360,8 +361,10 @@ fn number_outputs_with_amount(env: &ConcreteEnv, amounts: Vec<Amount>) -> Respon
|
||||||
} else {
|
} else {
|
||||||
// v1 transactions.
|
// v1 transactions.
|
||||||
match tables.num_outputs().get(&amount) {
|
match tables.num_outputs().get(&amount) {
|
||||||
// INVARIANT: #[cfg] @ lib.rs asserts `usize == u64`
|
#[expect(
|
||||||
#[allow(clippy::cast_possible_truncation)]
|
clippy::cast_possible_truncation,
|
||||||
|
reason = "INVARIANT: #[cfg] @ lib.rs asserts `usize == u64`"
|
||||||
|
)]
|
||||||
Ok(count) => Ok((amount, count as usize)),
|
Ok(count) => Ok((amount, count as usize)),
|
||||||
// If we get a request for an `amount` that doesn't exist,
|
// If we get a request for an `amount` that doesn't exist,
|
||||||
// we return `0` instead of an error.
|
// we return `0` instead of an error.
|
||||||
|
|
|
@ -58,7 +58,10 @@ fn init_service() -> (
|
||||||
/// - Receive response(s)
|
/// - Receive response(s)
|
||||||
/// - Assert proper tables were mutated
|
/// - Assert proper tables were mutated
|
||||||
/// - Assert read requests lead to expected responses
|
/// - Assert read requests lead to expected responses
|
||||||
#[allow(clippy::future_not_send)] // INVARIANT: tests are using a single threaded runtime
|
#[expect(
|
||||||
|
clippy::future_not_send,
|
||||||
|
reason = "INVARIANT: tests are using a single threaded runtime"
|
||||||
|
)]
|
||||||
async fn test_template(
|
async fn test_template(
|
||||||
// Which block(s) to add?
|
// Which block(s) to add?
|
||||||
blocks: &[&VerifiedBlockInformation],
|
blocks: &[&VerifiedBlockInformation],
|
||||||
|
@ -164,8 +167,10 @@ async fn test_template(
|
||||||
num_req
|
num_req
|
||||||
.iter()
|
.iter()
|
||||||
.map(|amount| match tables.num_outputs().get(amount) {
|
.map(|amount| match tables.num_outputs().get(amount) {
|
||||||
// INVARIANT: #[cfg] @ lib.rs asserts `usize == u64`
|
#[expect(
|
||||||
#[allow(clippy::cast_possible_truncation)]
|
clippy::cast_possible_truncation,
|
||||||
|
reason = "INVARIANT: #[cfg] @ lib.rs asserts `usize == u64`"
|
||||||
|
)]
|
||||||
Ok(count) => (*amount, count as usize),
|
Ok(count) => (*amount, count as usize),
|
||||||
Err(RuntimeError::KeyNotFound) => (*amount, 0),
|
Err(RuntimeError::KeyNotFound) => (*amount, 0),
|
||||||
Err(e) => panic!("{e:?}"),
|
Err(e) => panic!("{e:?}"),
|
||||||
|
@ -304,7 +309,10 @@ async fn test_template(
|
||||||
// Assert we get back the same map of
|
// Assert we get back the same map of
|
||||||
// `Amount`'s and `AmountIndex`'s.
|
// `Amount`'s and `AmountIndex`'s.
|
||||||
let mut response_output_count = 0;
|
let mut response_output_count = 0;
|
||||||
#[allow(clippy::iter_over_hash_type)] // order doesn't matter in this test
|
#[expect(
|
||||||
|
clippy::iter_over_hash_type,
|
||||||
|
reason = "order doesn't matter in this test"
|
||||||
|
)]
|
||||||
for (amount, output_map) in response {
|
for (amount, output_map) in response {
|
||||||
let amount_index_set = &map[&amount];
|
let amount_index_set = &map[&amount];
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ use bytemuck::TransparentWrapper;
|
||||||
/// Notably, `heed`'s table type uses this inside `service`.
|
/// Notably, `heed`'s table type uses this inside `service`.
|
||||||
pub(crate) struct UnsafeSendable<T>(T);
|
pub(crate) struct UnsafeSendable<T>(T);
|
||||||
|
|
||||||
#[allow(clippy::non_send_fields_in_send_ty)]
|
#[expect(clippy::non_send_fields_in_send_ty)]
|
||||||
// SAFETY: Users ensure that their usage of this type is safe.
|
// SAFETY: Users ensure that their usage of this type is safe.
|
||||||
unsafe impl<T> Send for UnsafeSendable<T> {}
|
unsafe impl<T> Send for UnsafeSendable<T> {}
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ impl<T> UnsafeSendable<T> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Extract the inner `T`.
|
/// Extract the inner `T`.
|
||||||
#[allow(dead_code)]
|
#[expect(dead_code)]
|
||||||
pub(crate) fn into_inner(self) -> T {
|
pub(crate) fn into_inner(self) -> T {
|
||||||
self.0
|
self.0
|
||||||
}
|
}
|
||||||
|
|
|
@ -144,7 +144,7 @@ impl Env for ConcreteEnv {
|
||||||
// (current disk size) + (a bit of leeway)
|
// (current disk size) + (a bit of leeway)
|
||||||
// to account for empty databases where we
|
// to account for empty databases where we
|
||||||
// need to write same tables.
|
// need to write same tables.
|
||||||
#[allow(clippy::cast_possible_truncation)] // only 64-bit targets
|
#[expect(clippy::cast_possible_truncation, reason = "only 64-bit targets")]
|
||||||
let disk_size_bytes = match std::fs::File::open(&config.db_file) {
|
let disk_size_bytes = match std::fs::File::open(&config.db_file) {
|
||||||
Ok(file) => file.metadata()?.len() as usize,
|
Ok(file) => file.metadata()?.len() as usize,
|
||||||
// The database file doesn't exist, 0 bytes.
|
// The database file doesn't exist, 0 bytes.
|
||||||
|
|
|
@ -57,7 +57,10 @@ impl From<heed::Error> for crate::InitError {
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------- RuntimeError
|
//---------------------------------------------------------------------------------------------------- RuntimeError
|
||||||
#[allow(clippy::fallible_impl_from)] // We need to panic sometimes.
|
#[expect(
|
||||||
|
clippy::fallible_impl_from,
|
||||||
|
reason = "We need to panic sometimes for safety"
|
||||||
|
)]
|
||||||
impl From<heed::Error> for crate::RuntimeError {
|
impl From<heed::Error> for crate::RuntimeError {
|
||||||
/// # Panics
|
/// # Panics
|
||||||
/// This will panic on unrecoverable errors for safety.
|
/// This will panic on unrecoverable errors for safety.
|
||||||
|
|
|
@ -194,7 +194,7 @@ fn db_read_write() {
|
||||||
|
|
||||||
// Insert keys.
|
// Insert keys.
|
||||||
let mut key = KEY;
|
let mut key = KEY;
|
||||||
#[allow(clippy::explicit_counter_loop)] // we need the +1 side effect
|
#[expect(clippy::explicit_counter_loop, reason = "we need the +1 side effect")]
|
||||||
for _ in 0..N {
|
for _ in 0..N {
|
||||||
table.put(&key, &VALUE).unwrap();
|
table.put(&key, &VALUE).unwrap();
|
||||||
key += 1;
|
key += 1;
|
||||||
|
@ -269,7 +269,7 @@ fn db_read_write() {
|
||||||
|
|
||||||
assert_ne!(table.get(&KEY).unwrap(), NEW_VALUE);
|
assert_ne!(table.get(&KEY).unwrap(), NEW_VALUE);
|
||||||
|
|
||||||
#[allow(unused_assignments)]
|
#[expect(unused_assignments)]
|
||||||
table
|
table
|
||||||
.update(&KEY, |mut value| {
|
.update(&KEY, |mut value| {
|
||||||
value = NEW_VALUE;
|
value = NEW_VALUE;
|
||||||
|
|
|
@ -33,7 +33,7 @@
|
||||||
//! # Ok(()) }
|
//! # Ok(()) }
|
||||||
//! ```
|
//! ```
|
||||||
|
|
||||||
#[allow(clippy::module_inception)]
|
#[expect(clippy::module_inception)]
|
||||||
mod config;
|
mod config;
|
||||||
pub use config::{Config, ConfigBuilder, READER_THREADS_DEFAULT};
|
pub use config::{Config, ConfigBuilder, READER_THREADS_DEFAULT};
|
||||||
|
|
||||||
|
|
|
@ -54,7 +54,7 @@ pub trait DatabaseIter<T: Table> {
|
||||||
|
|
||||||
/// Get an [`Iterator`] that returns the `(key, value)` types for this database.
|
/// Get an [`Iterator`] that returns the `(key, value)` types for this database.
|
||||||
#[doc = doc_iter!()]
|
#[doc = doc_iter!()]
|
||||||
#[allow(clippy::iter_not_returning_iterator)]
|
#[expect(clippy::iter_not_returning_iterator)]
|
||||||
fn iter(
|
fn iter(
|
||||||
&self,
|
&self,
|
||||||
) -> Result<impl Iterator<Item = Result<(T::Key, T::Value), RuntimeError>> + '_, RuntimeError>;
|
) -> Result<impl Iterator<Item = Result<(T::Key, T::Value), RuntimeError>> + '_, RuntimeError>;
|
||||||
|
|
|
@ -122,7 +122,7 @@ pub trait Env: Sized {
|
||||||
/// This function _must_ be re-implemented if [`Env::MANUAL_RESIZE`] is `true`.
|
/// This function _must_ be re-implemented if [`Env::MANUAL_RESIZE`] is `true`.
|
||||||
///
|
///
|
||||||
/// Otherwise, this function will panic with `unreachable!()`.
|
/// Otherwise, this function will panic with `unreachable!()`.
|
||||||
#[allow(unused_variables)]
|
#[expect(unused_variables)]
|
||||||
fn resize_map(&self, resize_algorithm: Option<ResizeAlgorithm>) -> NonZeroUsize {
|
fn resize_map(&self, resize_algorithm: Option<ResizeAlgorithm>) -> NonZeroUsize {
|
||||||
unreachable!()
|
unreachable!()
|
||||||
}
|
}
|
||||||
|
|
|
@ -261,7 +261,7 @@ pub fn percent(current_size_bytes: usize, percent: f32) -> NonZeroUsize {
|
||||||
let page_size = *PAGE_SIZE;
|
let page_size = *PAGE_SIZE;
|
||||||
|
|
||||||
// INVARIANT: Allow `f32` <-> `usize` casting, we handle all cases.
|
// INVARIANT: Allow `f32` <-> `usize` casting, we handle all cases.
|
||||||
#[allow(
|
#[expect(
|
||||||
clippy::cast_possible_truncation,
|
clippy::cast_possible_truncation,
|
||||||
clippy::cast_sign_loss,
|
clippy::cast_sign_loss,
|
||||||
clippy::cast_precision_loss
|
clippy::cast_precision_loss
|
||||||
|
|
|
@ -153,7 +153,7 @@ impl ReaderThreads {
|
||||||
},
|
},
|
||||||
|
|
||||||
// We handle the casting loss.
|
// We handle the casting loss.
|
||||||
#[allow(
|
#[expect(
|
||||||
clippy::cast_precision_loss,
|
clippy::cast_precision_loss,
|
||||||
clippy::cast_possible_truncation,
|
clippy::cast_possible_truncation,
|
||||||
clippy::cast_sign_loss
|
clippy::cast_sign_loss
|
||||||
|
|
|
@ -18,7 +18,7 @@ pub enum TxpoolReadRequest {
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------- TxpoolReadResponse
|
//---------------------------------------------------------------------------------------------------- TxpoolReadResponse
|
||||||
/// The transaction pool [`tower::Service`] read response type.
|
/// The transaction pool [`tower::Service`] read response type.
|
||||||
#[allow(clippy::large_enum_variant)]
|
#[expect(clippy::large_enum_variant)]
|
||||||
pub enum TxpoolReadResponse {
|
pub enum TxpoolReadResponse {
|
||||||
/// A response containing the raw bytes of a transaction.
|
/// A response containing the raw bytes of a transaction.
|
||||||
// TODO: use bytes::Bytes.
|
// TODO: use bytes::Bytes.
|
||||||
|
|
|
@ -50,7 +50,7 @@ fn init_read_service_with_pool(env: Arc<ConcreteEnv>, pool: Arc<ThreadPool>) ->
|
||||||
/// 1. `Request` is mapped to a handler function
|
/// 1. `Request` is mapped to a handler function
|
||||||
/// 2. Handler function is called
|
/// 2. Handler function is called
|
||||||
/// 3. [`TxpoolReadResponse`] is returned
|
/// 3. [`TxpoolReadResponse`] is returned
|
||||||
#[allow(clippy::needless_pass_by_value)]
|
#[expect(clippy::needless_pass_by_value)]
|
||||||
fn map_request(
|
fn map_request(
|
||||||
env: &ConcreteEnv, // Access to the database
|
env: &ConcreteEnv, // Access to the database
|
||||||
request: TxpoolReadRequest, // The request we must fulfill
|
request: TxpoolReadRequest, // The request we must fulfill
|
||||||
|
|
|
@ -39,7 +39,7 @@ pub struct TransactionInfo {
|
||||||
pub weight: usize,
|
pub weight: usize,
|
||||||
/// [`TxStateFlags`] of this transaction.
|
/// [`TxStateFlags`] of this transaction.
|
||||||
pub flags: TxStateFlags,
|
pub flags: TxStateFlags,
|
||||||
#[allow(clippy::pub_underscore_fields)]
|
#[expect(clippy::pub_underscore_fields)]
|
||||||
/// Explicit padding so that we have no implicit padding bytes in `repr(C)`.
|
/// Explicit padding so that we have no implicit padding bytes in `repr(C)`.
|
||||||
///
|
///
|
||||||
/// Allows potential future expansion of this type.
|
/// Allows potential future expansion of this type.
|
||||||
|
@ -92,7 +92,7 @@ impl From<RawCachedVerificationState> for CachedVerificationState {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(clippy::fallible_impl_from)] // only panics in invalid states
|
#[expect(clippy::fallible_impl_from, reason = "only panics in invalid states")]
|
||||||
impl From<CachedVerificationState> for RawCachedVerificationState {
|
impl From<CachedVerificationState> for RawCachedVerificationState {
|
||||||
fn from(value: CachedVerificationState) -> Self {
|
fn from(value: CachedVerificationState) -> Self {
|
||||||
match value {
|
match value {
|
||||||
|
|
|
@ -27,7 +27,6 @@ pub enum HardForkError {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// An identifier for every hard-fork Monero has had.
|
/// An identifier for every hard-fork Monero has had.
|
||||||
#[allow(missing_docs)]
|
|
||||||
#[derive(Default, Debug, PartialEq, Eq, PartialOrd, Ord, Copy, Clone, Hash)]
|
#[derive(Default, Debug, PartialEq, Eq, PartialOrd, Ord, Copy, Clone, Hash)]
|
||||||
#[cfg_attr(any(feature = "proptest"), derive(proptest_derive::Arbitrary))]
|
#[cfg_attr(any(feature = "proptest"), derive(proptest_derive::Arbitrary))]
|
||||||
#[repr(u8)]
|
#[repr(u8)]
|
||||||
|
|
Loading…
Reference in a new issue