cargo +nightly fmt

This commit is contained in:
Luke Parker 2023-08-01 00:47:36 -04:00
parent 88f88b574c
commit 3c38a0ec11
No known key found for this signature in database
10 changed files with 40 additions and 40 deletions

View file

@ -306,11 +306,13 @@ impl Polyseed {
check_if_matches(
lang.has_prefix,
lang.words.iter().map(|lang_word| ascii(lang_word)),
&ascii(word)
&ascii(word),
)
} else {
check_if_matches(lang.has_prefix, lang.words.iter(), word)
}) else { continue 'language; };
}) else {
continue 'language;
};
// WordList asserts the word list length is less than u16::MAX
poly[i] = u16::try_from(coeff).expect("coeff exceeded u16");

View file

@ -681,7 +681,7 @@ async fn main() {
let Ok(serai) = Serai::new("ws://127.0.0.1:9944").await else {
log::error!("couldn't connect to the Serai node");
sleep(Duration::from_secs(5)).await;
continue
continue;
};
return serai;
}

View file

@ -171,10 +171,10 @@ impl<T: Transaction> Block<T> {
Err(BlockError::ProvidedAfterNonProvided)?;
}
let Some(local) =
locally_provided.get_mut(order).and_then(|deque| deque.pop_front()) else {
Err(BlockError::NonLocalProvided(txs.pop().unwrap()))?
};
let Some(local) = locally_provided.get_mut(order).and_then(|deque| deque.pop_front())
else {
Err(BlockError::NonLocalProvided(txs.pop().unwrap()))?
};
if tx != &local {
Err(BlockError::DistinctProvided)?;
}

View file

@ -229,9 +229,9 @@ impl<D: Db, T: Transaction, P: P2p> Tributary<D, T, P> {
}
Some(&TENDERMINT_MESSAGE) => {
let Ok(msg) = SignedMessageFor::<TendermintNetwork<D, T, P>>::decode::<&[u8]>(
&mut &msg[1 ..]
) else {
let Ok(msg) =
SignedMessageFor::<TendermintNetwork<D, T, P>>::decode::<&[u8]>(&mut &msg[1 ..])
else {
log::error!("received invalid tendermint message");
return false;
};

View file

@ -63,9 +63,7 @@ impl<D: Db, T: Transaction> ProvidedTransactions<D, T> {
/// Provide a transaction for inclusion in a block.
pub(crate) fn provide(&mut self, tx: T) -> Result<(), ProvidedError> {
let TransactionKind::Provided(order) = tx.kind() else {
Err(ProvidedError::NotProvided)?
};
let TransactionKind::Provided(order) = tx.kind() else { Err(ProvidedError::NotProvided)? };
match verify_transaction(&tx, self.genesis, &mut HashMap::new()) {
Ok(()) => {}

View file

@ -140,7 +140,9 @@ async fn main() {
NetworkId::Bitcoin => "BITCOIN_KEY",
NetworkId::Ethereum => "ETHEREUM_KEY",
NetworkId::Monero => "MONERO_KEY",
}) else { continue };
}) else {
continue;
};
register_service(Service::Processor(network), key);
}

View file

@ -528,7 +528,8 @@ async fn boot<N: Network, D: Db>(
info!("reloading plan {}: {:?}", hex::encode(id), plan);
let (Some((tx, eventuality)), _) =
prepare_send(network, signer.keys(), block_number, fee, plan).await else {
prepare_send(network, signer.keys(), block_number, fee, plan).await
else {
panic!("previously created transaction is no longer being created")
};

View file

@ -206,9 +206,10 @@ impl Serai {
}
let Some(finalized) =
self.0.rpc().header(Some(finalized)).await.map_err(SeraiError::RpcError)? else {
return Ok(None);
};
self.0.rpc().header(Some(finalized)).await.map_err(SeraiError::RpcError)?
else {
return Ok(None);
};
// If the finalized block has a lower number, this block can't be finalized
if finalized.number() < header.number() {
@ -220,24 +221,20 @@ impl Serai {
// chain
// If that hash is this hash, this block is finalized
let Some(hash) =
self
.0
.rpc()
.block_hash(Some(header.number().into()))
.await
.map_err(SeraiError::RpcError)? else {
// This is an error since there is a block at this index
Err(SeraiError::InvalidNode)?
};
self.0.rpc().block_hash(Some(header.number().into())).await.map_err(SeraiError::RpcError)?
else {
// This is an error since there is a block at this index
Err(SeraiError::InvalidNode)?
};
Ok(Some(header.hash() == hash))
}
pub async fn get_block(&self, hash: [u8; 32]) -> Result<Option<Block>, SeraiError> {
let Some(res) =
self.0.rpc().block(Some(hash.into())).await.map_err(SeraiError::RpcError)? else {
return Ok(None);
};
let Some(res) = self.0.rpc().block(Some(hash.into())).await.map_err(SeraiError::RpcError)?
else {
return Ok(None);
};
// Only return finalized blocks
if self.is_finalized(&res.block.header).await? != Some(true) {
@ -254,9 +251,10 @@ impl Serai {
// In practice, the block is likely more useful than the header
pub async fn get_block_by_number(&self, number: u64) -> Result<Option<Block>, SeraiError> {
let Some(hash) =
self.0.rpc().block_hash(Some(number.into())).await.map_err(SeraiError::RpcError)? else {
return Ok(None);
};
self.0.rpc().block_hash(Some(number.into())).await.map_err(SeraiError::RpcError)?
else {
return Ok(None);
};
self.get_block(hash.into()).await
}

View file

@ -120,9 +120,7 @@ pub mod pallet {
Err(Error::AlreadyGeneratedKeys)?
}
let Some(musig_key) = MuSigKeys::<T>::get(set) else {
Err(Error::NonExistentValidatorSet)?
};
let Some(musig_key) = MuSigKeys::<T>::get(set) else { Err(Error::NonExistentValidatorSet)? };
if !musig_key.verify(&set_keys_message(&set, key_pair), signature) {
Err(Error::BadSignature)?;
}

View file

@ -66,9 +66,10 @@ pub fn reproducibly_builds() {
let logs = Command::new("docker").arg("logs").arg(container).output().unwrap();
let Some(last_log) =
std::str::from_utf8(&logs.stdout).expect("output wasn't utf-8").lines().last() else {
continue 'runner;
};
std::str::from_utf8(&logs.stdout).expect("output wasn't utf-8").lines().last()
else {
continue 'runner;
};
let split = last_log.split("Runtime hash: ").collect::<Vec<_>>();
if split.len() == 2 {