mirror of
https://github.com/hinto-janai/cuprate.git
synced 2024-11-16 15:58:14 +00:00
rpc: remove temporary lints (#255)
* rpc: remove temporary lints for types * rpc: remove temporary lints for json-rpc * rpc: remove temporary lints for interface * cfgs `1 tab` -> `4 spaces`
This commit is contained in:
parent
aeb070ae8d
commit
5648bf0da0
19 changed files with 255 additions and 322 deletions
|
@ -4,37 +4,37 @@
|
||||||
// Forbid lints.
|
// Forbid lints.
|
||||||
// Our code, and code generated (e.g macros) cannot overrule these.
|
// Our code, and code generated (e.g macros) cannot overrule these.
|
||||||
#![forbid(
|
#![forbid(
|
||||||
// `unsafe` is allowed but it _must_ be
|
// `unsafe` is allowed but it _must_ be
|
||||||
// commented with `SAFETY: reason`.
|
// commented with `SAFETY: reason`.
|
||||||
clippy::undocumented_unsafe_blocks,
|
clippy::undocumented_unsafe_blocks,
|
||||||
|
|
||||||
// Never.
|
// Never.
|
||||||
unused_unsafe,
|
unused_unsafe,
|
||||||
redundant_semicolons,
|
redundant_semicolons,
|
||||||
unused_allocation,
|
unused_allocation,
|
||||||
coherence_leak_check,
|
coherence_leak_check,
|
||||||
while_true,
|
while_true,
|
||||||
|
|
||||||
// Maybe can be put into `#[deny]`.
|
// Maybe can be put into `#[deny]`.
|
||||||
unconditional_recursion,
|
unconditional_recursion,
|
||||||
for_loops_over_fallibles,
|
for_loops_over_fallibles,
|
||||||
unused_braces,
|
unused_braces,
|
||||||
unused_labels,
|
unused_labels,
|
||||||
keyword_idents,
|
keyword_idents,
|
||||||
non_ascii_idents,
|
non_ascii_idents,
|
||||||
variant_size_differences,
|
variant_size_differences,
|
||||||
single_use_lifetimes,
|
single_use_lifetimes,
|
||||||
|
|
||||||
// Probably can be put into `#[deny]`.
|
// Probably can be put into `#[deny]`.
|
||||||
future_incompatible,
|
future_incompatible,
|
||||||
let_underscore,
|
let_underscore,
|
||||||
break_with_label_and_loop,
|
break_with_label_and_loop,
|
||||||
duplicate_macro_attributes,
|
duplicate_macro_attributes,
|
||||||
exported_private_dependencies,
|
exported_private_dependencies,
|
||||||
large_assignments,
|
large_assignments,
|
||||||
overlapping_range_endpoints,
|
overlapping_range_endpoints,
|
||||||
semicolon_in_expressions_from_macros,
|
semicolon_in_expressions_from_macros,
|
||||||
noop_method_call,
|
noop_method_call,
|
||||||
)]
|
)]
|
||||||
// Deny lints.
|
// Deny lints.
|
||||||
// Some of these are `#[allow]`'ed on a per-case basis.
|
// Some of these are `#[allow]`'ed on a per-case basis.
|
||||||
|
@ -57,39 +57,30 @@
|
||||||
unreachable_pub
|
unreachable_pub
|
||||||
)]
|
)]
|
||||||
#![allow(
|
#![allow(
|
||||||
// FIXME: this lint affects crates outside of
|
// FIXME: this lint affects crates outside of
|
||||||
// `database/` for some reason, allow for now.
|
// `database/` for some reason, allow for now.
|
||||||
clippy::cargo_common_metadata,
|
clippy::cargo_common_metadata,
|
||||||
|
|
||||||
// FIXME: adding `#[must_use]` onto everything
|
// FIXME: adding `#[must_use]` onto everything
|
||||||
// might just be more annoying than useful...
|
// might just be more annoying than useful...
|
||||||
// although it is sometimes nice.
|
// although it is sometimes nice.
|
||||||
clippy::must_use_candidate,
|
clippy::must_use_candidate,
|
||||||
|
|
||||||
// FIXME: good lint but too many false positives
|
// FIXME: good lint but too many false positives
|
||||||
// with our `Env` + `RwLock` setup.
|
// with our `Env` + `RwLock` setup.
|
||||||
clippy::significant_drop_tightening,
|
clippy::significant_drop_tightening,
|
||||||
|
|
||||||
// FIXME: good lint but is less clear in most cases.
|
// FIXME: good lint but is less clear in most cases.
|
||||||
clippy::items_after_statements,
|
clippy::items_after_statements,
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
rustdoc::bare_urls,
|
rustdoc::bare_urls,
|
||||||
|
|
||||||
clippy::module_name_repetitions,
|
clippy::multiple_crate_versions,
|
||||||
clippy::module_inception,
|
clippy::module_name_repetitions,
|
||||||
clippy::redundant_pub_crate,
|
clippy::module_inception,
|
||||||
clippy::option_if_let_else,
|
clippy::redundant_pub_crate,
|
||||||
)]
|
clippy::option_if_let_else,
|
||||||
// Allow some lints when running in debug mode.
|
|
||||||
#![cfg_attr(
|
|
||||||
debug_assertions,
|
|
||||||
allow(
|
|
||||||
clippy::todo,
|
|
||||||
clippy::multiple_crate_versions,
|
|
||||||
unused_imports,
|
|
||||||
unused_variables
|
|
||||||
)
|
|
||||||
)]
|
)]
|
||||||
// Allow some lints in tests.
|
// Allow some lints in tests.
|
||||||
#![cfg_attr(
|
#![cfg_attr(
|
||||||
|
@ -101,8 +92,6 @@
|
||||||
clippy::too_many_lines
|
clippy::too_many_lines
|
||||||
)
|
)
|
||||||
)]
|
)]
|
||||||
// TODO: remove me after finishing impl
|
|
||||||
#![allow(dead_code, unreachable_code, clippy::diverging_sub_expression)]
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------- Mod
|
//---------------------------------------------------------------------------------------------------- Mod
|
||||||
mod route;
|
mod route;
|
||||||
|
|
|
@ -81,7 +81,7 @@ macro_rules! generate_endpoints_inner {
|
||||||
// Serialize to bytes and respond.
|
// Serialize to bytes and respond.
|
||||||
match cuprate_epee_encoding::to_bytes(response) {
|
match cuprate_epee_encoding::to_bytes(response) {
|
||||||
Ok(bytes) => Ok(bytes.freeze()),
|
Ok(bytes) => Ok(bytes.freeze()),
|
||||||
Err(e) => Err(StatusCode::INTERNAL_SERVER_ERROR),
|
Err(_) => Err(StatusCode::INTERNAL_SERVER_ERROR),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +1,7 @@
|
||||||
//! Free functions.
|
//! Free functions.
|
||||||
|
|
||||||
use std::marker::PhantomData;
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------- Use
|
//---------------------------------------------------------------------------------------------------- Use
|
||||||
use axum::{
|
use axum::Router;
|
||||||
routing::{method_routing::get, post},
|
|
||||||
Router,
|
|
||||||
};
|
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
route::{bin, fallback, json_rpc, other},
|
route::{bin, fallback, json_rpc, other},
|
||||||
|
|
|
@ -21,7 +21,7 @@ use serde::{Deserialize, Serialize};
|
||||||
pub enum RpcError {}
|
pub enum RpcError {}
|
||||||
|
|
||||||
impl From<RpcError> for StatusCode {
|
impl From<RpcError> for StatusCode {
|
||||||
fn from(value: RpcError) -> Self {
|
fn from(_: RpcError) -> Self {
|
||||||
// TODO
|
// TODO
|
||||||
Self::INTERNAL_SERVER_ERROR
|
Self::INTERNAL_SERVER_ERROR
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,16 +1,10 @@
|
||||||
//! RPC handler trait.
|
//! RPC handler trait.
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------- Use
|
//---------------------------------------------------------------------------------------------------- Use
|
||||||
use std::{future::Future, task::Poll};
|
use std::future::Future;
|
||||||
|
|
||||||
use axum::{http::StatusCode, response::IntoResponse};
|
|
||||||
use futures::{channel::oneshot::channel, FutureExt};
|
|
||||||
use tower::Service;
|
use tower::Service;
|
||||||
|
|
||||||
use cuprate_helper::asynch::InfallibleOneshotReceiver;
|
|
||||||
use cuprate_json_rpc::Id;
|
|
||||||
use cuprate_rpc_types::json::JsonRpcRequest;
|
|
||||||
|
|
||||||
use crate::{rpc_error::RpcError, rpc_request::RpcRequest, rpc_response::RpcResponse};
|
use crate::{rpc_error::RpcError, rpc_request::RpcRequest, rpc_response::RpcResponse};
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------- RpcHandler
|
//---------------------------------------------------------------------------------------------------- RpcHandler
|
||||||
|
|
|
@ -3,14 +3,13 @@
|
||||||
//---------------------------------------------------------------------------------------------------- Use
|
//---------------------------------------------------------------------------------------------------- Use
|
||||||
use std::task::Poll;
|
use std::task::Poll;
|
||||||
|
|
||||||
use futures::{channel::oneshot::channel, FutureExt};
|
use futures::channel::oneshot::channel;
|
||||||
#[cfg(feature = "serde")]
|
#[cfg(feature = "serde")]
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use tower::Service;
|
use tower::Service;
|
||||||
|
|
||||||
use cuprate_helper::asynch::InfallibleOneshotReceiver;
|
use cuprate_helper::asynch::InfallibleOneshotReceiver;
|
||||||
use cuprate_json_rpc::Id;
|
use cuprate_json_rpc::Id;
|
||||||
use cuprate_rpc_types::json::JsonRpcRequest;
|
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
rpc_error::RpcError, rpc_handler::RpcHandler, rpc_request::RpcRequest,
|
rpc_error::RpcError, rpc_handler::RpcHandler, rpc_request::RpcRequest,
|
||||||
|
@ -48,7 +47,7 @@ impl Service<RpcRequest> for RpcHandlerDummy {
|
||||||
type Error = RpcError;
|
type Error = RpcError;
|
||||||
type Future = InfallibleOneshotReceiver<Result<RpcResponse, RpcError>>;
|
type Future = InfallibleOneshotReceiver<Result<RpcResponse, RpcError>>;
|
||||||
|
|
||||||
fn poll_ready(&mut self, cx: &mut std::task::Context<'_>) -> Poll<Result<(), Self::Error>> {
|
fn poll_ready(&mut self, _: &mut std::task::Context<'_>) -> Poll<Result<(), Self::Error>> {
|
||||||
Poll::Ready(Ok(()))
|
Poll::Ready(Ok(()))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,38 +3,38 @@
|
||||||
// Forbid lints.
|
// Forbid lints.
|
||||||
// Our code, and code generated (e.g macros) cannot overrule these.
|
// Our code, and code generated (e.g macros) cannot overrule these.
|
||||||
#![forbid(
|
#![forbid(
|
||||||
// `unsafe` is allowed but it _must_ be
|
// `unsafe` is allowed but it _must_ be
|
||||||
// commented with `SAFETY: reason`.
|
// commented with `SAFETY: reason`.
|
||||||
clippy::undocumented_unsafe_blocks,
|
clippy::undocumented_unsafe_blocks,
|
||||||
|
|
||||||
// Never.
|
// Never.
|
||||||
unused_unsafe,
|
unused_unsafe,
|
||||||
redundant_semicolons,
|
redundant_semicolons,
|
||||||
unused_allocation,
|
unused_allocation,
|
||||||
coherence_leak_check,
|
coherence_leak_check,
|
||||||
while_true,
|
while_true,
|
||||||
|
|
||||||
// Maybe can be put into `#[deny]`.
|
// Maybe can be put into `#[deny]`.
|
||||||
unconditional_recursion,
|
unconditional_recursion,
|
||||||
for_loops_over_fallibles,
|
for_loops_over_fallibles,
|
||||||
unused_braces,
|
unused_braces,
|
||||||
unused_labels,
|
unused_labels,
|
||||||
keyword_idents,
|
keyword_idents,
|
||||||
non_ascii_idents,
|
non_ascii_idents,
|
||||||
variant_size_differences,
|
variant_size_differences,
|
||||||
single_use_lifetimes,
|
single_use_lifetimes,
|
||||||
|
|
||||||
// Probably can be put into `#[deny]`.
|
// Probably can be put into `#[deny]`.
|
||||||
future_incompatible,
|
future_incompatible,
|
||||||
let_underscore,
|
let_underscore,
|
||||||
break_with_label_and_loop,
|
break_with_label_and_loop,
|
||||||
duplicate_macro_attributes,
|
duplicate_macro_attributes,
|
||||||
exported_private_dependencies,
|
exported_private_dependencies,
|
||||||
large_assignments,
|
large_assignments,
|
||||||
overlapping_range_endpoints,
|
overlapping_range_endpoints,
|
||||||
semicolon_in_expressions_from_macros,
|
semicolon_in_expressions_from_macros,
|
||||||
noop_method_call,
|
noop_method_call,
|
||||||
unreachable_pub,
|
unreachable_pub,
|
||||||
)]
|
)]
|
||||||
// Deny lints.
|
// Deny lints.
|
||||||
// Some of these are `#[allow]`'ed on a per-case basis.
|
// Some of these are `#[allow]`'ed on a per-case basis.
|
||||||
|
@ -56,29 +56,27 @@
|
||||||
nonstandard_style
|
nonstandard_style
|
||||||
)]
|
)]
|
||||||
#![allow(
|
#![allow(
|
||||||
// FIXME: this lint affects crates outside of
|
// FIXME: this lint affects crates outside of
|
||||||
// `database/` for some reason, allow for now.
|
// `database/` for some reason, allow for now.
|
||||||
clippy::cargo_common_metadata,
|
clippy::cargo_common_metadata,
|
||||||
|
|
||||||
// FIXME: adding `#[must_use]` onto everything
|
// FIXME: adding `#[must_use]` onto everything
|
||||||
// might just be more annoying than useful...
|
// might just be more annoying than useful...
|
||||||
// although it is sometimes nice.
|
// although it is sometimes nice.
|
||||||
clippy::must_use_candidate,
|
clippy::must_use_candidate,
|
||||||
|
|
||||||
// FIXME: good lint but too many false positives
|
// FIXME: good lint but too many false positives
|
||||||
// with our `Env` + `RwLock` setup.
|
// with our `Env` + `RwLock` setup.
|
||||||
clippy::significant_drop_tightening,
|
clippy::significant_drop_tightening,
|
||||||
|
|
||||||
// FIXME: good lint but is less clear in most cases.
|
// FIXME: good lint but is less clear in most cases.
|
||||||
clippy::items_after_statements,
|
clippy::items_after_statements,
|
||||||
|
|
||||||
clippy::module_name_repetitions,
|
clippy::module_name_repetitions,
|
||||||
clippy::module_inception,
|
clippy::module_inception,
|
||||||
clippy::redundant_pub_crate,
|
clippy::redundant_pub_crate,
|
||||||
clippy::option_if_let_else,
|
clippy::option_if_let_else,
|
||||||
)]
|
)]
|
||||||
// Allow some lints when running in debug mode.
|
|
||||||
#![cfg_attr(debug_assertions, allow(clippy::todo, clippy::multiple_crate_versions))]
|
|
||||||
// Allow some lints in tests.
|
// Allow some lints in tests.
|
||||||
#![cfg_attr(
|
#![cfg_attr(
|
||||||
test,
|
test,
|
||||||
|
|
|
@ -13,22 +13,17 @@ use cuprate_epee_encoding::{
|
||||||
container_as_blob::ContainerAsBlob,
|
container_as_blob::ContainerAsBlob,
|
||||||
epee_object, error,
|
epee_object, error,
|
||||||
macros::bytes::{Buf, BufMut},
|
macros::bytes::{Buf, BufMut},
|
||||||
read_epee_value, write_field, EpeeObject, EpeeObjectBuilder, EpeeValue,
|
read_epee_value, write_field, EpeeObject, EpeeObjectBuilder,
|
||||||
};
|
};
|
||||||
|
|
||||||
use cuprate_types::BlockCompleteEntry;
|
use cuprate_types::BlockCompleteEntry;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
base::{AccessResponseBase, ResponseBase},
|
base::AccessResponseBase,
|
||||||
defaults::{default_false, default_height, default_string, default_vec, default_zero},
|
defaults::{default_false, default_zero},
|
||||||
free::{is_one, is_zero},
|
|
||||||
macros::{define_request, define_request_and_response, define_request_and_response_doc},
|
macros::{define_request, define_request_and_response, define_request_and_response_doc},
|
||||||
misc::{
|
misc::{BlockOutputIndices, GetOutputsOut, OutKeyBin, PoolInfoExtent, PoolTxInfo, Status},
|
||||||
AuxPow, BlockHeader, BlockOutputIndices, ChainInfo, ConnectionInfo, GetBan, GetOutputsOut,
|
rpc_call::RpcCallValue,
|
||||||
HardforkEntry, HistogramEntry, OutKeyBin, OutputDistributionData, Peer, PoolInfoExtent,
|
|
||||||
PoolTxInfo, SetBan, Span, Status, TxBacklogEntry,
|
|
||||||
},
|
|
||||||
rpc_call::{RpcCall, RpcCallValue},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------- Definitions
|
//---------------------------------------------------------------------------------------------------- Definitions
|
||||||
|
|
|
@ -8,7 +8,6 @@
|
||||||
//! `height`, it will use [`default_height`] to fill that in.
|
//! `height`, it will use [`default_height`] to fill that in.
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------- Import
|
//---------------------------------------------------------------------------------------------------- Import
|
||||||
use std::borrow::Cow;
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------- TODO
|
//---------------------------------------------------------------------------------------------------- TODO
|
||||||
/// Default [`bool`] type used in request/response types, `false`.
|
/// Default [`bool`] type used in request/response types, `false`.
|
||||||
|
@ -23,12 +22,6 @@ pub(crate) const fn default_true() -> bool {
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Default `Cow<'static, str` type used in request/response types.
|
|
||||||
#[inline]
|
|
||||||
pub(crate) const fn default_cow_str() -> Cow<'static, str> {
|
|
||||||
Cow::Borrowed("")
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Default [`String`] type used in request/response types.
|
/// Default [`String`] type used in request/response types.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub(crate) const fn default_string() -> String {
|
pub(crate) const fn default_string() -> String {
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
/// 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 `&`
|
#[allow(clippy::trivially_copy_pass_by_ref)] // serde needs `&`
|
||||||
|
#[allow(dead_code)] // 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
|
||||||
}
|
}
|
||||||
|
@ -13,6 +14,7 @@ pub(crate) const fn is_zero(u: &u64) -> bool {
|
||||||
/// 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 `&`
|
#[allow(clippy::trivially_copy_pass_by_ref)] // serde needs `&`
|
||||||
|
#[allow(dead_code)] // 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
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,12 +12,11 @@ use crate::{
|
||||||
default_false, default_height, default_one, default_string, default_true, default_vec,
|
default_false, default_height, default_one, default_string, default_true, default_vec,
|
||||||
default_zero,
|
default_zero,
|
||||||
},
|
},
|
||||||
free::{is_one, is_zero},
|
|
||||||
macros::define_request_and_response,
|
macros::define_request_and_response,
|
||||||
misc::{
|
misc::{
|
||||||
AuxPow, BlockHeader, ChainInfo, ConnectionInfo, Distribution, GetBan,
|
AuxPow, BlockHeader, ChainInfo, ConnectionInfo, Distribution, GetBan,
|
||||||
GetMinerDataTxBacklogEntry, HardforkEntry, HistogramEntry, OutputDistributionData, SetBan,
|
GetMinerDataTxBacklogEntry, HardforkEntry, HistogramEntry, SetBan, Span, Status,
|
||||||
Span, Status, SyncInfoPeer, TxBacklogEntry,
|
SyncInfoPeer, TxBacklogEntry,
|
||||||
},
|
},
|
||||||
rpc_call::RpcCallValue,
|
rpc_call::RpcCallValue,
|
||||||
};
|
};
|
||||||
|
|
|
@ -4,37 +4,37 @@
|
||||||
// Forbid lints.
|
// Forbid lints.
|
||||||
// Our code, and code generated (e.g macros) cannot overrule these.
|
// Our code, and code generated (e.g macros) cannot overrule these.
|
||||||
#![forbid(
|
#![forbid(
|
||||||
// `unsafe` is allowed but it _must_ be
|
// `unsafe` is allowed but it _must_ be
|
||||||
// commented with `SAFETY: reason`.
|
// commented with `SAFETY: reason`.
|
||||||
clippy::undocumented_unsafe_blocks,
|
clippy::undocumented_unsafe_blocks,
|
||||||
|
|
||||||
// Never.
|
// Never.
|
||||||
unused_unsafe,
|
unused_unsafe,
|
||||||
redundant_semicolons,
|
redundant_semicolons,
|
||||||
unused_allocation,
|
unused_allocation,
|
||||||
coherence_leak_check,
|
coherence_leak_check,
|
||||||
while_true,
|
while_true,
|
||||||
|
|
||||||
// Maybe can be put into `#[deny]`.
|
// Maybe can be put into `#[deny]`.
|
||||||
unconditional_recursion,
|
unconditional_recursion,
|
||||||
for_loops_over_fallibles,
|
for_loops_over_fallibles,
|
||||||
unused_braces,
|
unused_braces,
|
||||||
unused_labels,
|
unused_labels,
|
||||||
keyword_idents,
|
keyword_idents,
|
||||||
non_ascii_idents,
|
non_ascii_idents,
|
||||||
variant_size_differences,
|
variant_size_differences,
|
||||||
single_use_lifetimes,
|
single_use_lifetimes,
|
||||||
|
|
||||||
// Probably can be put into `#[deny]`.
|
// Probably can be put into `#[deny]`.
|
||||||
future_incompatible,
|
future_incompatible,
|
||||||
let_underscore,
|
let_underscore,
|
||||||
break_with_label_and_loop,
|
break_with_label_and_loop,
|
||||||
duplicate_macro_attributes,
|
duplicate_macro_attributes,
|
||||||
exported_private_dependencies,
|
exported_private_dependencies,
|
||||||
large_assignments,
|
large_assignments,
|
||||||
overlapping_range_endpoints,
|
overlapping_range_endpoints,
|
||||||
semicolon_in_expressions_from_macros,
|
semicolon_in_expressions_from_macros,
|
||||||
noop_method_call,
|
noop_method_call,
|
||||||
)]
|
)]
|
||||||
// Deny lints.
|
// Deny lints.
|
||||||
// Some of these are `#[allow]`'ed on a per-case basis.
|
// Some of these are `#[allow]`'ed on a per-case basis.
|
||||||
|
@ -57,39 +57,27 @@
|
||||||
unreachable_pub
|
unreachable_pub
|
||||||
)]
|
)]
|
||||||
#![allow(
|
#![allow(
|
||||||
// FIXME: this lint affects crates outside of
|
// FIXME: this lint affects crates outside of
|
||||||
// `database/` for some reason, allow for now.
|
// `database/` for some reason, allow for now.
|
||||||
clippy::cargo_common_metadata,
|
clippy::cargo_common_metadata,
|
||||||
|
|
||||||
// FIXME: adding `#[must_use]` onto everything
|
// FIXME: adding `#[must_use]` onto everything
|
||||||
// might just be more annoying than useful...
|
// might just be more annoying than useful...
|
||||||
// although it is sometimes nice.
|
// although it is sometimes nice.
|
||||||
clippy::must_use_candidate,
|
clippy::must_use_candidate,
|
||||||
|
|
||||||
// FIXME: good lint but too many false positives
|
// FIXME: good lint but too many false positives
|
||||||
// with our `Env` + `RwLock` setup.
|
// with our `Env` + `RwLock` setup.
|
||||||
clippy::significant_drop_tightening,
|
clippy::significant_drop_tightening,
|
||||||
|
|
||||||
// FIXME: good lint but is less clear in most cases.
|
// FIXME: good lint but is less clear in most cases.
|
||||||
clippy::items_after_statements,
|
clippy::items_after_statements,
|
||||||
|
|
||||||
// TODO
|
clippy::multiple_crate_versions,
|
||||||
rustdoc::bare_urls,
|
clippy::module_name_repetitions,
|
||||||
|
clippy::module_inception,
|
||||||
clippy::module_name_repetitions,
|
clippy::redundant_pub_crate,
|
||||||
clippy::module_inception,
|
clippy::option_if_let_else,
|
||||||
clippy::redundant_pub_crate,
|
|
||||||
clippy::option_if_let_else,
|
|
||||||
)]
|
|
||||||
// Allow some lints when running in debug mode.
|
|
||||||
#![cfg_attr(
|
|
||||||
debug_assertions,
|
|
||||||
allow(
|
|
||||||
clippy::todo,
|
|
||||||
clippy::multiple_crate_versions,
|
|
||||||
unused_imports,
|
|
||||||
unused_variables
|
|
||||||
)
|
|
||||||
)]
|
)]
|
||||||
// Allow some lints in tests.
|
// Allow some lints in tests.
|
||||||
#![cfg_attr(
|
#![cfg_attr(
|
||||||
|
@ -101,11 +89,6 @@
|
||||||
clippy::too_many_lines
|
clippy::too_many_lines
|
||||||
)
|
)
|
||||||
)]
|
)]
|
||||||
// TODO: remove me after finishing impl
|
|
||||||
#![allow(
|
|
||||||
dead_code,
|
|
||||||
rustdoc::broken_intra_doc_links // TODO: remove after `{bin,json,other}.rs` gets merged
|
|
||||||
)]
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------- Mod
|
//---------------------------------------------------------------------------------------------------- Mod
|
||||||
mod constants;
|
mod constants;
|
||||||
|
|
|
@ -1,17 +1,14 @@
|
||||||
//! Output distributions for [`crate::json::GetOutputDistributionResponse`].
|
//! Output distributions for [`crate::json::GetOutputDistributionResponse`].
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------- Use
|
//---------------------------------------------------------------------------------------------------- Use
|
||||||
use std::mem::size_of;
|
|
||||||
|
|
||||||
#[cfg(feature = "serde")]
|
#[cfg(feature = "serde")]
|
||||||
use serde::{ser::SerializeStruct, Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[cfg(feature = "epee")]
|
#[cfg(feature = "epee")]
|
||||||
use cuprate_epee_encoding::{
|
use cuprate_epee_encoding::{
|
||||||
epee_object, error,
|
epee_object, error,
|
||||||
macros::bytes::{Buf, BufMut},
|
macros::bytes::{Buf, BufMut},
|
||||||
read_epee_value, read_varint, write_field, write_varint, EpeeObject, EpeeObjectBuilder,
|
read_epee_value, write_field, EpeeObject, EpeeObjectBuilder, EpeeValue,
|
||||||
EpeeValue, Marker,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------- Free
|
//---------------------------------------------------------------------------------------------------- Free
|
||||||
|
@ -24,7 +21,7 @@ use cuprate_epee_encoding::{
|
||||||
45..=55
|
45..=55
|
||||||
)]
|
)]
|
||||||
#[cfg(feature = "epee")]
|
#[cfg(feature = "epee")]
|
||||||
fn compress_integer_array(array: &[u64]) -> error::Result<Vec<u8>> {
|
fn compress_integer_array(_: &[u64]) -> error::Result<Vec<u8>> {
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,7 +33,7 @@ fn compress_integer_array(array: &[u64]) -> error::Result<Vec<u8>> {
|
||||||
"rpc/core_rpc_server_commands_defs.h",
|
"rpc/core_rpc_server_commands_defs.h",
|
||||||
57..=72
|
57..=72
|
||||||
)]
|
)]
|
||||||
fn decompress_integer_array(array: &[u8]) -> Vec<u64> {
|
fn decompress_integer_array(_: &[u8]) -> Vec<u64> {
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -281,9 +278,9 @@ impl EpeeObject for Distribution {
|
||||||
//---------------------------------------------------------------------------------------------------- Tests
|
//---------------------------------------------------------------------------------------------------- Tests
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use pretty_assertions::assert_eq;
|
// use pretty_assertions::assert_eq;
|
||||||
|
|
||||||
use super::*;
|
// use super::*;
|
||||||
|
|
||||||
// TODO: re-enable tests after (de)compression functions are implemented.
|
// TODO: re-enable tests after (de)compression functions are implemented.
|
||||||
|
|
||||||
|
|
|
@ -5,23 +5,13 @@
|
||||||
//! the [`crate::misc::ConnectionInfo`] struct defined here.
|
//! the [`crate::misc::ConnectionInfo`] struct defined here.
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------- Import
|
//---------------------------------------------------------------------------------------------------- Import
|
||||||
use std::fmt::Display;
|
|
||||||
|
|
||||||
#[cfg(feature = "serde")]
|
#[cfg(feature = "serde")]
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[cfg(feature = "epee")]
|
#[cfg(feature = "epee")]
|
||||||
use cuprate_epee_encoding::{
|
use cuprate_epee_encoding::epee_object;
|
||||||
epee_object,
|
|
||||||
macros::bytes::{Buf, BufMut},
|
|
||||||
EpeeValue, Marker,
|
|
||||||
};
|
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
constants::{
|
|
||||||
CORE_RPC_STATUS_BUSY, CORE_RPC_STATUS_NOT_MINING, CORE_RPC_STATUS_OK,
|
|
||||||
CORE_RPC_STATUS_PAYMENT_REQUIRED,
|
|
||||||
},
|
|
||||||
defaults::{default_string, default_zero},
|
defaults::{default_string, default_zero},
|
||||||
macros::monero_definition_link,
|
macros::monero_definition_link,
|
||||||
};
|
};
|
||||||
|
|
|
@ -8,9 +8,9 @@ use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[cfg(feature = "epee")]
|
#[cfg(feature = "epee")]
|
||||||
use cuprate_epee_encoding::{
|
use cuprate_epee_encoding::{
|
||||||
epee_object, error,
|
error,
|
||||||
macros::bytes::{Buf, BufMut},
|
macros::bytes::{Buf, BufMut},
|
||||||
read_epee_value, write_field, EpeeObject, EpeeObjectBuilder, EpeeValue, Marker,
|
EpeeObject, EpeeObjectBuilder,
|
||||||
};
|
};
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------- TxEntry
|
//---------------------------------------------------------------------------------------------------- TxEntry
|
||||||
|
@ -123,7 +123,7 @@ impl Default for TxEntry {
|
||||||
//---------------------------------------------------------------------------------------------------- Epee
|
//---------------------------------------------------------------------------------------------------- Epee
|
||||||
#[cfg(feature = "epee")]
|
#[cfg(feature = "epee")]
|
||||||
impl EpeeObjectBuilder<TxEntry> for () {
|
impl EpeeObjectBuilder<TxEntry> for () {
|
||||||
fn add_field<B: Buf>(&mut self, name: &str, r: &mut B) -> error::Result<bool> {
|
fn add_field<B: Buf>(&mut self, _: &str, _: &mut B) -> error::Result<bool> {
|
||||||
unreachable!()
|
unreachable!()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -140,7 +140,7 @@ impl EpeeObject for TxEntry {
|
||||||
unreachable!()
|
unreachable!()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn write_fields<B: BufMut>(self, w: &mut B) -> error::Result<()> {
|
fn write_fields<B: BufMut>(self, _: &mut B) -> error::Result<()> {
|
||||||
unreachable!()
|
unreachable!()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,10 +11,9 @@ use crate::{
|
||||||
defaults::{default_false, default_string, default_true, default_vec, default_zero},
|
defaults::{default_false, default_string, default_true, default_vec, default_zero},
|
||||||
macros::define_request_and_response,
|
macros::define_request_and_response,
|
||||||
misc::{
|
misc::{
|
||||||
GetOutputsOut, KeyImageSpentStatus, OutKey, Peer, PublicNode, SpentKeyImageInfo, Status,
|
GetOutputsOut, OutKey, Peer, PublicNode, SpentKeyImageInfo, Status, TxEntry, TxInfo,
|
||||||
TxEntry, TxInfo, TxpoolStats,
|
TxpoolStats,
|
||||||
},
|
},
|
||||||
rpc_call::RpcCall,
|
|
||||||
RpcCallValue,
|
RpcCallValue,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -191,7 +190,7 @@ define_request_and_response! {
|
||||||
}
|
}
|
||||||
)]
|
)]
|
||||||
AccessResponseBase {
|
AccessResponseBase {
|
||||||
/// FIXME: These are [`KeyImageSpentStatus`] in [`u8`] form.
|
/// FIXME: These are [`KeyImageSpentStatus`](crate::misc::KeyImageSpentStatus) in [`u8`] form.
|
||||||
spent_status: Vec<u8>,
|
spent_status: Vec<u8>,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,5 +28,5 @@ where
|
||||||
//---------------------------------------------------------------------------------------------------- Tests
|
//---------------------------------------------------------------------------------------------------- Tests
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod test {
|
mod test {
|
||||||
use super::*;
|
// use super::*;
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,39 +3,39 @@
|
||||||
// Forbid lints.
|
// Forbid lints.
|
||||||
// Our code, and code generated (e.g macros) cannot overrule these.
|
// Our code, and code generated (e.g macros) cannot overrule these.
|
||||||
#![forbid(
|
#![forbid(
|
||||||
// `unsafe` is allowed but it _must_ be
|
// `unsafe` is allowed but it _must_ be
|
||||||
// commented with `SAFETY: reason`.
|
// commented with `SAFETY: reason`.
|
||||||
clippy::undocumented_unsafe_blocks,
|
clippy::undocumented_unsafe_blocks,
|
||||||
|
|
||||||
// Never.
|
// Never.
|
||||||
unused_unsafe,
|
unused_unsafe,
|
||||||
redundant_semicolons,
|
redundant_semicolons,
|
||||||
unused_allocation,
|
unused_allocation,
|
||||||
coherence_leak_check,
|
coherence_leak_check,
|
||||||
while_true,
|
while_true,
|
||||||
clippy::missing_docs_in_private_items,
|
clippy::missing_docs_in_private_items,
|
||||||
|
|
||||||
// Maybe can be put into `#[deny]`.
|
// Maybe can be put into `#[deny]`.
|
||||||
unconditional_recursion,
|
unconditional_recursion,
|
||||||
for_loops_over_fallibles,
|
for_loops_over_fallibles,
|
||||||
unused_braces,
|
unused_braces,
|
||||||
unused_labels,
|
unused_labels,
|
||||||
keyword_idents,
|
keyword_idents,
|
||||||
non_ascii_idents,
|
non_ascii_idents,
|
||||||
variant_size_differences,
|
variant_size_differences,
|
||||||
single_use_lifetimes,
|
single_use_lifetimes,
|
||||||
|
|
||||||
// Probably can be put into `#[deny]`.
|
// Probably can be put into `#[deny]`.
|
||||||
future_incompatible,
|
future_incompatible,
|
||||||
let_underscore,
|
let_underscore,
|
||||||
break_with_label_and_loop,
|
break_with_label_and_loop,
|
||||||
duplicate_macro_attributes,
|
duplicate_macro_attributes,
|
||||||
exported_private_dependencies,
|
exported_private_dependencies,
|
||||||
large_assignments,
|
large_assignments,
|
||||||
overlapping_range_endpoints,
|
overlapping_range_endpoints,
|
||||||
semicolon_in_expressions_from_macros,
|
semicolon_in_expressions_from_macros,
|
||||||
noop_method_call,
|
noop_method_call,
|
||||||
unreachable_pub,
|
unreachable_pub,
|
||||||
)]
|
)]
|
||||||
// Deny lints.
|
// Deny lints.
|
||||||
// Some of these are `#[allow]`'ed on a per-case basis.
|
// Some of these are `#[allow]`'ed on a per-case basis.
|
||||||
|
@ -58,26 +58,26 @@
|
||||||
nonstandard_style
|
nonstandard_style
|
||||||
)]
|
)]
|
||||||
#![allow(
|
#![allow(
|
||||||
// FIXME: this lint affects crates outside of
|
// FIXME: this lint affects crates outside of
|
||||||
// `database/` for some reason, allow for now.
|
// `database/` for some reason, allow for now.
|
||||||
clippy::cargo_common_metadata,
|
clippy::cargo_common_metadata,
|
||||||
|
|
||||||
// FIXME: adding `#[must_use]` onto everything
|
// FIXME: adding `#[must_use]` onto everything
|
||||||
// might just be more annoying than useful...
|
// might just be more annoying than useful...
|
||||||
// although it is sometimes nice.
|
// although it is sometimes nice.
|
||||||
clippy::must_use_candidate,
|
clippy::must_use_candidate,
|
||||||
|
|
||||||
// FIXME: good lint but too many false positives
|
// FIXME: good lint but too many false positives
|
||||||
// with our `Env` + `RwLock` setup.
|
// with our `Env` + `RwLock` setup.
|
||||||
clippy::significant_drop_tightening,
|
clippy::significant_drop_tightening,
|
||||||
|
|
||||||
// FIXME: good lint but is less clear in most cases.
|
// FIXME: good lint but is less clear in most cases.
|
||||||
clippy::items_after_statements,
|
clippy::items_after_statements,
|
||||||
|
|
||||||
clippy::module_name_repetitions,
|
clippy::module_name_repetitions,
|
||||||
clippy::module_inception,
|
clippy::module_inception,
|
||||||
clippy::redundant_pub_crate,
|
clippy::redundant_pub_crate,
|
||||||
clippy::option_if_let_else,
|
clippy::option_if_let_else,
|
||||||
)]
|
)]
|
||||||
// Allow some lints when running in debug mode.
|
// Allow some lints when running in debug mode.
|
||||||
#![cfg_attr(
|
#![cfg_attr(
|
||||||
|
|
|
@ -3,39 +3,39 @@
|
||||||
// Forbid lints.
|
// Forbid lints.
|
||||||
// Our code, and code generated (e.g macros) cannot overrule these.
|
// Our code, and code generated (e.g macros) cannot overrule these.
|
||||||
#![forbid(
|
#![forbid(
|
||||||
// `unsafe` is allowed but it _must_ be
|
// `unsafe` is allowed but it _must_ be
|
||||||
// commented with `SAFETY: reason`.
|
// commented with `SAFETY: reason`.
|
||||||
clippy::undocumented_unsafe_blocks,
|
clippy::undocumented_unsafe_blocks,
|
||||||
|
|
||||||
// Never.
|
// Never.
|
||||||
unused_unsafe,
|
unused_unsafe,
|
||||||
redundant_semicolons,
|
redundant_semicolons,
|
||||||
unused_allocation,
|
unused_allocation,
|
||||||
coherence_leak_check,
|
coherence_leak_check,
|
||||||
while_true,
|
while_true,
|
||||||
clippy::missing_docs_in_private_items,
|
clippy::missing_docs_in_private_items,
|
||||||
|
|
||||||
// Maybe can be put into `#[deny]`.
|
// Maybe can be put into `#[deny]`.
|
||||||
unconditional_recursion,
|
unconditional_recursion,
|
||||||
for_loops_over_fallibles,
|
for_loops_over_fallibles,
|
||||||
unused_braces,
|
unused_braces,
|
||||||
unused_labels,
|
unused_labels,
|
||||||
keyword_idents,
|
keyword_idents,
|
||||||
non_ascii_idents,
|
non_ascii_idents,
|
||||||
variant_size_differences,
|
variant_size_differences,
|
||||||
single_use_lifetimes,
|
single_use_lifetimes,
|
||||||
|
|
||||||
// Probably can be put into `#[deny]`.
|
// Probably can be put into `#[deny]`.
|
||||||
future_incompatible,
|
future_incompatible,
|
||||||
let_underscore,
|
let_underscore,
|
||||||
break_with_label_and_loop,
|
break_with_label_and_loop,
|
||||||
duplicate_macro_attributes,
|
duplicate_macro_attributes,
|
||||||
exported_private_dependencies,
|
exported_private_dependencies,
|
||||||
large_assignments,
|
large_assignments,
|
||||||
overlapping_range_endpoints,
|
overlapping_range_endpoints,
|
||||||
semicolon_in_expressions_from_macros,
|
semicolon_in_expressions_from_macros,
|
||||||
noop_method_call,
|
noop_method_call,
|
||||||
unreachable_pub,
|
unreachable_pub,
|
||||||
)]
|
)]
|
||||||
// Deny lints.
|
// Deny lints.
|
||||||
// Some of these are `#[allow]`'ed on a per-case basis.
|
// Some of these are `#[allow]`'ed on a per-case basis.
|
||||||
|
@ -58,28 +58,28 @@
|
||||||
nonstandard_style
|
nonstandard_style
|
||||||
)]
|
)]
|
||||||
#![allow(
|
#![allow(
|
||||||
// FIXME: this lint affects crates outside of
|
// FIXME: this lint affects crates outside of
|
||||||
// `database/` for some reason, allow for now.
|
// `database/` for some reason, allow for now.
|
||||||
clippy::cargo_common_metadata,
|
clippy::cargo_common_metadata,
|
||||||
|
|
||||||
// FIXME: adding `#[must_use]` onto everything
|
// FIXME: adding `#[must_use]` onto everything
|
||||||
// might just be more annoying than useful...
|
// might just be more annoying than useful...
|
||||||
// although it is sometimes nice.
|
// although it is sometimes nice.
|
||||||
clippy::must_use_candidate,
|
clippy::must_use_candidate,
|
||||||
|
|
||||||
// FIXME: good lint but too many false positives
|
// FIXME: good lint but too many false positives
|
||||||
// with our `Env` + `RwLock` setup.
|
// with our `Env` + `RwLock` setup.
|
||||||
clippy::significant_drop_tightening,
|
clippy::significant_drop_tightening,
|
||||||
|
|
||||||
// FIXME: good lint but is less clear in most cases.
|
// FIXME: good lint but is less clear in most cases.
|
||||||
clippy::items_after_statements,
|
clippy::items_after_statements,
|
||||||
|
|
||||||
clippy::module_name_repetitions,
|
clippy::module_name_repetitions,
|
||||||
clippy::module_inception,
|
clippy::module_inception,
|
||||||
clippy::redundant_pub_crate,
|
clippy::redundant_pub_crate,
|
||||||
clippy::option_if_let_else,
|
clippy::option_if_let_else,
|
||||||
|
|
||||||
// unused_crate_dependencies, // false-positive with `paste`
|
// unused_crate_dependencies, // false-positive with `paste`
|
||||||
)]
|
)]
|
||||||
// Allow some lints when running in debug mode.
|
// Allow some lints when running in debug mode.
|
||||||
#![cfg_attr(
|
#![cfg_attr(
|
||||||
|
|
Loading…
Reference in a new issue