Use dyn-ref instead of impl to impact compile times the least

This commit is contained in:
Emil Lauridsen 2020-03-17 14:56:53 +01:00
parent 5af81b8456
commit 2dd887de47
2 changed files with 3 additions and 3 deletions

View file

@ -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,

View file

@ -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;