chore: fix dprint config and run fmt

This commit is contained in:
Byron Hambly 2023-03-15 14:12:28 +02:00
parent 31914bc1ed
commit 00cfce57c7
No known key found for this signature in database
GPG Key ID: DE8F6EA20A661697
11 changed files with 136 additions and 100 deletions

View File

@ -15,6 +15,11 @@ jobs:
- name: Checkout sources - name: Checkout sources
uses: actions/checkout@v3.3.0 uses: actions/checkout@v3.3.0
- uses: dtolnay/rust-toolchain@master
with:
toolchain: 1.63
components: clippy,rustfmt
- uses: Swatinem/rust-cache@v2.2.1 - uses: Swatinem/rust-cache@v2.2.1
- name: Check formatting - name: Check formatting

View File

@ -3,22 +3,16 @@
"projectType": "openSource", "projectType": "openSource",
"incremental": true, "incremental": true,
"markdown": {}, "markdown": {},
"rustfmt": { "exec": {
"edition": 2021, "associations": "**/*.{rs}",
"condense_wildcard_suffixes": true, "rustfmt": "rustfmt --edition 2021",
"format_macro_matchers": true, "rustfmt.associations": "**/*.rs"
"imports_granularity": "Module",
"use_field_init_shorthand": true,
"format_code_in_doc_comments": true,
"normalize_comments": true,
"wrap_comments": true,
"overflow_delimited_expr": true
}, },
"includes": ["**/*.{md}", "**/*.{toml}", "**/*.{rs}"], "includes": ["**/*.{md}", "**/*.{toml}", "**/*.{rs}"],
"excludes": ["target/"], "excludes": ["target/"],
"plugins": [ "plugins": [
"https://plugins.dprint.dev/markdown-0.13.1.wasm", "https://plugins.dprint.dev/markdown-0.13.1.wasm",
"https://github.com/thomaseizinger/dprint-plugin-cargo-toml/releases/download/0.1.0/cargo-toml-0.1.0.wasm", "https://github.com/thomaseizinger/dprint-plugin-cargo-toml/releases/download/0.1.0/cargo-toml-0.1.0.wasm",
"https://plugins.dprint.dev/rustfmt-0.6.1.exe-plugin@99b89a0599fd3a63e597e03436862157901f3facae2f0c2fbd0b9f656cdbc2a5" "https://plugins.dprint.dev/exec-0.3.5.json@d687dda57be0fe9a0088ccdaefa5147649ff24127d8b3ea227536c68ee7abeab"
] ]
} }

View File

@ -47,9 +47,10 @@ impl Client {
} }
pub async fn get_o_indexes(&self, txid: Hash) -> Result<GetOIndexesResponse> { pub async fn get_o_indexes(&self, txid: Hash) -> Result<GetOIndexesResponse> {
self.binary_request(self.get_o_indexes_bin_url.clone(), GetOIndexesPayload { self.binary_request(
txid, self.get_o_indexes_bin_url.clone(),
}) GetOIndexesPayload { txid },
)
.await .await
} }

View File

@ -210,14 +210,20 @@ impl TxCancel {
}; };
// The order in which these are inserted doesn't matter // The order in which these are inserted doesn't matter
satisfier.insert(A, ::bitcoin::EcdsaSig { satisfier.insert(
A,
::bitcoin::EcdsaSig {
sig: sig_a.into(), sig: sig_a.into(),
hash_ty: EcdsaSighashType::All, hash_ty: EcdsaSighashType::All,
}); },
satisfier.insert(B, ::bitcoin::EcdsaSig { );
satisfier.insert(
B,
::bitcoin::EcdsaSig {
sig: sig_b.into(), sig: sig_b.into(),
hash_ty: EcdsaSighashType::All, hash_ty: EcdsaSighashType::All,
}); },
);
satisfier satisfier
}; };

View File

@ -65,14 +65,20 @@ impl TxPunish {
let B = B.try_into()?; let B = B.try_into()?;
// The order in which these are inserted doesn't matter // The order in which these are inserted doesn't matter
satisfier.insert(A, ::bitcoin::EcdsaSig { satisfier.insert(
A,
::bitcoin::EcdsaSig {
sig: sig_a.into(), sig: sig_a.into(),
hash_ty: EcdsaSighashType::All, hash_ty: EcdsaSighashType::All,
}); },
satisfier.insert(B, ::bitcoin::EcdsaSig { );
satisfier.insert(
B,
::bitcoin::EcdsaSig {
sig: sig_b.into(), sig: sig_b.into(),
hash_ty: EcdsaSighashType::All, hash_ty: EcdsaSighashType::All,
}); },
);
satisfier satisfier
}; };

View File

@ -87,14 +87,20 @@ impl TxRedeem {
}; };
// The order in which these are inserted doesn't matter // The order in which these are inserted doesn't matter
satisfier.insert(A, ::bitcoin::EcdsaSig { satisfier.insert(
A,
::bitcoin::EcdsaSig {
sig: sig_a.into(), sig: sig_a.into(),
hash_ty: EcdsaSighashType::All, hash_ty: EcdsaSighashType::All,
}); },
satisfier.insert(B, ::bitcoin::EcdsaSig { );
satisfier.insert(
B,
::bitcoin::EcdsaSig {
sig: sig_b.into(), sig: sig_b.into(),
hash_ty: EcdsaSighashType::All, hash_ty: EcdsaSighashType::All,
}); },
);
satisfier satisfier
}; };

View File

@ -70,14 +70,20 @@ impl TxRefund {
}; };
// The order in which these are inserted doesn't matter // The order in which these are inserted doesn't matter
satisfier.insert(A, ::bitcoin::EcdsaSig { satisfier.insert(
A,
::bitcoin::EcdsaSig {
sig: sig_a.into(), sig: sig_a.into(),
hash_ty: EcdsaSighashType::All, hash_ty: EcdsaSighashType::All,
}); },
satisfier.insert(B, ::bitcoin::EcdsaSig { );
satisfier.insert(
B,
::bitcoin::EcdsaSig {
sig: sig_b.into(), sig: sig_b.into(),
hash_ty: EcdsaSighashType::All, hash_ty: EcdsaSighashType::All,
}); },
);
satisfier satisfier
}; };

View File

@ -350,7 +350,9 @@ mod tests {
list.sort(); list.sort();
assert_eq!(list, vec![ assert_eq!(
list,
vec![
Seller { Seller {
multiaddr: "/ip4/127.0.0.1/tcp/5678".parse().unwrap(), multiaddr: "/ip4/127.0.0.1/tcp/5678".parse().unwrap(),
status: Status::Online(BidQuote { status: Status::Online(BidQuote {
@ -367,6 +369,7 @@ mod tests {
multiaddr: "/ip4/127.0.0.1/tcp/1234".parse().unwrap(), multiaddr: "/ip4/127.0.0.1/tcp/1234".parse().unwrap(),
status: Status::Unreachable status: Status::Unreachable
}, },
]) ]
)
} }
} }

View File

@ -155,13 +155,16 @@ impl ProtocolsHandler for Handler {
let env_config = self.env_config; let env_config = self.env_config;
let protocol = tokio::time::timeout(self.timeout, async move { let protocol = tokio::time::timeout(self.timeout, async move {
write_cbor_message(&mut substream, SpotPriceRequest { write_cbor_message(
&mut substream,
SpotPriceRequest {
btc: info.btc, btc: info.btc,
blockchain_network: BlockchainNetwork { blockchain_network: BlockchainNetwork {
bitcoin: env_config.bitcoin_network, bitcoin: env_config.bitcoin_network,
monero: env_config.monero_network, monero: env_config.monero_network,
}, },
}) },
)
.await?; .await?;
let xmr = Result::from(read_cbor_message::<SpotPriceResponse>(&mut substream).await?)?; let xmr = Result::from(read_cbor_message::<SpotPriceResponse>(&mut substream).await?)?;

View File

@ -184,7 +184,9 @@ impl State0 {
let v = self.v_a + msg.v_b; let v = self.v_a + msg.v_b;
Ok((msg.swap_id, State1 { Ok((
msg.swap_id,
State1 {
a: self.a, a: self.a,
B: msg.B, B: msg.B,
s_a: self.s_a, s_a: self.s_a,
@ -206,7 +208,8 @@ impl State0 {
tx_punish_fee: self.tx_punish_fee, tx_punish_fee: self.tx_punish_fee,
tx_refund_fee: msg.tx_refund_fee, tx_refund_fee: msg.tx_refund_fee,
tx_cancel_fee: msg.tx_cancel_fee, tx_cancel_fee: msg.tx_cancel_fee,
})) },
))
} }
} }

View File

@ -158,13 +158,16 @@ async fn init_containers(cli: &Cli) -> (Monero, Containers<'_>) {
.await .await
.unwrap(); .unwrap();
(monero, Containers { (
monero,
Containers {
bitcoind_url, bitcoind_url,
bitcoind, bitcoind,
monerod_container, monerod_container,
monero_wallet_rpc_containers, monero_wallet_rpc_containers,
electrs, electrs,
}) },
)
} }
async fn init_bitcoind_container( async fn init_bitcoind_container(