Skip to content

Commit 18c66e2

Browse files
committed
clippy fix
1 parent 678535f commit 18c66e2

1 file changed

Lines changed: 10 additions & 6 deletions

File tree

src/events/mod.rs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,12 @@ pub struct EventListenerOptions {
4646
registry: Registry,
4747
}
4848

49+
impl Default for EventListenerOptions {
50+
fn default() -> Self {
51+
Self::new()
52+
}
53+
}
54+
4955
impl EventListenerOptions {
5056
pub fn new() -> Self {
5157
Self {
@@ -239,7 +245,7 @@ where
239245

240246
async fn handle_events_inner(&mut self) -> Result<()> {
241247
// Subscribe to best head to minimize latency; reorg safety can be layered later if needed.
242-
let mut blocks_sub = self.api.blocks().subscribe_best().await.map_err(|e| e)?;
248+
let mut blocks_sub = self.api.blocks().subscribe_best().await?;
243249
// Detect stalled streams: if no new block arrives within this window, bail to trigger reconnect.
244250
let stall_timeout = Duration::from_secs(7);
245251
while let Some(block) = match tokio::time::timeout(stall_timeout, blocks_sub.next()).await {
@@ -267,7 +273,7 @@ where
267273
EVENTS_LAST_BLOCK_NUM.set(num_i64);
268274
log::trace!("processing block number: {}", num_i64);
269275

270-
let events = block.events().await.map_err(|e| e)?;
276+
let events = block.events().await?;
271277
for evt in events.iter() {
272278
let evt = match evt {
273279
Err(err) => {
@@ -281,9 +287,8 @@ where
281287
self.cache
282288
.set(twin.0.id, twin.0.into())
283289
.await
284-
.map_err(|e| {
290+
.inspect_err(|_| {
285291
EVENTS_ERRORS.with_label_values(&["cache_set"]).inc();
286-
e
287292
})?;
288293
EVENTS_TWIN_STORED_TOTAL.inc();
289294
} else if let Ok(Some(twin)) =
@@ -292,9 +297,8 @@ where
292297
self.cache
293298
.set(twin.0.id, twin.0.into())
294299
.await
295-
.map_err(|e| {
300+
.inspect_err(|_| {
296301
EVENTS_ERRORS.with_label_values(&["cache_set"]).inc();
297-
e
298302
})?;
299303
EVENTS_TWIN_UPDATED_TOTAL.inc();
300304
}

0 commit comments

Comments
 (0)