fix: remove some warnings

This commit is contained in:
Louis-Marie Baer 2024-02-27 07:08:04 +01:00
parent b04412145f
commit dd55d87b2e
7 changed files with 17 additions and 21 deletions

View file

@ -316,7 +316,6 @@ impl Helper {
i += 1;
}
}
drop(i);
while let Some(Ok(line)) = stdout.next() {
// println!("{}", line); // For debugging.
@ -356,7 +355,6 @@ impl Helper {
i += 1;
}
}
drop(i);
while let Some(Ok(line)) = stdout.next() {
// println!("{}", line); // For debugging.
@ -2909,7 +2907,7 @@ mod test {
"hugepages": true
}"#;
use crate::helper::PrivXmrigApi;
let priv_api = serde_json::from_str::<PrivXmrigApi>(&data).unwrap();
let priv_api = serde_json::from_str::<PrivXmrigApi>(data).unwrap();
let json = serde_json::ser::to_string_pretty(&priv_api).unwrap();
println!("{}", json);
let data_after_ser = r#"{

View file

@ -281,14 +281,14 @@ mod test {
fn human_number() {
use crate::human::HumanNumber;
assert!(HumanNumber::to_percent(0.001).to_string() == "0%");
assert!(HumanNumber::to_percent(12.123123123123).to_string() == "12.12%");
assert!(HumanNumber::to_percent(12.123_123).to_string() == "12.12%");
assert!(HumanNumber::to_percent_3_point(0.001).to_string() == "0.001%");
assert!(
HumanNumber::from_hashrate([Some(123.1), Some(11111.1), None]).to_string()
== "[123 H/s, 11,111 H/s, ??? H/s]"
);
assert!(
HumanNumber::from_hashrate([None, Some(1.123), Some(123123.312)]).to_string()
HumanNumber::from_hashrate([None, Some(1.123), Some(123_123.31)]).to_string()
== "[??? H/s, 1 H/s, 123,123 H/s]"
);
assert!(
@ -299,8 +299,8 @@ mod test {
HumanNumber::from_load([None, Some(4321.43), Some(1234.1)]).to_string()
== "[???, 4321.43, 1234.10]"
);
assert!(HumanNumber::from_f32(123_123.123123123).to_string() == "123,123");
assert!(HumanNumber::from_f64(123_123_123.123123123123123).to_string() == "123,123,123");
assert!(HumanNumber::from_f32(123_123.125).to_string() == "123,123");
assert!(HumanNumber::from_f64(123_123_123.123_123_12).to_string() == "123,123,123");
assert!(HumanNumber::from_u16(1_000).to_string() == "1,000");
assert!(HumanNumber::from_u16(65_535).to_string() == "65,535");
assert!(HumanNumber::from_u32(65_536).to_string() == "65,536");

View file

@ -88,7 +88,7 @@ mod test {
use std::sync::{Arc, Mutex};
let arc_mutex = Arc::new(Mutex::new(false));
*lock!(arc_mutex) = true;
assert!(*lock!(arc_mutex) == true);
assert!(*lock!(arc_mutex));
}
#[test]
@ -101,19 +101,19 @@ mod test {
a: Arc::new(Mutex::new(false)),
}));
*lock2!(arc_mutex, a) = true;
assert!(*lock2!(arc_mutex, a) == true);
assert!(*lock2!(arc_mutex, a));
}
#[test]
fn arc_mut() {
let a = arc_mut!(false);
assert!(*lock!(a) == false);
assert!(!(*lock!(a)));
}
#[test]
fn flip() {
let mut b = true;
flip!(b);
assert!(b == false);
assert!(!b);
}
}

View file

@ -2541,7 +2541,7 @@ mod test {
let benchmarks: Vec<Benchmark> = {
let mut json: Vec<Benchmark> =
serde_json::from_slice(include_bytes!("cpu.json")).unwrap();
json.sort_by(|a, b| cmp_f64(strsim::jaro(&b.cpu, &cpu), strsim::jaro(&a.cpu, &cpu)));
json.sort_by(|a, b| cmp_f64(strsim::jaro(&b.cpu, cpu), strsim::jaro(&a.cpu, cpu)));
json
};

View file

@ -535,7 +535,7 @@ mod test {
#[ignore]
async fn full_ping() {
use crate::{REMOTE_NODES, REMOTE_NODE_LENGTH};
use hyper::{client::HttpConnector, Body, Client, Request};
use hyper::{client::HttpConnector, Client, Request};
use serde::{Deserialize, Serialize};
#[derive(Deserialize, Serialize)]
@ -577,7 +577,7 @@ mod test {
println!("{:#?}", e);
if i >= 3 {
use std::fmt::Write;
writeln!(failures, "Node failure: {ip}:{rpc}:{zmq}");
let _ = writeln!(failures, "Node failure: {ip}:{rpc}:{zmq}");
failure_count += 1;
continue 'outer;
}

View file

@ -771,7 +771,7 @@ impl Update {
warn!("Update | {} failed, attempt [{}/3]...", pkg.name, i);
} else {
indexes.push(index);
vec4.push(pkg.clone());
vec4.push(*pkg);
*lock2!(update, prog) += (30.0 / pkg_amount).round();
info!("Update | {} ... OK", pkg.name);
}

View file

@ -340,8 +340,6 @@ mod test {
#[test]
fn push_to_payout_ord() {
use crate::human::HumanNumber;
use crate::xmr::AtomicUnit;
use crate::xmr::PayoutOrd;
let mut payout_ord = PayoutOrd::from_vec(vec![]);
let should_be = "2022-09-08 18:42:55.4636 | 0.000000000001 XMR | Block 2,654,321\n";
@ -357,7 +355,7 @@ mod test {
use crate::human::HumanNumber;
use crate::xmr::AtomicUnit;
use crate::xmr::PayoutOrd;
let mut payout_ord = PayoutOrd::from_vec(vec![
let payout_ord = PayoutOrd::from_vec(vec![
(
"2022-09-08 18:42:55.4636".to_string(),
AtomicUnit::from_u64(1),
@ -453,11 +451,11 @@ mod test {
println!("1: {:#?}", payout_ord);
println!("2: {:#?}", payout_ord);
assert!(PayoutOrd::is_same(&payout_ord, &payout_ord_2) == true);
assert!(PayoutOrd::is_same(&payout_ord, &payout_ord_2));
payout_ord.push_raw("2022-09-08 18:42:55.4636", 1000000000, 2654321);
println!("1: {:#?}", payout_ord);
println!("2: {:#?}", payout_ord);
assert!(PayoutOrd::is_same(&payout_ord, &payout_ord_2) == false);
assert!(!PayoutOrd::is_same(&payout_ord, &payout_ord_2));
}
#[test]
@ -465,7 +463,7 @@ mod test {
use crate::human::HumanNumber;
use crate::xmr::AtomicUnit;
use crate::xmr::PayoutOrd;
let mut payout_ord = PayoutOrd::from_vec(vec![
let payout_ord = PayoutOrd::from_vec(vec![
(
"2022-09-08 18:42:55.4636".to_string(),
AtomicUnit::from_u64(1000000000),