@@ -34,10 +34,7 @@ fn virtualization_container() -> Result<bool> {
3434 {
3535 Ok ( child) => child,
3636 Err ( e) => {
37- warn ! (
38- "systemd-detect-virt call failed, assuming we're not in a container: {}" ,
39- e
40- ) ;
37+ warn ! ( "systemd-detect-virt call failed, assuming we're not in a container: {e}" ) ;
4138 return Ok ( false ) ;
4239 }
4340 } ;
@@ -58,14 +55,12 @@ fn modprobe(modname: &str, required: bool) {
5855
5956 log ! (
6057 level,
61- "modprobe \" {}\" cannot be spawned, ignoring: {}" ,
62- modname,
63- e
58+ "modprobe \" {modname}\" cannot be spawned, ignoring: {e}"
6459 ) ;
6560 }
6661 Ok ( status) => {
6762 if !status. success ( ) {
68- warn ! ( "modprobe \" {}\" failed, ignoring: code {}" , modname , status ) ;
63+ warn ! ( "modprobe \" {modname }\" failed, ignoring: code {status}" ) ;
6964 }
7065 }
7166 } ;
@@ -101,10 +96,7 @@ pub fn run_generator(devices: &[Device], output_directory: &Path, fake_mode: boo
10196 } )
10297 . fold ( 0 , cmp:: max) ;
10398
104- if !Path :: new ( "/dev" )
105- . join ( format ! ( "zram{}" , max_device) )
106- . exists ( )
107- {
99+ if !Path :: new ( "/dev" ) . join ( format ! ( "zram{max_device}" ) ) . exists ( ) {
108100 while fs:: read_to_string ( "/sys/class/zram-control/hot_add" )
109101 . context ( "Adding zram device" ) ?
110102 . trim_end ( )
@@ -128,13 +120,13 @@ pub fn run_generator(devices: &[Device], output_directory: &Path, fake_mode: boo
128120
129121 if !compressors. is_empty ( ) {
130122 let proc_crypto = fs:: read_to_string ( "/proc/crypto" ) . unwrap_or_else ( |e| {
131- warn ! ( "Failed to read /proc/crypto, proceeding as if empty: {}" , e ) ;
123+ warn ! ( "Failed to read /proc/crypto, proceeding as if empty: {e}" ) ;
132124 String :: new ( )
133125 } ) ;
134126 let known = parse_known_compressors ( & proc_crypto) ;
135127
136128 for comp in compressors. difference ( & known) {
137- modprobe ( & format ! ( "crypto-{}" , comp ) , false ) ;
129+ modprobe ( & format ! ( "crypto-{comp}" ) , false ) ;
138130 }
139131 }
140132
@@ -257,7 +249,7 @@ Options={options}
257249
258250 /* enablement symlink */
259251 let symlink_path = output_directory. join ( "swap.target.wants" ) . join ( & swap_name) ;
260- let target_path = format ! ( "../{}" , swap_name ) ;
252+ let target_path = format ! ( "../{swap_name}" ) ;
261253 make_symlink ( & target_path, & symlink_path) ?;
262254
263255 Ok ( ( ) )
@@ -271,7 +263,7 @@ fn unit_name_from_path(path: &Path, suffix: &str) -> String {
271263
272264 let trimmed = path. to_str ( ) . unwrap ( ) . trim_matches ( '/' ) ;
273265 if trimmed. is_empty ( ) {
274- format ! ( "-{}" , suffix )
266+ format ! ( "-{suffix}" )
275267 } else {
276268 let mut obuf = Vec :: with_capacity ( path. as_os_str ( ) . len ( ) + suffix. len ( ) ) ;
277269 let mut just_slash = false ;
@@ -284,7 +276,7 @@ fn unit_name_from_path(path: &Path, suffix: &str) -> String {
284276 b'/' => obuf. push ( b'-' ) ,
285277 b'.' if i == 0 => write ! ( obuf, "\\ x{:02x}" , b'.' ) . unwrap ( ) ,
286278 b'0' ..=b'9' | b'a' ..=b'z' | b'A' ..=b'Z' | b':' | b'_' | b'.' => obuf. push ( b) ,
287- _ => write ! ( obuf, "\\ x{:02x}" , b ) . unwrap ( ) ,
279+ _ => write ! ( obuf, "\\ x{b :02x}" ) . unwrap ( ) ,
288280 }
289281 }
290282 obuf. extend_from_slice ( suffix. as_bytes ( ) ) ;
@@ -335,7 +327,7 @@ Options={options}
335327 let symlink_path = output_directory
336328 . join ( "local-fs.target.wants" )
337329 . join ( mount_name) ;
338- let target_path = format ! ( "../{}" , mount_name ) ;
330+ let target_path = format ! ( "../{mount_name}" ) ;
339331 make_symlink ( & target_path, & symlink_path) ?;
340332
341333 Ok ( ( ) )
0 commit comments