Skip to content

Commit e551b29

Browse files
chore: type CompilerFamilyLookupCache to preempt clippy::type_complexity
1 parent dfb5491 commit e551b29

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

src/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ use command_helpers::*;
254254

255255
mod tool;
256256
pub use tool::Tool;
257-
use tool::ToolFamily;
257+
use tool::{CompilerFamilyLookupCache, ToolFamily};
258258

259259
mod tempfile;
260260

@@ -277,7 +277,7 @@ struct BuildCache {
277277
env_cache: RwLock<HashMap<Box<str>, Env>>,
278278
apple_sdk_root_cache: RwLock<HashMap<Box<str>, Arc<OsStr>>>,
279279
apple_versions_cache: RwLock<HashMap<Box<str>, Arc<str>>>,
280-
cached_compiler_family: RwLock<HashMap<Box<Path>, ToolFamily>>,
280+
cached_compiler_family: RwLock<CompilerFamilyLookupCache>,
281281
known_flag_support_status_cache: RwLock<HashMap<CompilerFlag, bool>>,
282282
target_info_parser: target::TargetInfoParser,
283283
}

src/tool.rs

+5-3
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ use crate::{
1616
Error, ErrorKind, OutputKind,
1717
};
1818

19+
pub(crate) type CompilerFamilyLookupCache = HashMap<Box<Path>, ToolFamily>;
20+
1921
/// Configuration used to represent an invocation of a C compiler.
2022
///
2123
/// This can be used to figure out what compiler is in use, what the arguments
@@ -40,7 +42,7 @@ pub struct Tool {
4042
impl Tool {
4143
pub(crate) fn new(
4244
path: PathBuf,
43-
cached_compiler_family: &RwLock<HashMap<Box<Path>, ToolFamily>>,
45+
cached_compiler_family: &RwLock<CompilerFamilyLookupCache>,
4446
cargo_output: &CargoOutput,
4547
out_dir: Option<&Path>,
4648
) -> Self {
@@ -57,7 +59,7 @@ impl Tool {
5759
pub(crate) fn with_args(
5860
path: PathBuf,
5961
args: Vec<String>,
60-
cached_compiler_family: &RwLock<HashMap<Box<Path>, ToolFamily>>,
62+
cached_compiler_family: &RwLock<CompilerFamilyLookupCache>,
6163
cargo_output: &CargoOutput,
6264
out_dir: Option<&Path>,
6365
) -> Self {
@@ -90,7 +92,7 @@ impl Tool {
9092
path: PathBuf,
9193
args: Vec<String>,
9294
cuda: bool,
93-
cached_compiler_family: &RwLock<HashMap<Box<Path>, ToolFamily>>,
95+
cached_compiler_family: &RwLock<CompilerFamilyLookupCache>,
9496
cargo_output: &CargoOutput,
9597
out_dir: Option<&Path>,
9698
) -> Self {

0 commit comments

Comments
 (0)