]> git.bitcoin.ninja Git - rust-lightning/commitdiff
Drop one unnecessary allocation added in aa2f6b47df312f026213d0ceaa
authorMatt Corallo <git@bluematt.me>
Thu, 3 Oct 2024 16:54:03 +0000 (16:54 +0000)
committerMatt Corallo <git@bluematt.me>
Thu, 3 Oct 2024 17:23:32 +0000 (17:23 +0000)
In aa2f6b47df312f026213d0ceaaff20ffe955c377 we refactored
`lightning-invoice` de/serialization to use the new version of
`bech32`, but ended up adding one unnecessary allocation in our
offers logic, which we drop here.

lightning/src/offers/parse.rs

index a46e90de6be5f71f88f637820ff91c2187ae6400..7c9d80387de3a8f574be695533f3ea915a4bc96b 100644 (file)
@@ -58,7 +58,7 @@ mod sealed {
 
                        let parsed = CheckedHrpstring::new::<NoChecksum>(encoded.as_ref())?;
                        let hrp = parsed.hrp();
-                       if hrp.to_string() != Self::BECH32_HRP {
+                       if hrp.as_str() != Self::BECH32_HRP {
                                return Err(Bolt12ParseError::InvalidBech32Hrp);
                        }