test-utils: enable workspace lints (#283)

* test-utils: enable workspace lints + fix

* `allow` -> `expect`

* fixes
This commit is contained in:
hinto-janai 2024-09-18 18:14:31 -04:00 committed by GitHub
parent b9842fcb18
commit 2afc0e8373
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 25 additions and 45 deletions

1
Cargo.lock generated
View file

@ -840,7 +840,6 @@ version = "0.1.0"
dependencies = [
"async-trait",
"borsh",
"bytes",
"cuprate-helper",
"cuprate-p2p-core",
"cuprate-types",

View file

@ -22,11 +22,13 @@ tokio = { workspace = true, features = ["full"] }
tokio-util = { workspace = true }
serde = { workspace = true }
serde_json = { workspace = true }
bytes = { workspace = true, features = ["std"] }
tempfile = { workspace = true }
paste = { workspace = true }
borsh = { workspace = true, features = ["derive"]}
[dev-dependencies]
hex = { workspace = true }
pretty_assertions = { workspace = true }
pretty_assertions = { workspace = true }
[lints]
workspace = true

View file

@ -148,8 +148,8 @@ pub fn tx_fee(tx: &Transaction) -> u64 {
///
/// This requires some static block/tx input (from data) and some fields.
/// This data can be accessed more easily via:
/// - A block explorer (https://xmrchain.net)
/// - Monero RPC (see cuprate_test_utils::rpc for this)
/// - A block explorer (<https://xmrchain.net>)
/// - Monero RPC (see `cuprate_test_utils::rpc` for this)
///
/// See below for actual usage.
macro_rules! verified_block_information {

View file

@ -178,6 +178,7 @@ impl Drop for SpawnedMoneroD {
println!("------END-MONEROD-LOGS------");
}
#[expect(clippy::manual_assert, reason = "`if` is more clear")]
if error && !panicking() {
// `println` only outputs in a test when panicking so if there is an error while
// dropping monerod but not an error in the test then we need to panic to make sure

View file

@ -47,13 +47,13 @@ impl HttpRpcClient {
}
/// The address used for this [`HttpRpcClient`].
#[allow(dead_code)]
#[allow(clippy::allow_attributes, dead_code, reason = "expect doesn't work")]
const fn address(&self) -> &String {
&self.address
}
/// Access to the inner RPC client for other usage.
#[allow(dead_code)]
#[expect(dead_code)]
const fn rpc(&self) -> &SimpleRequestRpc {
&self.rpc
}
@ -197,7 +197,7 @@ mod tests {
#[ignore] // FIXME: doesn't work in CI, we need a real unrestricted node
#[tokio::test]
async fn get() {
#[allow(clippy::too_many_arguments)]
#[expect(clippy::too_many_arguments)]
async fn assert_eq(
rpc: &HttpRpcClient,
height: usize,

View file

@ -156,13 +156,5 @@ macro_rules! define_request_and_response_doc_test {
"```\n",
)
};
// No doc test.
(
$name:ident,
$test:ident,
) => {
""
};
}
pub(super) use define_request_and_response_doc_test;

View file

@ -8,8 +8,7 @@ define_request_and_response! {
// `(other)` adds a JSON sanity-check test.
get_height (other),
GET_HEIGHT: &str,
Request =
r#"{}"#;
Request = "{}";
Response =
r#"{
"hash": "68bb1a1cff8e2a44c3221e8e1aff80bc6ca45d06fa8eff4d2a3a7ac31d4efe3f",
@ -53,8 +52,7 @@ r#"{
define_request_and_response! {
get_alt_blocks_hashes (other),
GET_ALT_BLOCKS_HASHES: &str,
Request =
r#"{}"#;
Request = "{}";
Response =
r#"{
"blks_hashes": ["8ee10db35b1baf943f201b303890a29e7d45437bd76c2bd4df0d2f2ee34be109"],
@ -134,8 +132,7 @@ r#"{
define_request_and_response! {
stop_mining (other),
STOP_MINING: &str,
Request =
r#"{}"#;
Request = "{}";
Response =
r#"{
"status": "OK",
@ -146,8 +143,7 @@ r#"{
define_request_and_response! {
mining_status (other),
MINING_STATUS: &str,
Request =
r#"{}"#;
Request = "{}";
Response =
r#"{
"active": false,
@ -173,8 +169,7 @@ r#"{
define_request_and_response! {
save_bc (other),
SAVE_BC: &str,
Request =
r#"{}"#;
Request = "{}";
Response =
r#"{
"status": "OK",
@ -185,8 +180,7 @@ r#"{
define_request_and_response! {
get_peer_list (other),
GET_PEER_LIST: &str,
Request =
r#"{}"#;
Request = "{}";
Response =
r#"{
"gray_list": [{
@ -291,8 +285,7 @@ r#"{
define_request_and_response! {
get_transaction_pool (other),
GET_TRANSACTION_POOL: &str,
Request =
r#"{}"#;
Request = "{}";
Response =
r#"{
"credits": 0,
@ -598,8 +591,7 @@ r#"{
define_request_and_response! {
get_transaction_pool_stats (other),
GET_TRANSACTION_POOL_STATS: &str,
Request =
r#"{}"#;
Request = "{}";
Response =
r#"{
"credits": 0,
@ -657,8 +649,7 @@ r#"{
define_request_and_response! {
stop_daemon (other),
STOP_DAEMON: &str,
Request =
r#"{}"#;
Request = "{}";
Response =
r#"{
"status": "OK"
@ -668,8 +659,7 @@ r#"{
define_request_and_response! {
get_limit (other),
GET_LIMIT: &str,
Request =
r#"{}"#;
Request = "{}";
Response =
r#"{
"limit_down": 1280000,
@ -713,8 +703,7 @@ r#"{
define_request_and_response! {
get_net_stats (other),
GET_NET_STATS: &str,
Request =
r#"{}"#;
Request = "{}";
Response =
r#"{
"start_time": 1721251858,
@ -801,8 +790,7 @@ r#"{
define_request_and_response! {
UNDOCUMENTED_ENDPOINT (other),
GET_TRANSACTION_POOL_HASHES: &str,
Request =
r#"{}"#;
Request = "{}";
Response =
r#"{
"credits": 0,
@ -835,8 +823,7 @@ r#"{
define_request_and_response! {
UNDOCUMENTED_ENDPOINT (other),
GET_PUBLIC_NODES: &str,
Request =
r#"{}"#;
Request = "{}";
Response =
r#"{
"status": "OK",

View file

@ -86,9 +86,8 @@ impl<const ALLOW_SYNC: bool, const DANDELION_PP: bool, const CHECK_NODE_ID: bool
type Sink = FramedWrite<WriteHalf<DuplexStream>, MoneroWireCodec>;
type Listener = Pin<
Box<
dyn Stream<
Item = Result<(Option<Self::Addr>, Self::Stream, Self::Sink), std::io::Error>,
> + Send
dyn Stream<Item = Result<(Option<Self::Addr>, Self::Stream, Self::Sink), Error>>
+ Send
+ 'static,
>,
>;