Avoid a redundant allocation in `InvoiceError` handling in one case
[rust-lightning] / lightning / src / offers / invoice_error.rs
index 441dae265cbb4fb9c9ed8d527e6b9b65c1e61ad1..5476ad551b7b627d5e1abac8d19fc836b673e54c 100644 (file)
@@ -50,10 +50,10 @@ pub struct ErroneousField {
 
 impl InvoiceError {
        /// Creates an [`InvoiceError`] with the given message.
-       pub fn from_str(s: &str) -> Self {
+       pub fn from_string(s: String) -> Self {
                Self {
                        erroneous_field: None,
-                       message: UntrustedString(s.to_string()),
+                       message: UntrustedString(s),
                }
        }
 }