@@ -16,6 +16,8 @@ use crate::{
16
16
Error , ErrorKind , OutputKind ,
17
17
} ;
18
18
19
+ pub ( crate ) type CompilerFamilyLookupCache = HashMap < Box < Path > , ToolFamily > ;
20
+
19
21
/// Configuration used to represent an invocation of a C compiler.
20
22
///
21
23
/// This can be used to figure out what compiler is in use, what the arguments
@@ -40,7 +42,7 @@ pub struct Tool {
40
42
impl Tool {
41
43
pub ( crate ) fn new (
42
44
path : PathBuf ,
43
- cached_compiler_family : & RwLock < HashMap < Box < Path > , ToolFamily > > ,
45
+ cached_compiler_family : & RwLock < CompilerFamilyLookupCache > ,
44
46
cargo_output : & CargoOutput ,
45
47
out_dir : Option < & Path > ,
46
48
) -> Self {
@@ -57,7 +59,7 @@ impl Tool {
57
59
pub ( crate ) fn with_args (
58
60
path : PathBuf ,
59
61
args : Vec < String > ,
60
- cached_compiler_family : & RwLock < HashMap < Box < Path > , ToolFamily > > ,
62
+ cached_compiler_family : & RwLock < CompilerFamilyLookupCache > ,
61
63
cargo_output : & CargoOutput ,
62
64
out_dir : Option < & Path > ,
63
65
) -> Self {
@@ -90,7 +92,7 @@ impl Tool {
90
92
path : PathBuf ,
91
93
args : Vec < String > ,
92
94
cuda : bool ,
93
- cached_compiler_family : & RwLock < HashMap < Box < Path > , ToolFamily > > ,
95
+ cached_compiler_family : & RwLock < CompilerFamilyLookupCache > ,
94
96
cargo_output : & CargoOutput ,
95
97
out_dir : Option < & Path > ,
96
98
) -> Self {
@@ -238,7 +240,7 @@ impl Tool {
238
240
Some ( fname) if fname. contains ( "clang" ) => {
239
241
let is_clang_cl = args
240
242
. iter ( )
241
- . find_map ( |a| a. strip_prefix ( "--driver-mode=" ) == Some ( "cl" ) )
243
+ . any ( |a| a. strip_prefix ( "--driver-mode=" ) == Some ( "cl" ) ) ;
242
244
if is_clang_cl {
243
245
ToolFamily :: Msvc { clang_cl : true }
244
246
} else {
0 commit comments