Skip to content

Commit e849f8e

Browse files
committed
chore: fix clippy warnings
1 parent 8d20cf2 commit e849f8e

2 files changed

Lines changed: 27 additions & 7 deletions

File tree

src/error.rs

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,15 +59,15 @@ pub enum BDKCliError {
5959

6060
#[cfg(feature = "sqlite")]
6161
#[error("Rusqlite error: {0}")]
62-
RusqliteError(#[from] bdk_wallet::rusqlite::Error),
62+
RusqliteError(Box<bdk_wallet::rusqlite::Error>),
6363

6464
#[cfg(feature = "redb")]
6565
#[error("Redb StoreError: {0}")]
66-
RedbStoreError(#[from] bdk_redb::error::StoreError),
66+
RedbStoreError(Box<bdk_redb::error::StoreError>),
6767

6868
#[cfg(feature = "redb")]
6969
#[error("Redb dabtabase error: {0}")]
70-
RedbDatabaseError(#[from] bdk_redb::redb::DatabaseError),
70+
RedbDatabaseError(Box<bdk_redb::redb::DatabaseError>),
7171

7272
#[error("Serde json error: {0}")]
7373
SerdeJson(#[from] serde_json::Error),
@@ -147,3 +147,24 @@ impl From<ExtractTxError> for BDKCliError {
147147
BDKCliError::PsbtExtractTxError(Box::new(value))
148148
}
149149
}
150+
151+
#[cfg(feature = "redb")]
152+
impl From<bdk_redb::error::StoreError> for BDKCliError {
153+
fn from(err: bdk_redb::error::StoreError) -> Self {
154+
BDKCliError::RedbStoreError(Box::new(err))
155+
}
156+
}
157+
158+
#[cfg(feature = "redb")]
159+
impl From<bdk_redb::redb::DatabaseError> for BDKCliError {
160+
fn from(err: bdk_redb::redb::DatabaseError) -> Self {
161+
BDKCliError::RedbDatabaseError(Box::new(err))
162+
}
163+
}
164+
165+
#[cfg(feature = "sqlite")]
166+
impl From<bdk_wallet::rusqlite::Error> for BDKCliError {
167+
fn from(err: bdk_wallet::rusqlite::Error) -> Self {
168+
BDKCliError::RusqliteError(Box::new(err))
169+
}
170+
}

src/payjoin/mod.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ impl<'a> PayjoinManager<'a> {
7575
let persister = payjoin::persist::NoopSessionPersister::<ReceiverSessionEvent>::default();
7676

7777
let checked_max_fee_rate = max_fee_rate
78-
.map(|rate| FeeRate::from_sat_per_kwu(rate))
78+
.map(FeeRate::from_sat_per_kwu)
7979
.unwrap_or(FeeRate::BROADCAST_MIN);
8080

8181
let receiver = payjoin::receive::v2::ReceiverBuilder::new(
@@ -275,7 +275,7 @@ impl<'a> PayjoinManager<'a> {
275275
.await
276276
}
277277
ReceiveSession::HasReplyableError(error) => self.handle_error(error, persister).await,
278-
ReceiveSession::Closed(_) => return Err(Error::Generic("Session closed".to_string())),
278+
ReceiveSession::Closed(_) => Err(Error::Generic("Session closed".to_string())),
279279
}
280280
}
281281

@@ -305,8 +305,7 @@ impl<'a> PayjoinManager<'a> {
305305
}
306306
Err(e) => {
307307
return Err(Error::Generic(format!(
308-
"Error occurred when polling for Payjoin proposal from the directory: {}",
309-
e.to_string()
308+
"Error occurred when polling for Payjoin proposal from the directory: {e}"
310309
)));
311310
}
312311
}

0 commit comments

Comments
 (0)