Skip to content

Commit

Permalink
No commit message
Browse files Browse the repository at this point in the history
  • Loading branch information
max-sixty committed Sep 25, 2024
1 parent 7af71cc commit ecd40aa
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions insta/src/env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,11 @@ lazy_static::lazy_static! {

pub fn get_tool_config(manifest_dir: &str) -> Arc<ToolConfig> {
let mut configs = TOOL_CONFIGS.lock().unwrap();
if let Some(rv) = configs.get(manifest_dir) {
return rv.clone();
}
let config =
Arc::new(ToolConfig::from_manifest_dir(manifest_dir).expect("failed to load tool config"));
configs.insert(manifest_dir.to_string(), config.clone());
config

configs
.entry(manifest_dir.to_string())
.or_insert_with(|| Arc::new(ToolConfig::from_manifest_dir(manifest_dir).unwrap()))
.clone()
}

/// The test runner to use.
Expand Down Expand Up @@ -411,7 +409,8 @@ pub fn snapshot_update_behavior(tool_config: &ToolConfig, unseen: bool) -> Snaps

/// Returns the cargo workspace for a manifest
pub fn get_cargo_workspace(manifest_dir: &str) -> Arc<PathBuf> {
let mut workspaces = WORKSPACES.lock().expect("Failed to lock WORKSPACES");
// we really do not care about poisoning here.
let mut workspaces = WORKSPACES.lock().unwrap();

workspaces
.entry(manifest_dir.to_string())
Expand Down

0 comments on commit ecd40aa

Please sign in to comment.