mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2025-04-20 07:56:05 -04:00
clippy fixes
This commit is contained in:
parent
904b2ad829
commit
e017fb2c05
@ -225,7 +225,7 @@ impl<'c> Monerod {
|
||||
name: String,
|
||||
network: String,
|
||||
) -> Result<(Self, Container<'c, image::Monerod>)> {
|
||||
let image = image::Monerod::default();
|
||||
let image = image::Monerod;
|
||||
let image: RunnableImage<image::Monerod> = RunnableImage::from(image)
|
||||
.with_container_name(name.clone())
|
||||
.with_network(network.clone());
|
||||
|
@ -65,7 +65,7 @@ mod tests {
|
||||
#[tokio::test]
|
||||
async fn get_outs_for_key_offsets() {
|
||||
let cli = Cli::default();
|
||||
let container = cli.run(Monerod::default());
|
||||
let container = cli.run(Monerod);
|
||||
let rpc_client = Client::localhost(container.get_host_port_ipv4(18081)).unwrap();
|
||||
rpc_client.generateblocks(150, "498AVruCDWgP9Az9LjMm89VWjrBrSZ2W2K3HFBiyzzrRjUJWUcCVxvY1iitfuKoek2FdX6MKGAD9Qb1G1P8QgR5jPmmt3Vj".to_owned()).await.unwrap();
|
||||
let wallet = Wallet {
|
||||
|
@ -279,10 +279,10 @@ where
|
||||
SwarmEvent::IncomingConnectionError { send_back_addr: address, error, .. } => {
|
||||
tracing::warn!(%address, "Failed to set up connection with peer: {:#}", error);
|
||||
}
|
||||
SwarmEvent::ConnectionClosed { peer_id: peer, num_established, endpoint, cause: Some(error) } if num_established == 0 => {
|
||||
SwarmEvent::ConnectionClosed { peer_id: peer, num_established: 0, endpoint, cause: Some(error) } => {
|
||||
tracing::debug!(%peer, address = %endpoint.get_remote_address(), "Lost connection to peer: {:#}", error);
|
||||
}
|
||||
SwarmEvent::ConnectionClosed { peer_id: peer, num_established, endpoint, cause: None } if num_established == 0 => {
|
||||
SwarmEvent::ConnectionClosed { peer_id: peer, num_established: 0, endpoint, cause: None } => {
|
||||
tracing::info!(%peer, address = %endpoint.get_remote_address(), "Successfully closed connection");
|
||||
}
|
||||
SwarmEvent::NewListenAddr{address, ..} => {
|
||||
@ -296,7 +296,7 @@ where
|
||||
Some(Ok((peer, transfer_proof, responder))) => {
|
||||
if !self.swarm.behaviour_mut().transfer_proof.is_connected(&peer) {
|
||||
tracing::warn!(%peer, "No active connection to peer, buffering transfer proof");
|
||||
self.buffered_transfer_proofs.entry(peer).or_insert_with(Vec::new).push((transfer_proof, responder));
|
||||
self.buffered_transfer_proofs.entry(peer).or_default().push((transfer_proof, responder));
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -124,7 +124,7 @@ impl TxRedeem {
|
||||
let input = match candidate_transaction.input.as_slice() {
|
||||
[input] => input,
|
||||
[] => bail!(NoInputs),
|
||||
[inputs @ ..] => bail!(TooManyInputs(inputs.len())),
|
||||
inputs => bail!(TooManyInputs(inputs.len())),
|
||||
};
|
||||
|
||||
let sigs = match input.witness.to_vec().as_slice() {
|
||||
@ -133,7 +133,7 @@ impl TxRedeem {
|
||||
.map(|sig| extract_ecdsa_sig(sig))
|
||||
.collect::<Result<Vec<_>, _>>(),
|
||||
[] => bail!(EmptyWitnessStack),
|
||||
[witnesses @ ..] => bail!(NotThreeWitnesses(witnesses.len())),
|
||||
witnesses => bail!(NotThreeWitnesses(witnesses.len())),
|
||||
}?;
|
||||
|
||||
let sig = sigs
|
||||
|
@ -131,7 +131,7 @@ impl TxRefund {
|
||||
let input = match candidate_transaction.input.as_slice() {
|
||||
[input] => input,
|
||||
[] => bail!(NoInputs),
|
||||
[inputs @ ..] => bail!(TooManyInputs(inputs.len())),
|
||||
inputs => bail!(TooManyInputs(inputs.len())),
|
||||
};
|
||||
|
||||
let sigs = match input.witness.to_vec().as_slice() {
|
||||
@ -140,7 +140,7 @@ impl TxRefund {
|
||||
.map(|sig| extract_ecdsa_sig(sig))
|
||||
.collect::<Result<Vec<_>, _>>(),
|
||||
[] => bail!(EmptyWitnessStack),
|
||||
[witnesses @ ..] => bail!(NotThreeWitnesses(witnesses.len())),
|
||||
witnesses => bail!(NotThreeWitnesses(witnesses.len())),
|
||||
}?;
|
||||
|
||||
let sig = sigs
|
||||
|
@ -65,9 +65,7 @@ impl Wallet {
|
||||
database,
|
||||
) {
|
||||
Ok(w) => w,
|
||||
Err(e) if matches!(e, bdk::Error::ChecksumMismatch) => {
|
||||
Self::migrate(data_dir, xprivkey, network)?
|
||||
}
|
||||
Err(bdk::Error::ChecksumMismatch) => Self::migrate(data_dir, xprivkey, network)?,
|
||||
err => err?,
|
||||
};
|
||||
|
||||
|
@ -168,7 +168,7 @@ impl EventLoop {
|
||||
tracing::info!("Successfully closed connection to Alice");
|
||||
return;
|
||||
}
|
||||
SwarmEvent::OutgoingConnectionError { peer_id, error } if matches!(peer_id, Some(alice_peer_id) if alice_peer_id == self.alice_peer_id) => {
|
||||
SwarmEvent::OutgoingConnectionError { peer_id: Some(alice_peer_id), error } if alice_peer_id == self.alice_peer_id => {
|
||||
tracing::warn!(%error, "Failed to dial Alice");
|
||||
|
||||
if let Some(duration) = self.swarm.behaviour_mut().redial.until_next_redial() {
|
||||
|
@ -19,7 +19,7 @@ pub struct CborCodec<P, Req, Res> {
|
||||
impl<P, Req, Res> Default for CborCodec<P, Req, Res> {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
phantom: PhantomData::default(),
|
||||
phantom: PhantomData,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ pub struct JsonPullCodec<P, Res> {
|
||||
impl<P, Res> Default for JsonPullCodec<P, Res> {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
phantom: PhantomData::default(),
|
||||
phantom: PhantomData,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ where
|
||||
.expect("failed to create dh_keys");
|
||||
let noise = NoiseConfig::xx(dh_keys).into_authenticated();
|
||||
|
||||
let transport = MemoryTransport::default()
|
||||
let transport = MemoryTransport
|
||||
.or_transport(TokioTcpConfig::new())
|
||||
.upgrade(Version::V1)
|
||||
.authenticate(noise)
|
||||
|
Loading…
x
Reference in New Issue
Block a user