File tree Expand file tree Collapse file tree 1 file changed +3
-21
lines changed
compiler/rustc_interface/src Expand file tree Collapse file tree 1 file changed +3
-21
lines changed Original file line number Diff line number Diff line change @@ -392,34 +392,16 @@ fn generated_output_paths(
392392 out_filenames
393393}
394394
395- // Runs `f` on every output file path and returns the first non-None result, or None if `f`
396- // returns None for every file path.
397- fn check_output < F , T > ( output_paths : & [ PathBuf ] , f : F ) -> Option < T >
398- where
399- F : Fn ( & PathBuf ) -> Option < T > ,
400- {
401- for output_path in output_paths {
402- if let Some ( result) = f ( output_path) {
403- return Some ( result) ;
404- }
405- }
406- None
407- }
408-
409395fn output_contains_path ( output_paths : & [ PathBuf ] , input_path : & Path ) -> bool {
410396 let input_path = try_canonicalize ( input_path) . ok ( ) ;
411397 if input_path. is_none ( ) {
412398 return false ;
413399 }
414- let check = |output_path : & PathBuf | {
415- if try_canonicalize ( output_path) . ok ( ) == input_path { Some ( ( ) ) } else { None }
416- } ;
417- check_output ( output_paths, check) . is_some ( )
400+ output_paths. iter ( ) . any ( |output_path| try_canonicalize ( output_path) . ok ( ) == input_path)
418401}
419402
420- fn output_conflicts_with_dir ( output_paths : & [ PathBuf ] ) -> Option < PathBuf > {
421- let check = |output_path : & PathBuf | output_path. is_dir ( ) . then ( || output_path. clone ( ) ) ;
422- check_output ( output_paths, check)
403+ fn output_conflicts_with_dir ( output_paths : & [ PathBuf ] ) -> Option < & PathBuf > {
404+ output_paths. iter ( ) . find ( |output_path| output_path. is_dir ( ) )
423405}
424406
425407fn escape_dep_filename ( filename : & str ) -> String {
You can’t perform that action at this time.
0 commit comments