Skip to content

Commit ef4ca9b

Browse files
authored
fix clippy (#3938)
1 parent e27a9c1 commit ef4ca9b

File tree

6 files changed

+9
-9
lines changed

6 files changed

+9
-9
lines changed

jormungandr-lib/src/interfaces/block0_configuration/kes_update_speed.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ impl KesUpdateSpeed {
3535
/// returns `None` if the value is not within the boundaries of
3636
/// `KesUpdateSpeed::MINIMUM` and `KesUpdateSpeed::MAXIMUM`.
3737
pub fn new(v: u32) -> Option<Self> {
38-
if v < MINIMUM_KES_SPEED_UPDATE_IN_SECONDS || MAXIMUM_KES_SPEED_UPDATE_IN_SECONDS < v {
38+
if !(MINIMUM_KES_SPEED_UPDATE_IN_SECONDS..=MAXIMUM_KES_SPEED_UPDATE_IN_SECONDS).contains(&v)
39+
{
3940
None
4041
} else {
4142
Some(KesUpdateSpeed(v))

jormungandr-lib/src/interfaces/block0_configuration/number_of_slots_per_epoch.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ impl NumberOfSlotsPerEpoch {
3434
/// returns `None` if the value is not within the boundaries of
3535
/// `NumberOfSlotsPerEpoch::MINIMUM` and `NumberOfSlotsPerEpoch::MAXIMUM`.
3636
pub fn new(v: u32) -> Option<Self> {
37-
if v < MINIMUM_NUMBER_OF_SLOTS_PER_EPOCH || MAXIMUM_NUMBER_OF_SLOTS_PER_EPOCH < v {
37+
if !(MINIMUM_NUMBER_OF_SLOTS_PER_EPOCH..=MAXIMUM_NUMBER_OF_SLOTS_PER_EPOCH).contains(&v) {
3838
None
3939
} else {
4040
Some(Self(v))

jormungandr-lib/src/interfaces/block0_configuration/slots_duration.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ impl SlotDuration {
3434
/// `SlotDuration::MINIMUM` and `SlotDuration::MAXIMUM`.
3535
#[allow(clippy::absurd_extreme_comparisons)]
3636
pub fn new(v: u8) -> Option<Self> {
37-
if v < MINIMUM_SLOT_DURATION || MAXIMUM_SLOT_DURATION < v {
37+
if !(MINIMUM_SLOT_DURATION..=MAXIMUM_SLOT_DURATION).contains(&v) {
3838
None
3939
} else {
4040
Some(Self(v))

jormungandr/src/utils/task.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -291,10 +291,9 @@ impl TokioServiceInfo {
291291
tracing::trace!("spawning {}", name);
292292
self.handle.spawn(
293293
async move {
294-
match tokio::time::timeout(timeout, future).await {
295-
Err(_) => tracing::error!("task {} timed out", name),
296-
Ok(()) => {}
297-
};
294+
if tokio::time::timeout(timeout, future).await.is_err() {
295+
tracing::error!("task {} timed out", name);
296+
}
298297
}
299298
.instrument(span!(parent: &self.span, Level::TRACE, "task", kind = name)),
300299
);

testing/jormungandr-integration-tests/src/jormungandr/legacy.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ pub fn test_legacy_node_all_fragments() {
1919
let temp_dir = TempDir::new().unwrap();
2020
let jcli: JCli = Default::default();
2121

22-
let legacy_release = download_last_n_releases(1).iter().cloned().next().unwrap();
22+
let legacy_release = download_last_n_releases(1).get(0).cloned().unwrap();
2323
let jormungandr = get_jormungandr_bin(&legacy_release, &temp_dir);
2424

2525
let mut first_stake_pool_owner = thor::Wallet::default();

testing/jormungandr-integration-tests/src/non_functional/bootstrap.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ pub fn legacy_bootstrap_from_1_gb_storage() {
8181
.with_storage(&child)
8282
.build(&temp_dir);
8383

84-
let legacy_release = download_last_n_releases(1).iter().cloned().next().unwrap();
84+
let legacy_release = download_last_n_releases(1).get(0).cloned().unwrap();
8585
let jormungandr_app = get_jormungandr_bin(&legacy_release, &temp_dir);
8686

8787
let jormungandr = Starter::new()

0 commit comments

Comments
 (0)