mirror of
https://github.com/lightningdevkit/rust-lightning.git
synced 2025-03-15 15:39:09 +01:00
Remove unneeded allocation
`<E as serde:🇩🇪:Error>::custom()` accepts any `T: Display`, not just `String`. Therefore it accepts `Arguments<'_>` too so we can use `format_args!()` instead of `format!()`. See https://github.com/lightningdevkit/rust-lightning/pull/2187#discussion_r1168781355
This commit is contained in:
parent
56b0c96838
commit
6964299fc5
1 changed files with 1 additions and 1 deletions
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue