@@ -5,7 +5,7 @@ use crate::{dirent64, readdir64};
55use core:: cell:: Cell ;
66use core:: ffi:: CStr ;
77use core:: ptr:: NonNull ;
8- use libc:: { fstatat , AT_SYMLINK_NOFOLLOW , DIR } ;
8+ use libc:: { AT_SYMLINK_NOFOLLOW , DIR , fstatat } ;
99/**
1010 POSIX-compliant directory iterator using libc's readdir
1111
@@ -381,15 +381,12 @@ pub trait DirentConstructor {
381381 /// Returns the file descriptor for the current directory being read
382382 fn file_descriptor ( & self ) -> & FileDes ;
383383
384-
385-
386384 #[ inline]
387- #[ allow( clippy:: wildcard_enum_match_arm, reason= "exhaustive" ) ]
385+ #[ allow( clippy:: wildcard_enum_match_arm, reason = "exhaustive" ) ]
388386 #[ allow( clippy:: multiple_unsafe_ops_per_block) ]
389387 /// Constructs a `DirEntry` from a raw directory entry pointer
390388 #[ allow( unused_unsafe) ] //lazy fix for illumos/solaris (where we dont actually dereference the pointer, just return unknown TODO-MAKE MORE ELEGANT)
391389 unsafe fn construct_entry ( & mut self , drnt : * const dirent64 ) -> DirEntry {
392-
393390 let base_len = self . file_index ( ) ;
394391 debug_assert ! ( !drnt. is_null( ) , "drnt should never be null!" ) ;
395392 // SAFETY: The `drnt` must not be null (checked before using)
@@ -398,12 +395,18 @@ pub trait DirentConstructor {
398395 let inode = unsafe { access_dirent ! ( drnt, d_ino) } ;
399396
400397 // SAFETY: The `drnt` must not be null(by precondition)
401- let full_path: & CStr = unsafe { self . construct_path ( drnt) } ;
398+ let full_path: & CStr = unsafe { self . construct_path ( drnt) } ;
402399 let path: Box < CStr > = full_path. into ( ) ;
403400
404- let file_type: FileType = match FileType :: from_dtype ( dtype) {
405- FileType :: Unknown =>stat_syscall ! ( fstatat, self . file_descriptor( ) . 0 , access_dirent!( drnt, d_name) , AT_SYMLINK_NOFOLLOW , DTYPE ) ,
406- not_unknown=>not_unknown //if not unknown, skip the syscall (THIS IS A MASSIVE PERF WIN)
401+ let file_type: FileType = match FileType :: from_dtype ( dtype) {
402+ FileType :: Unknown => stat_syscall ! (
403+ fstatat,
404+ self . file_descriptor( ) . 0 ,
405+ access_dirent!( drnt, d_name) ,
406+ AT_SYMLINK_NOFOLLOW ,
407+ DTYPE
408+ ) ,
409+ not_unknown => not_unknown, //if not unknown, skip the syscall (THIS IS A MASSIVE PERF WIN)
407410 } ;
408411
409412 DirEntry {
0 commit comments