Merge pull request #2262 from Kixunil/remove-serde-error-allocation
authorWilmer Paulino <9447167+wpaulino@users.noreply.github.com>
Thu, 4 May 2023 17:30:32 +0000 (10:30 -0700)
committerGitHub <noreply@github.com>
Thu, 4 May 2023 17:30:32 +0000 (10:30 -0700)
Remove unneeded allocation

lightning-invoice/src/lib.rs

index 101051b5e7f23509325d42301a424d3045fc7589..f53c8953b47c66b9344d86a928d9e834790989f7 100644 (file)
@@ -1725,7 +1725,7 @@ impl<'de> Deserialize<'de> for Invoice {
        fn deserialize<D>(deserializer: D) -> Result<Invoice, D::Error> where D: Deserializer<'de> {
                let bolt11 = String::deserialize(deserializer)?
                        .parse::<Invoice>()
-                       .map_err(|e| D::Error::custom(alloc::format!("{:?}", e)))?;
+                       .map_err(|e| D::Error::custom(format_args!("{:?}", e)))?;
 
                Ok(bolt11)
        }