@@ -53,10 +53,7 @@ pub struct ErroneousField {
5353impl InvoiceError {
5454 /// Creates an [`InvoiceError`] with the given message.
5555 pub fn from_string ( s : String ) -> Self {
56- Self {
57- erroneous_field : None ,
58- message : UntrustedString ( s) ,
59- }
56+ Self { erroneous_field : None , message : UntrustedString ( s) }
6057 }
6158}
6259
@@ -107,10 +104,7 @@ impl Readable for InvoiceError {
107104
108105impl From < Bolt12SemanticError > for InvoiceError {
109106 fn from ( error : Bolt12SemanticError ) -> Self {
110- InvoiceError {
111- erroneous_field : None ,
112- message : UntrustedString ( format ! ( "{:?}" , error) ) ,
113- }
107+ InvoiceError { erroneous_field : None , message : UntrustedString ( format ! ( "{:?}" , error) ) }
114108 }
115109}
116110
@@ -120,10 +114,7 @@ impl From<SignError> for InvoiceError {
120114 SignError :: Signing => "Failed signing invoice" ,
121115 SignError :: Verification ( _) => "Failed invoice signature verification" ,
122116 } ;
123- InvoiceError {
124- erroneous_field : None ,
125- message : UntrustedString ( message. to_string ( ) ) ,
126- }
117+ InvoiceError { erroneous_field : None , message : UntrustedString ( message. to_string ( ) ) }
127118 }
128119}
129120
@@ -132,7 +123,9 @@ mod tests {
132123 use super :: { ErroneousField , InvoiceError } ;
133124
134125 use crate :: ln:: msgs:: DecodeError ;
135- use crate :: util:: ser:: { HighZeroBytesDroppedBigSize , Readable , VecWriter , WithoutLength , Writeable } ;
126+ use crate :: util:: ser:: {
127+ HighZeroBytesDroppedBigSize , Readable , VecWriter , WithoutLength , Writeable ,
128+ } ;
136129 use crate :: util:: string:: UntrustedString ;
137130
138131 #[ test]
@@ -149,7 +142,7 @@ mod tests {
149142 Ok ( invoice_error) => {
150143 assert_eq ! ( invoice_error. message, UntrustedString ( "Invalid value" . to_string( ) ) ) ;
151144 assert_eq ! ( invoice_error. erroneous_field, None ) ;
152- }
145+ } ,
153146 Err ( e) => panic ! ( "Unexpected error: {:?}" , e) ,
154147 }
155148 }
@@ -174,7 +167,7 @@ mod tests {
174167 invoice_error. erroneous_field,
175168 Some ( ErroneousField { tlv_fieldnum: 42 , suggested_value: Some ( vec![ 42 ; 32 ] ) } ) ,
176169 ) ;
177- }
170+ } ,
178171 Err ( e) => panic ! ( "Unexpected error: {:?}" , e) ,
179172 }
180173 }
@@ -183,10 +176,7 @@ mod tests {
183176 fn parses_invoice_error_without_suggested_value ( ) {
184177 let mut writer = VecWriter ( Vec :: new ( ) ) ;
185178 let invoice_error = InvoiceError {
186- erroneous_field : Some ( ErroneousField {
187- tlv_fieldnum : 42 ,
188- suggested_value : None ,
189- } ) ,
179+ erroneous_field : Some ( ErroneousField { tlv_fieldnum : 42 , suggested_value : None } ) ,
190180 message : UntrustedString ( "Invalid value" . to_string ( ) ) ,
191181 } ;
192182 invoice_error. write ( & mut writer) . unwrap ( ) ;
@@ -199,7 +189,7 @@ mod tests {
199189 invoice_error. erroneous_field,
200190 Some ( ErroneousField { tlv_fieldnum: 42 , suggested_value: None } ) ,
201191 ) ;
202- }
192+ } ,
203193 Err ( e) => panic ! ( "Unexpected error: {:?}" , e) ,
204194 }
205195 }
0 commit comments