Skip to content

Commit 1f0eebd

Browse files
committed
chore: apply rust 1.92 new clippy lints
1 parent 4503402 commit 1f0eebd

File tree

3 files changed

+15
-19
lines changed

3 files changed

+15
-19
lines changed

demo/protocol-demo/src/demonstrator.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,8 @@ impl Party {
128128
println!(
129129
"Party #{}: {}",
130130
self.party_id,
131-
if signature.is_some() {
132-
format!("lottery #{:?} won", signature.as_ref().unwrap().indexes)
131+
if let Some(sig) = &signature {
132+
format!("lottery #{:?} won", sig.indexes)
133133
} else {
134134
"lost all lotteries".to_string()
135135
}

mithril-common/src/test/builder/certificate_chain_builder.rs

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -565,21 +565,17 @@ impl<'a> CertificateChainBuilder<'a> {
565565
.map(|c| c.epoch != certificate.epoch)
566566
.unwrap_or(true);
567567

568-
certificates_chained
569-
.iter()
570-
.rev()
571-
.filter(|c| {
572-
if is_certificate_first_of_epoch {
573-
// The previous certificate of the first certificate of an epoch
574-
// is the first certificate of the previous epoch
575-
c.epoch == certificate.epoch.previous().unwrap()
576-
} else {
577-
// The previous certificate of not the first certificate of an epoch
578-
// is the first certificate of the epoch
579-
c.epoch == certificate.epoch
580-
}
581-
})
582-
.next_back()
568+
certificates_chained.iter().rev().rfind(|c| {
569+
if is_certificate_first_of_epoch {
570+
// The previous certificate of the first certificate of an epoch
571+
// is the first certificate of the previous epoch
572+
c.epoch == certificate.epoch.previous().unwrap()
573+
} else {
574+
// The previous certificate of not the first certificate of an epoch
575+
// is the first certificate of the epoch
576+
c.epoch == certificate.epoch
577+
}
578+
})
583579
}
584580
CertificateChainingMethod::Sequential => certificates_chained.last(),
585581
}

mithril-test-lab/mithril-end-to-end/src/utils/spec_utils.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@ macro_rules! attempt {
3030

3131
#[cfg(test)]
3232
mod tests {
33-
use crate::attempt;
34-
use crate::utils::AttemptResult;
3533
use std::time::Duration;
3634
use tokio::time::Instant;
3735

36+
use crate::utils::AttemptResult;
37+
3838
const EMPTY_RESULT: Result<Option<()>, String> = Ok(None);
3939

4040
#[tokio::test]

0 commit comments

Comments
 (0)