Skip to content

Commit 55d0b77

Browse files
committed
refactor(blockchain): derive UnknownTopic via thiserror
Replace the hand-written Display and Error impls with a thiserror derive, matching the crate convention (store.rs, key_manager.rs, etc.). No behavior change: the message is identical.
1 parent 049975f commit 55d0b77

1 file changed

Lines changed: 3 additions & 10 deletions

File tree

‎crates/blockchain/src/events.rs‎

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use ethlambda_types::ShortRoot;
1414
use ethlambda_types::checkpoint::Checkpoint;
1515
use ethlambda_types::primitives::H256;
1616
use serde::Serialize;
17-
use std::{fmt, str::FromStr};
17+
use std::str::FromStr;
1818
use tokio::sync::broadcast;
1919
use tracing::warn;
2020

@@ -46,17 +46,10 @@ impl Topic {
4646
}
4747

4848
/// Error returned by [`Topic::from_str`] for a name matching no topic.
49-
#[derive(Debug, Clone, PartialEq, Eq)]
49+
#[derive(Debug, Clone, PartialEq, Eq, thiserror::Error)]
50+
#[error("unknown topic: '{0}'")]
5051
pub struct UnknownTopic(String);
5152

52-
impl fmt::Display for UnknownTopic {
53-
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
54-
write!(f, "unknown topic: '{}'", self.0)
55-
}
56-
}
57-
58-
impl std::error::Error for UnknownTopic {}
59-
6053
impl FromStr for Topic {
6154
type Err = UnknownTopic;
6255

0 commit comments

Comments
 (0)