File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -256,22 +256,14 @@ fn compile_odbc_from_source() {
256256
257257#[ cfg( feature = "static" ) ]
258258fn add_c_files ( build : & mut cc:: Build , dir : & Path ) {
259- if !dir. exists ( ) {
260- return ;
261- }
262-
263- let entries = match std:: fs:: read_dir ( dir) {
264- Ok ( entries) => entries,
265- Err ( _) => return ,
266- } ;
267-
268- let files: Vec < _ > = entries
269- . flatten ( )
270- . map ( |e| e. path ( ) )
271- . filter ( |p| p. extension ( ) . map_or ( false , |ext| ext == "c" ) )
272- . collect ( ) ;
273-
274- build. files ( files) ;
259+ let entries = std:: fs:: read_dir ( dir) . expect ( "Failed to read source files from directory" ) ;
260+ build. files ( entries. flatten ( ) . filter_map ( |p| {
261+ let path = p. path ( ) ;
262+ if path. extension ( ) . unwrap_or_default ( ) == "c" {
263+ return Some ( path) ;
264+ }
265+ None
266+ } ) ) ;
275267}
276268
277269fn print_paths ( paths : & str ) {
You can’t perform that action at this time.
0 commit comments