This commit is contained in:
chriseth 2022-12-06 22:18:55 +01:00
parent 93077dce52
commit 0fed55f154
4 changed files with 7 additions and 20 deletions

View file

@ -160,21 +160,11 @@ fn to_dot(
writeln!(out, "digraph used_edges {{").expect("");
for (address, balance) in account_balances {
writeln!(
out,
" \"{}\" [label=\"{}: {}\"];",
address, address, balance
)
.expect("");
writeln!(out, " \"{address}\" [label=\"{address}: {balance}\"];",).expect("");
}
for (from, out_edges) in edges {
for (to, capacity) in out_edges {
writeln!(
out,
" \"{}\" -> \"{}\" [label=\"{}\"];",
from, to, capacity
)
.expect("");
writeln!(out, " \"{from}\" -> \"{to}\" [label=\"{capacity}\"];",).expect("");
}
}
writeln!(out, "}}").expect("");

View file

@ -139,10 +139,7 @@ fn compute_transfer(
},
max_distance,
);
println!(
"Computed flow with max distance {:?}: {}",
max_distance, flow
);
println!("Computed flow with max distance {max_distance:?}: {flow}");
socket.write_all(
chunked_response(
&(jsonrpc_result(

View file

@ -11,7 +11,7 @@ impl Address {
impl Debug for Address {
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 {
write!(f, "0x")?;
for b in self.0 {
write!(f, "{:02x}", b)?;
write!(f, "{b:02x}")?;
}
Ok(())
}

View file

@ -15,11 +15,11 @@ impl U256 {
pub const MAX: U256 = U256::new(u128::MAX, u128::MAX);
pub fn to_decimal(self) -> String {
let value = BigUint::from(self.0[0]) << 128 | BigUint::from(self.0[1]);
format!("{}", value)
format!("{value}")
}
pub fn to_decimal_fraction(self) -> String {
let value = BigUint::from(self.0[0]) << 128 | BigUint::from(self.0[1]);
let formatted = format!("{}", value);
let formatted = format!("{value}");
match formatted.len() {
18.. => {
format!(