Skip to content
This repository has been archived by the owner on Sep 4, 2024. It is now read-only.

integration_test: Clear clippy warnings #121

Merged
merged 4 commits into from
Jun 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions integration_test/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,22 +45,22 @@ impl log::Log for StdLogger {
static LOGGER: StdLogger = StdLogger;

fn get_rpc_url() -> String {
return std::env::var("RPC_URL").expect("RPC_URL must be set");
std::env::var("RPC_URL").expect("RPC_URL must be set")
}

fn get_auth() -> (String, Option<String>) {
if let Ok(cookie) = std::env::var("RPC_COOKIE") {
let contents =
fs::read_to_string(&cookie).expect(&format!("failed to read cookie file: {}", cookie));
let contents = fs::read_to_string(&cookie)
.unwrap_or_else(|_| panic!("failed to read cookie file: {}", cookie));
let mut split = contents.split(':');
let user = split.next().expect("failed to get username from cookie file");
let pass = split.next().map_or("".to_string(), |s| s.to_string());
return (user.to_string(), Some(pass));
(user.to_string(), Some(pass))
} else if let Ok(user) = std::env::var("RPC_USER") {
return (user, std::env::var("RPC_PASS").ok());
(user, std::env::var("RPC_PASS").ok())
} else {
panic!("Either RPC_COOKIE or RPC_USER + RPC_PASS must be set.");
};
panic!("Either RPC_COOKIE or RPC_USER + RPC_PASS must be set.")
}
}

fn make_client() -> Client {
Expand Down Expand Up @@ -118,8 +118,8 @@ fn main() {
run_test!(test_get_block_hash_named);

// Print results
println!("");
println!("");
println!();
println!();
println!("Summary:");
let mut error_count = 0;
for (name, success) in RESULTS.lock().unwrap().iter() {
Expand All @@ -131,7 +131,7 @@ fn main() {
}
}

println!("");
println!();

if error_count == 0 {
println!("All tests succesful!");
Expand All @@ -143,7 +143,7 @@ fn main() {

fn test_get_network_info(cl: &Client) {
let request = Request {
method: "getnetworkinfo".into(),
method: "getnetworkinfo",
params: None,
id: serde_json::json!(1),
jsonrpc: Some("2.0"),
Expand All @@ -157,7 +157,7 @@ fn test_get_block_hash_list(cl: &Client) {
let raw_value = Some(to_raw_value(&param).unwrap());

let request = Request {
method: "getblockhash".into(),
method: "getblockhash",
params: raw_value.as_deref(),
id: serde_json::json!(2),
jsonrpc: Some("2.0"),
Expand All @@ -175,7 +175,7 @@ fn test_get_block_hash_named(cl: &Client) {
let raw_value = Some(to_raw_value(&param).unwrap());

let request = Request {
method: "getblockhash".into(),
method: "getblockhash",
params: raw_value.as_deref(),
id: serde_json::json!(2),
jsonrpc: Some("2.0"),
Expand Down
Loading