From 2dd887de4761e2493f4df56233b0e11185d74d63 Mon Sep 17 00:00:00 2001 From: Emil Lauridsen Date: Tue, 17 Mar 2020 14:56:53 +0100 Subject: Use dyn-ref instead of impl to impact compile times the least --- crates/ra_cargo_watch/src/lib.rs | 4 ++-- crates/ra_project_model/src/cargo_workspace.rs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'crates') diff --git a/crates/ra_cargo_watch/src/lib.rs b/crates/ra_cargo_watch/src/lib.rs index 71aa28f0a..bffe5eb00 100644 --- a/crates/ra_cargo_watch/src/lib.rs +++ b/crates/ra_cargo_watch/src/lib.rs @@ -249,7 +249,7 @@ enum CheckEvent { pub fn run_cargo( args: &[String], current_dir: Option<&Path>, - mut on_message: impl FnMut(cargo_metadata::Message) -> bool, + on_message: &mut dyn FnMut(cargo_metadata::Message) -> bool, ) -> Child { let mut command = Command::new("cargo"); if let Some(current_dir) = current_dir { @@ -325,7 +325,7 @@ impl WatchThread { // which will break out of the loop, and continue the shutdown let _ = message_send.send(CheckEvent::Begin); - let mut child = run_cargo(&args, Some(&workspace_root), |message| { + let mut child = run_cargo(&args, Some(&workspace_root), &mut |message| { // Skip certain kinds of messages to only spend time on what's useful match &message { Message::CompilerArtifact(artifact) if artifact.fresh => return true, diff --git a/crates/ra_project_model/src/cargo_workspace.rs b/crates/ra_project_model/src/cargo_workspace.rs index 72cb5d388..10ecfa951 100644 --- a/crates/ra_project_model/src/cargo_workspace.rs +++ b/crates/ra_project_model/src/cargo_workspace.rs @@ -297,7 +297,7 @@ pub fn load_out_dirs( } let mut res = FxHashMap::default(); - let mut child = run_cargo(&args, cargo_toml.parent(), |message| { + let mut child = run_cargo(&args, cargo_toml.parent(), &mut |message| { match message { Message::BuildScriptExecuted(message) => { let package_id = message.package_id; -- cgit v1.2.3