From 37638ccff545dd45cca89c40b7fe00be8598e7e5 Mon Sep 17 00:00:00 2001 From: spacebear Date: Thu, 7 Nov 2024 15:54:19 -0500 Subject: [PATCH] Fix large error warning in `check_pj_supported` See https://rust-lang.github.io/rust-clippy/master/index.html#result_large_err --- payjoin/src/uri/mod.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) 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)) } } }