Clippy.
This commit is contained in:
parent
93077dce52
commit
0fed55f154
4 changed files with 7 additions and 20 deletions
|
@ -160,21 +160,11 @@ fn to_dot(
|
||||||
writeln!(out, "digraph used_edges {{").expect("");
|
writeln!(out, "digraph used_edges {{").expect("");
|
||||||
|
|
||||||
for (address, balance) in account_balances {
|
for (address, balance) in account_balances {
|
||||||
writeln!(
|
writeln!(out, " \"{address}\" [label=\"{address}: {balance}\"];",).expect("");
|
||||||
out,
|
|
||||||
" \"{}\" [label=\"{}: {}\"];",
|
|
||||||
address, address, balance
|
|
||||||
)
|
|
||||||
.expect("");
|
|
||||||
}
|
}
|
||||||
for (from, out_edges) in edges {
|
for (from, out_edges) in edges {
|
||||||
for (to, capacity) in out_edges {
|
for (to, capacity) in out_edges {
|
||||||
writeln!(
|
writeln!(out, " \"{from}\" -> \"{to}\" [label=\"{capacity}\"];",).expect("");
|
||||||
out,
|
|
||||||
" \"{}\" -> \"{}\" [label=\"{}\"];",
|
|
||||||
from, to, capacity
|
|
||||||
)
|
|
||||||
.expect("");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
writeln!(out, "}}").expect("");
|
writeln!(out, "}}").expect("");
|
||||||
|
|
|
@ -139,10 +139,7 @@ fn compute_transfer(
|
||||||
},
|
},
|
||||||
max_distance,
|
max_distance,
|
||||||
);
|
);
|
||||||
println!(
|
println!("Computed flow with max distance {max_distance:?}: {flow}");
|
||||||
"Computed flow with max distance {:?}: {}",
|
|
||||||
max_distance, flow
|
|
||||||
);
|
|
||||||
socket.write_all(
|
socket.write_all(
|
||||||
chunked_response(
|
chunked_response(
|
||||||
&(jsonrpc_result(
|
&(jsonrpc_result(
|
||||||
|
|
|
@ -11,7 +11,7 @@ impl Address {
|
||||||
|
|
||||||
impl Debug for Address {
|
impl Debug for Address {
|
||||||
fn fmt(&self, f: &mut Formatter) -> std::fmt::Result {
|
fn fmt(&self, f: &mut Formatter) -> std::fmt::Result {
|
||||||
write!(f, "{}", self)
|
write!(f, "{self}")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ impl Display for Address {
|
||||||
fn fmt(&self, f: &mut Formatter) -> std::fmt::Result {
|
fn fmt(&self, f: &mut Formatter) -> std::fmt::Result {
|
||||||
write!(f, "0x")?;
|
write!(f, "0x")?;
|
||||||
for b in self.0 {
|
for b in self.0 {
|
||||||
write!(f, "{:02x}", b)?;
|
write!(f, "{b:02x}")?;
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,11 +15,11 @@ impl U256 {
|
||||||
pub const MAX: U256 = U256::new(u128::MAX, u128::MAX);
|
pub const MAX: U256 = U256::new(u128::MAX, u128::MAX);
|
||||||
pub fn to_decimal(self) -> String {
|
pub fn to_decimal(self) -> String {
|
||||||
let value = BigUint::from(self.0[0]) << 128 | BigUint::from(self.0[1]);
|
let value = BigUint::from(self.0[0]) << 128 | BigUint::from(self.0[1]);
|
||||||
format!("{}", value)
|
format!("{value}")
|
||||||
}
|
}
|
||||||
pub fn to_decimal_fraction(self) -> String {
|
pub fn to_decimal_fraction(self) -> String {
|
||||||
let value = BigUint::from(self.0[0]) << 128 | BigUint::from(self.0[1]);
|
let value = BigUint::from(self.0[0]) << 128 | BigUint::from(self.0[1]);
|
||||||
let formatted = format!("{}", value);
|
let formatted = format!("{value}");
|
||||||
match formatted.len() {
|
match formatted.len() {
|
||||||
18.. => {
|
18.. => {
|
||||||
format!(
|
format!(
|
||||||
|
|
Loading…
Reference in a new issue