@@ -165,8 +165,7 @@ pub fn device_match<T: TargetTable, D: DmDevice<T>>(
165165 let device_table = dev. table ( ) ;
166166 if !D :: equivalent_tables ( & kernel_table, device_table) ? {
167167 let err_msg = format ! (
168- "Specified new table \" {:?}\" does not match kernel table \" {:?}\" " ,
169- device_table, kernel_table
168+ "Specified new table \" {device_table:?}\" does not match kernel table \" {kernel_table:?}\" "
170169 ) ;
171170
172171 return Err ( DmError :: Dm ( ErrorEnum :: Invalid , err_msg) ) ;
@@ -187,7 +186,7 @@ pub fn device_match<T: TargetTable, D: DmDevice<T>>(
187186/// Check if a device of the given name exists.
188187pub fn device_exists ( dm : & DM , name : & DmName ) -> DmResult < bool > {
189188 dm. list_devices ( )
190- . map ( |l| l. iter ( ) . any ( |& ( ref n, _, _) | & * * n == name) )
189+ . map ( |l| l. iter ( ) . any ( |( n, _, _) | & * * n == name) )
191190}
192191
193192/// Parse a device from either of a path or a maj:min pair
@@ -197,7 +196,7 @@ pub fn parse_device(val: &str, desc: &str) -> DmResult<Device> {
197196 . ok_or_else ( || {
198197 DmError :: Dm (
199198 ErrorEnum :: Invalid ,
200- format ! ( "Failed to parse \" {}\" from input \" {}\" " , desc , val ) ,
199+ format ! ( "Failed to parse \" {desc }\" from input \" {val }\" " ) ,
201200 )
202201 } ) ?
203202 . into ( )
@@ -215,10 +214,7 @@ where
215214 val. parse :: < T > ( ) . map_err ( |_| {
216215 DmError :: Dm (
217216 ErrorEnum :: Invalid ,
218- format ! (
219- "Failed to parse value for \" {}\" from input \" {}\" " ,
220- desc, val
221- ) ,
217+ format ! ( "Failed to parse value for \" {desc}\" from input \" {val}\" " ) ,
222218 )
223219 } )
224220}
@@ -232,8 +228,7 @@ pub fn get_status_line_fields(status_line: &str, number_required: usize) -> DmRe
232228 return Err ( DmError :: Dm (
233229 ErrorEnum :: Invalid ,
234230 format ! (
235- "Insufficient number of fields for status; requires at least {}, found only {} in status line \" {}\" " ,
236- number_required, length, status_line
231+ "Insufficient number of fields for status; requires at least {number_required}, found only {length} in status line \" {status_line}\" "
237232 ) ,
238233 ) ) ;
239234 }
@@ -250,7 +245,7 @@ pub fn get_status(status_lines: &[(u64, u64, String, String)]) -> DmResult<Strin
250245 format ! (
251246 "Incorrect number of lines for status; expected 1, found {} in status result \" {}\" " ,
252247 length,
253- status_lines. iter( ) . map( |( s, l, t, v) | format!( "{} {} {} {}" , s , l , t , v ) ) . collect:: <Vec <String >>( ) . join( ", " )
248+ status_lines. iter( ) . map( |( s, l, t, v) | format!( "{s } {l } {t } {v}" ) ) . collect:: <Vec <String >>( ) . join( ", " )
254249 ) ,
255250 ) ) ;
256251 }
@@ -268,8 +263,7 @@ pub fn make_unexpected_value_error(value_index: usize, value: &str, item_name: &
268263 DmError :: Dm (
269264 ErrorEnum :: Invalid ,
270265 format ! (
271- "Kernel returned unexpected {}th value \" {}\" for item representing {} in status result" ,
272- value_index, value, item_name
266+ "Kernel returned unexpected {value_index}th value \" {value}\" for item representing {item_name} in status result"
273267 ) ,
274268 )
275269}
0 commit comments