diff --git a/payjoin/src/uri/mod.rs b/payjoin/src/uri/mod.rs index 94fc50cc..3914e58b 100644 --- a/payjoin/src/uri/mod.rs +++ b/payjoin/src/uri/mod.rs @@ -53,11 +53,13 @@ mod sealed { } pub trait UriExt<'a>: sealed::UriExt { - fn check_pj_supported(self) -> Result, 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, Box>>; } impl<'a> UriExt<'a> for Uri<'a, NetworkChecked> { - fn check_pj_supported(self) -> Result, bip21::Uri<'a>> { + fn check_pj_supported(self) -> Result, Box>> { match self.extras { MaybePayjoinExtras::Supported(payjoin) => { let mut uri = bip21::Uri::with_extras(self.address, payjoin); @@ -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)) } } }