Skip to content

Commit

Permalink
chore: fix lint warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
scarmuega committed Dec 16, 2023
1 parent 23349e3 commit c71e57d
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 23 deletions.
33 changes: 18 additions & 15 deletions src/filters/selection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,35 +157,38 @@ fn metadata_any_sub_label_matches(event: &Event, sub_label: &str) -> bool {
fn vkey_witnesses_matches(event: &Event, witness: &str) -> bool {
match &event.data {
EventData::VKeyWitness(x) => x.vkey_hex == witness,
EventData::Transaction(x) =>
x.vkey_witnesses.as_ref()
.map(|vs| vs.iter().any(|v| v.vkey_hex == witness))
.unwrap_or(false),
_ => false
EventData::Transaction(x) => x
.vkey_witnesses
.as_ref()
.map(|vs| vs.iter().any(|v| v.vkey_hex == witness))
.unwrap_or(false),
_ => false,
}
}

#[inline]
fn native_scripts_matches(event: &Event, policy_id: &str) -> bool {
match &event.data {
EventData::NativeWitness(x) => x.policy_id == policy_id,
EventData::Transaction(x) =>
x.native_witnesses.as_ref()
.map(|vs| vs.iter().any(|v| v.policy_id == policy_id))
.unwrap_or(false),
_ => false
EventData::Transaction(x) => x
.native_witnesses
.as_ref()
.map(|vs| vs.iter().any(|v| v.policy_id == policy_id))
.unwrap_or(false),
_ => false,
}
}

#[inline]
fn plutus_scripts_matches(event: &Event, script_hash: &str) -> bool {
match &event.data {
EventData::PlutusWitness(x) => x.script_hash == script_hash,
EventData::Transaction(x) =>
x.plutus_witnesses.as_ref()
.map(|vs| vs.iter().any(|v| v.script_hash == script_hash))
.unwrap_or(false),
_ => false
EventData::Transaction(x) => x
.plutus_witnesses
.as_ref()
.map(|vs| vs.iter().any(|v| v.script_hash == script_hash))
.unwrap_or(false),
_ => false,
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ impl<'de> Visitor<'de> for IntScalarVisitor {
where
E: serde::de::Error,
{
Ok(v.parse().map_err(DeError::custom)?)
v.parse().map_err(DeError::custom)
}

fn visit_u64<E>(self, v: u64) -> Result<Self::Value, E>
Expand Down
4 changes: 2 additions & 2 deletions src/sources/n2c/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ fn do_chainsync_attempt(
};

let mut plexer = setup_multiplexer(&config.address.0, &config.address.1, &config.retry_policy)
.map_err(|x| AttemptError::Recoverable(x))?;
.map_err(AttemptError::Recoverable)?;

let hs_channel = plexer.use_channel(0);
let cs_channel = plexer.use_channel(5);
Expand All @@ -224,7 +224,7 @@ fn do_chainsync_attempt(
&config.since,
&utils,
)
.map_err(|err| AttemptError::Recoverable(err))?;
.map_err(AttemptError::Recoverable)?;

if intersection.is_none() {
return Err(AttemptError::Other(
Expand Down
4 changes: 2 additions & 2 deletions src/sources/n2n/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ fn do_chainsync_attempt(
};

let mut plexer = setup_multiplexer(&config.address.0, &config.address.1, &config.retry_policy)
.map_err(|x| AttemptError::Recoverable(x))?;
.map_err(AttemptError::Recoverable)?;

let hs_channel = plexer.use_channel(0);
let cs_channel = plexer.use_channel(2);
Expand All @@ -231,7 +231,7 @@ fn do_chainsync_attempt(
&config.since,
&utils,
)
.map_err(|err| AttemptError::Recoverable(err))?;
.map_err(AttemptError::Recoverable)?;

if intersection.is_none() {
return Err(AttemptError::Other(
Expand Down
4 changes: 2 additions & 2 deletions src/utils/facade.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use super::*;
//! A friendly facade to simplify access to common utils procedures

///! A friendly facade to simplify access to common utils procedures
use super::*;

impl Utils {
// To be used by source stages to access the cursor, if any
Expand Down
3 changes: 2 additions & 1 deletion src/utils/metrics.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
///! An utility to keep track of the progress of the pipeline as a whole
//! An utility to keep track of the progress of the pipeline as a whole

use prometheus_exporter::prometheus::{register_counter, register_int_gauge, Counter, IntGauge};

use merge::Merge;
Expand Down

0 comments on commit c71e57d

Please sign in to comment.