@@ -233,20 +233,20 @@ impl Who {
233
233
if !self . my_line_only || cur_tty == ut. tty_device ( ) {
234
234
if self . need_users && ut. is_user_process ( ) {
235
235
self . print_user ( & ut) ?;
236
- } else if self . need_runlevel && run_level_chk ( ut. record_type ( ) ) {
237
- if cfg ! ( target_os = "linux" ) {
238
- self . print_runlevel ( & ut) ;
236
+ } else {
237
+ match ut. record_type ( ) {
238
+ rt if self . need_runlevel && run_level_chk ( rt) => {
239
+ if cfg ! ( target_os = "linux" ) {
240
+ self . print_runlevel ( & ut) ;
241
+ }
242
+ }
243
+ utmpx:: BOOT_TIME if self . need_boottime => self . print_boottime ( & ut) ,
244
+ utmpx:: NEW_TIME if self . need_clockchange => self . print_clockchange ( & ut) ,
245
+ utmpx:: INIT_PROCESS if self . need_initspawn => self . print_initspawn ( & ut) ,
246
+ utmpx:: LOGIN_PROCESS if self . need_login => self . print_login ( & ut) ,
247
+ utmpx:: DEAD_PROCESS if self . need_deadprocs => self . print_deadprocs ( & ut) ,
248
+ _ => { }
239
249
}
240
- } else if self . need_boottime && ut. record_type ( ) == utmpx:: BOOT_TIME {
241
- self . print_boottime ( & ut) ;
242
- } else if self . need_clockchange && ut. record_type ( ) == utmpx:: NEW_TIME {
243
- self . print_clockchange ( & ut) ;
244
- } else if self . need_initspawn && ut. record_type ( ) == utmpx:: INIT_PROCESS {
245
- self . print_initspawn ( & ut) ;
246
- } else if self . need_login && ut. record_type ( ) == utmpx:: LOGIN_PROCESS {
247
- self . print_login ( & ut) ;
248
- } else if self . need_deadprocs && ut. record_type ( ) == utmpx:: DEAD_PROCESS {
249
- self . print_deadprocs ( & ut) ;
250
250
}
251
251
}
252
252
0 commit comments