Skip to content

Commit 2dd887d

Browse files
committed
Use dyn-ref instead of impl to impact compile times the least
1 parent 5af81b8 commit 2dd887d

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

crates/ra_cargo_watch/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ enum CheckEvent {
249249
pub fn run_cargo(
250250
args: &[String],
251251
current_dir: Option<&Path>,
252-
mut on_message: impl FnMut(cargo_metadata::Message) -> bool,
252+
on_message: &mut dyn FnMut(cargo_metadata::Message) -> bool,
253253
) -> Child {
254254
let mut command = Command::new("cargo");
255255
if let Some(current_dir) = current_dir {
@@ -325,7 +325,7 @@ impl WatchThread {
325325
// which will break out of the loop, and continue the shutdown
326326
let _ = message_send.send(CheckEvent::Begin);
327327

328-
let mut child = run_cargo(&args, Some(&workspace_root), |message| {
328+
let mut child = run_cargo(&args, Some(&workspace_root), &mut |message| {
329329
// Skip certain kinds of messages to only spend time on what's useful
330330
match &message {
331331
Message::CompilerArtifact(artifact) if artifact.fresh => return true,

crates/ra_project_model/src/cargo_workspace.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ pub fn load_out_dirs(
297297
}
298298

299299
let mut res = FxHashMap::default();
300-
let mut child = run_cargo(&args, cargo_toml.parent(), |message| {
300+
let mut child = run_cargo(&args, cargo_toml.parent(), &mut |message| {
301301
match message {
302302
Message::BuildScriptExecuted(message) => {
303303
let package_id = message.package_id;

0 commit comments

Comments
 (0)