@@ -2,7 +2,6 @@ use std::path::Path;
22use std:: str:: FromStr ;
33
44use tracing:: debug;
5- use walkdir:: WalkDir ;
65
76use uv_pep440:: Version ;
87use uv_static:: EnvVars ;
@@ -17,8 +16,6 @@ pub enum AcceleratorError {
1716 Utf8 ( #[ from] std:: string:: FromUtf8Error ) ,
1817 #[ error( transparent) ]
1918 ParseInt ( #[ from] std:: num:: ParseIntError ) ,
20- #[ error( transparent) ]
21- WalkDir ( #[ from] walkdir:: Error ) ,
2219 #[ error( "Unknown AMD GPU architecture: {0}" ) ]
2320 UnknownAmdGpuArchitecture ( String ) ,
2421}
@@ -168,15 +165,10 @@ impl Accelerator {
168165 }
169166
170167 // Read from `/sys/bus/pci/devices` to filter for Intel GPU via PCI.
171- match WalkDir :: new ( "/sys/bus/pci/devices" )
172- . min_depth ( 1 )
173- . max_depth ( 1 )
174- . into_iter ( )
175- . collect :: < Result < Vec < _ > , _ > > ( )
176- {
168+ match fs_err:: read_dir ( "/sys/bus/pci/devices" ) {
177169 Ok ( entries) => {
178- for entry in entries {
179- match parse_pci_device_ids ( entry. path ( ) ) {
170+ for entry in entries. flatten ( ) {
171+ match parse_pci_device_ids ( & entry. path ( ) ) {
180172 Ok ( ( class, vendor) ) => {
181173 if ( class & PCI_BASE_CLASS_MASK ) == PCI_BASE_CLASS_DISPLAY
182174 && vendor == PCI_VENDOR_ID_INTEL
@@ -191,13 +183,8 @@ impl Accelerator {
191183 }
192184 }
193185 }
194- Err ( e)
195- if e. io_error ( )
196- . is_some_and ( |io| io. kind ( ) == std:: io:: ErrorKind :: NotFound ) => { }
197- Err ( e) => {
198- debug ! ( "Failed to read PCI device directory with WalkDir: {e}" ) ;
199- return Err ( e. into ( ) ) ;
200- }
186+ Err ( e) if e. kind ( ) == std:: io:: ErrorKind :: NotFound => { }
187+ Err ( e) => return Err ( e. into ( ) ) ,
201188 }
202189
203190 debug ! ( "Failed to detect GPU driver version" ) ;
0 commit comments