@@ -75,51 +75,71 @@ impl DecodeError {
7575 ) -> Self {
7676 Self {
7777 msg : format ! (
78- "Invalid buffer {name}. \
79- Expected at least {minimum_length} bytes, \
80- received {received} bytes"
78+ "Invalid buffer {name}. Expected at least {minimum_length} \
79+ bytes, received {received} bytes"
8180 ) ,
8281 }
8382 }
8483 pub fn invalid_mac_address ( received : usize ) -> Self {
85- Self {
86- msg : format ! ( "Invalid MAC address. Expected 6 bytes, received {received} bytes" ) ,
84+ Self {
85+ msg : format ! (
86+ "Invalid MAC address. Expected 6 bytes, received {received} \
87+ bytes"
88+ ) ,
8789 }
8890 }
8991
9092 pub fn invalid_ip_address ( received : usize ) -> Self {
91- Self {
92- msg : format ! ( "Invalid IP address. Expected 4 or 16 bytes, received {received} bytes" ) ,
93+ Self {
94+ msg : format ! (
95+ "Invalid IP address. Expected 4 or 16 bytes, received \
96+ {received} bytes"
97+ ) ,
9398 }
9499 }
95100
96101 pub fn invalid_number ( expected : usize , received : usize ) -> Self {
97- Self {
98- msg : format ! ( "Invalid number. Expected {expected} bytes, received {received} bytes" ) ,
102+ Self {
103+ msg : format ! (
104+ "Invalid number. Expected {expected} bytes, received \
105+ {received} bytes"
106+ ) ,
99107 }
100108 }
101109
102110 pub fn nla_buffer_too_small ( buffer_len : usize , nla_len : usize ) -> Self {
103- Self {
104- msg : format ! ( "buffer has length {buffer_len}, but an NLA header is {nla_len} bytes" ) ,
111+ Self {
112+ msg : format ! (
113+ "buffer has length {buffer_len}, but an NLA header is \
114+ {nla_len} bytes"
115+ ) ,
105116 }
106117 }
107118
108119 pub fn nla_length_mismatch ( buffer_len : usize , nla_len : usize ) -> Self {
109- Self {
110- msg : format ! ( "buffer has length: {buffer_len}, but the NLA is {nla_len} bytes" ) ,
120+ Self {
121+ msg : format ! (
122+ "buffer has length: {buffer_len}, but the NLA is {nla_len} \
123+ bytes"
124+ ) ,
111125 }
112126 }
113127
114128 pub fn nla_invalid_length ( buffer_len : usize , nla_len : usize ) -> Self {
115- Self {
116- msg : format ! ( "NLA has invalid length: {nla_len} (should be at least {buffer_len} bytes)" ) ,
129+ Self {
130+ msg : format ! (
131+ "NLA has invalid length: {nla_len} (should be at least \
132+ {buffer_len} bytes)"
133+ ) ,
117134 }
118135 }
119136
120137 pub fn buffer_too_small ( buffer_len : usize , value_len : usize ) -> Self {
121138 Self {
122- msg : format ! ( "Buffer too small: {buffer_len} (should be at least {value_len} bytes" ) ,
139+ msg : format ! (
140+ "Buffer too small: {buffer_len} (should be at least \
141+ {value_len} bytes"
142+ ) ,
123143 }
124144 }
125145}
@@ -154,7 +174,7 @@ impl<T: AsRef<[u8]>> ErrorBuffer<T> {
154174 Err ( DecodeError {
155175 msg : format ! (
156176 "invalid ErrorBuffer: length is {len} but ErrorBuffer are \
157- at least {ERROR_HEADER_LEN} bytes"
177+ at least {ERROR_HEADER_LEN} bytes"
158178 ) ,
159179 } )
160180 } else {
0 commit comments