Skip to content

Commit

Permalink
Fix large error warning in check_pj_supported
Browse files Browse the repository at this point in the history
  • Loading branch information
spacebear21 committed Nov 7, 2024
1 parent 2f33bc8 commit 37638cc
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions payjoin/src/uri/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,13 @@ mod sealed {
}

pub trait UriExt<'a>: sealed::UriExt {
fn check_pj_supported(self) -> Result<PjUri<'a>, bip21::Uri<'a>>;
// Error type is boxed to reduce the size of the Result
// (See https://rust-lang.github.io/rust-clippy/master/index.html#result_large_err)
fn check_pj_supported(self) -> Result<PjUri<'a>, Box<bip21::Uri<'a>>>;
}

impl<'a> UriExt<'a> for Uri<'a, NetworkChecked> {
fn check_pj_supported(self) -> Result<PjUri<'a>, bip21::Uri<'a>> {
fn check_pj_supported(self) -> Result<PjUri<'a>, Box<bip21::Uri<'a>>> {
match self.extras {
MaybePayjoinExtras::Supported(payjoin) => {
let mut uri = bip21::Uri::with_extras(self.address, payjoin);
Expand All @@ -73,7 +75,7 @@ impl<'a> UriExt<'a> for Uri<'a, NetworkChecked> {
uri.label = self.label;
uri.message = self.message;

Err(uri)
Err(Box::new(uri))
}
}
}
Expand Down

0 comments on commit 37638cc

Please sign in to comment.