diff --git a/Cargo.lock b/Cargo.lock index 0bb4612..3a435a3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -840,7 +840,6 @@ version = "0.1.0" dependencies = [ "async-trait", "borsh", - "bytes", "cuprate-helper", "cuprate-p2p-core", "cuprate-types", diff --git a/test-utils/Cargo.toml b/test-utils/Cargo.toml index a96a9cf..b2fafd9 100644 --- a/test-utils/Cargo.toml +++ b/test-utils/Cargo.toml @@ -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 } \ No newline at end of file +pretty_assertions = { workspace = true } + +[lints] +workspace = true \ No newline at end of file diff --git a/test-utils/src/data/statics.rs b/test-utils/src/data/statics.rs index 8b98171..474e35c 100644 --- a/test-utils/src/data/statics.rs +++ b/test-utils/src/data/statics.rs @@ -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 () +/// - Monero RPC (see `cuprate_test_utils::rpc` for this) /// /// See below for actual usage. macro_rules! verified_block_information { diff --git a/test-utils/src/monerod.rs b/test-utils/src/monerod.rs index 9ffa08d..abad4c9 100644 --- a/test-utils/src/monerod.rs +++ b/test-utils/src/monerod.rs @@ -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 diff --git a/test-utils/src/rpc/client.rs b/test-utils/src/rpc/client.rs index fbe6fb9..25240ae 100644 --- a/test-utils/src/rpc/client.rs +++ b/test-utils/src/rpc/client.rs @@ -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, diff --git a/test-utils/src/rpc/data/macros.rs b/test-utils/src/rpc/data/macros.rs index 632917a..63a214c 100644 --- a/test-utils/src/rpc/data/macros.rs +++ b/test-utils/src/rpc/data/macros.rs @@ -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; diff --git a/test-utils/src/rpc/data/other.rs b/test-utils/src/rpc/data/other.rs index 80a48ab..9af6d8b 100644 --- a/test-utils/src/rpc/data/other.rs +++ b/test-utils/src/rpc/data/other.rs @@ -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", diff --git a/test-utils/src/test_netzone.rs b/test-utils/src/test_netzone.rs index f1f7582..791533c 100644 --- a/test-utils/src/test_netzone.rs +++ b/test-utils/src/test_netzone.rs @@ -86,9 +86,8 @@ impl, MoneroWireCodec>; type Listener = Pin< Box< - dyn Stream< - Item = Result<(Option, Self::Stream, Self::Sink), std::io::Error>, - > + Send + dyn Stream, Self::Stream, Self::Sink), Error>> + + Send + 'static, >, >;