@@ -56,7 +56,7 @@ mod login {
5656 let result = unsafe { ffi:: sd_get_sessions ( & mut sessions_ptr) } ;
5757
5858 if result < 0 {
59- return Err ( format ! ( "sd_get_sessions failed: {}" , result ) . into ( ) ) ;
59+ return Err ( format ! ( "sd_get_sessions failed: {result}" ) . into ( ) ) ;
6060 }
6161
6262 let mut sessions = Vec :: new ( ) ;
@@ -89,11 +89,9 @@ mod login {
8989 let result = unsafe { ffi:: sd_session_get_uid ( session_cstring. as_ptr ( ) , & mut uid) } ;
9090
9191 if result < 0 {
92- return Err ( format ! (
93- "sd_session_get_uid failed for session '{}': {}" ,
94- session_id, result
95- )
96- . into ( ) ) ;
92+ return Err (
93+ format ! ( "sd_session_get_uid failed for session '{session_id}': {result}" , ) . into ( ) ,
94+ ) ;
9795 }
9896
9997 Ok ( uid)
@@ -108,8 +106,7 @@ mod login {
108106
109107 if result < 0 {
110108 return Err ( format ! (
111- "sd_session_get_start_time failed for session '{}': {}" ,
112- session_id, result
109+ "sd_session_get_start_time failed for session '{session_id}': {result}" ,
113110 )
114111 . into ( ) ) ;
115112 }
@@ -125,11 +122,9 @@ mod login {
125122 let result = unsafe { ffi:: sd_session_get_tty ( session_cstring. as_ptr ( ) , & mut tty_ptr) } ;
126123
127124 if result < 0 {
128- return Err ( format ! (
129- "sd_session_get_tty failed for session '{}': {}" ,
130- session_id, result
131- )
132- . into ( ) ) ;
125+ return Err (
126+ format ! ( "sd_session_get_tty failed for session '{session_id}': {result}" , ) . into ( ) ,
127+ ) ;
133128 }
134129
135130 if tty_ptr. is_null ( ) {
@@ -156,8 +151,7 @@ mod login {
156151
157152 if result < 0 {
158153 return Err ( format ! (
159- "sd_session_get_remote_host failed for session '{}': {}" ,
160- session_id, result
154+ "sd_session_get_remote_host failed for session '{session_id}': {result}" ,
161155 )
162156 . into ( ) ) ;
163157 }
@@ -186,8 +180,7 @@ mod login {
186180
187181 if result < 0 {
188182 return Err ( format ! (
189- "sd_session_get_display failed for session '{}': {}" ,
190- session_id, result
183+ "sd_session_get_display failed for session '{session_id}': {result}" ,
191184 )
192185 . into ( ) ) ;
193186 }
@@ -214,11 +207,9 @@ mod login {
214207 let result = unsafe { ffi:: sd_session_get_type ( session_cstring. as_ptr ( ) , & mut type_ptr) } ;
215208
216209 if result < 0 {
217- return Err ( format ! (
218- "sd_session_get_type failed for session '{}': {}" ,
219- session_id, result
220- )
221- . into ( ) ) ;
210+ return Err (
211+ format ! ( "sd_session_get_type failed for session '{session_id}': {result}" , ) . into ( ) ,
212+ ) ;
222213 }
223214
224215 if type_ptr. is_null ( ) {
@@ -243,11 +234,9 @@ mod login {
243234 let result = unsafe { ffi:: sd_session_get_seat ( session_cstring. as_ptr ( ) , & mut seat_ptr) } ;
244235
245236 if result < 0 {
246- return Err ( format ! (
247- "sd_session_get_seat failed for session '{}': {}" ,
248- session_id, result
249- )
250- . into ( ) ) ;
237+ return Err (
238+ format ! ( "sd_session_get_seat failed for session '{session_id}': {result}" , ) . into ( ) ,
239+ ) ;
251240 }
252241
253242 if seat_ptr. is_null ( ) {
@@ -276,11 +265,11 @@ mod login {
276265 use std:: fs;
277266
278267 let metadata = fs:: metadata ( "/var/lib/systemd/random-seed" )
279- . map_err ( |e| format ! ( "Failed to read /var/lib/systemd/random-seed: {}" , e ) ) ?;
268+ . map_err ( |e| format ! ( "Failed to read /var/lib/systemd/random-seed: {e}" ) ) ?;
280269
281270 metadata
282271 . modified ( )
283- . map_err ( |e| format ! ( "Failed to get modification time: {}" , e ) . into ( ) )
272+ . map_err ( |e| format ! ( "Failed to get modification time: {e}" ) . into ( ) )
284273 }
285274}
286275
@@ -396,7 +385,7 @@ pub fn read_login_records() -> UResult<Vec<SystemdLoginRecord>> {
396385 . to_string_lossy ( )
397386 . into_owned ( )
398387 } else {
399- format ! ( "{}" , uid ) // fallback to UID if username not found
388+ format ! ( "{uid}" ) // fallback to UID if username not found
400389 }
401390 } ;
402391
@@ -484,7 +473,7 @@ pub fn read_login_records() -> UResult<Vec<SystemdLoginRecord>> {
484473 if !seat. is_empty ( ) && !tty. is_empty ( ) {
485474 // Both seat and tty - need 2 records, clone for first.
486475 // The seat is prefixed with '?' to match GNU's output.
487- let seat_formatted = format ! ( "?{}" , seat ) ;
476+ let seat_formatted = format ! ( "?{seat}" ) ;
488477 records. push ( create_record (
489478 seat_formatted,
490479 seat,
@@ -494,19 +483,19 @@ pub fn read_login_records() -> UResult<Vec<SystemdLoginRecord>> {
494483 ) ) ;
495484
496485 let tty_formatted = if tty. starts_with ( "tty" ) {
497- format ! ( "*{}" , tty )
486+ format ! ( "*{tty}" )
498487 } else {
499488 tty. clone ( )
500489 } ;
501490 records. push ( create_record ( tty_formatted, tty, user, session_id, host) ) ; // Move for second (and last) record
502491 } else if !seat. is_empty ( ) {
503492 // Only seat
504- let seat_formatted = format ! ( "?{}" , seat ) ;
493+ let seat_formatted = format ! ( "?{seat}" ) ;
505494 records. push ( create_record ( seat_formatted, seat, user, session_id, host) ) ;
506495 } else if !tty. is_empty ( ) {
507496 // Only tty
508497 let tty_formatted = if tty. starts_with ( "tty" ) {
509- format ! ( "*{}" , tty )
498+ format ! ( "*{tty}" )
510499 } else {
511500 tty. clone ( )
512501 } ;
0 commit comments