mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-14 06:03:58 +00:00
Use dyn-ref instead of impl to impact compile times the least
This commit is contained in:
parent
5af81b8456
commit
2dd887de47
2 changed files with 3 additions and 3 deletions
|
@ -249,7 +249,7 @@ enum CheckEvent {
|
||||||
pub fn run_cargo(
|
pub fn run_cargo(
|
||||||
args: &[String],
|
args: &[String],
|
||||||
current_dir: Option<&Path>,
|
current_dir: Option<&Path>,
|
||||||
mut on_message: impl FnMut(cargo_metadata::Message) -> bool,
|
on_message: &mut dyn FnMut(cargo_metadata::Message) -> bool,
|
||||||
) -> Child {
|
) -> Child {
|
||||||
let mut command = Command::new("cargo");
|
let mut command = Command::new("cargo");
|
||||||
if let Some(current_dir) = current_dir {
|
if let Some(current_dir) = current_dir {
|
||||||
|
@ -325,7 +325,7 @@ impl WatchThread {
|
||||||
// which will break out of the loop, and continue the shutdown
|
// which will break out of the loop, and continue the shutdown
|
||||||
let _ = message_send.send(CheckEvent::Begin);
|
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
|
// Skip certain kinds of messages to only spend time on what's useful
|
||||||
match &message {
|
match &message {
|
||||||
Message::CompilerArtifact(artifact) if artifact.fresh => return true,
|
Message::CompilerArtifact(artifact) if artifact.fresh => return true,
|
||||||
|
|
|
@ -297,7 +297,7 @@ pub fn load_out_dirs(
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut res = FxHashMap::default();
|
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 {
|
match message {
|
||||||
Message::BuildScriptExecuted(message) => {
|
Message::BuildScriptExecuted(message) => {
|
||||||
let package_id = message.package_id;
|
let package_id = message.package_id;
|
||||||
|
|
Loading…
Reference in a new issue