|
1 | 1 | //! Flycheck provides the functionality needed to run `cargo check` to provide
|
2 | 2 | //! LSP diagnostics based on the output of the command.
|
3 | 3 |
|
4 |
| -use std::{fmt, io, mem, process::Command, time::Duration}; |
| 4 | +use std::{fmt, io, mem, process::Command, sync::Arc, time::Duration}; |
5 | 5 |
|
6 | 6 | use cargo_metadata::PackageId;
|
7 | 7 | use crossbeam_channel::{select_biased, unbounded, Receiver, Sender};
|
@@ -153,15 +153,15 @@ pub(crate) enum FlycheckMessage {
|
153 | 153 | /// Request adding a diagnostic with fixes included to a file
|
154 | 154 | AddDiagnostic {
|
155 | 155 | id: usize,
|
156 |
| - workspace_root: AbsPathBuf, |
| 156 | + workspace_root: Arc<AbsPathBuf>, |
157 | 157 | diagnostic: Diagnostic,
|
158 | 158 | package_id: Option<PackageId>,
|
159 | 159 | },
|
160 | 160 |
|
161 | 161 | /// Request clearing all outdated diagnostics.
|
162 | 162 | ClearDiagnostics {
|
163 | 163 | id: usize,
|
164 |
| - /// The pacakge whose diagnostics to clear, or if unspecified, all diagnostics. |
| 164 | + /// The package whose diagnostics to clear, or if unspecified, all diagnostics. |
165 | 165 | package_id: Option<PackageId>,
|
166 | 166 | },
|
167 | 167 |
|
@@ -219,7 +219,7 @@ struct FlycheckActor {
|
219 | 219 | manifest_path: Option<AbsPathBuf>,
|
220 | 220 | /// Either the workspace root of the workspace we are flychecking,
|
221 | 221 | /// or the project root of the project.
|
222 |
| - root: AbsPathBuf, |
| 222 | + root: Arc<AbsPathBuf>, |
223 | 223 | sysroot_root: Option<AbsPathBuf>,
|
224 | 224 | /// CargoHandle exists to wrap around the communication needed to be able to
|
225 | 225 | /// run `cargo check` without blocking. Currently the Rust standard library
|
@@ -261,7 +261,7 @@ impl FlycheckActor {
|
261 | 261 | sender,
|
262 | 262 | config,
|
263 | 263 | sysroot_root,
|
264 |
| - root: workspace_root, |
| 264 | + root: Arc::new(workspace_root), |
265 | 265 | manifest_path,
|
266 | 266 | command_handle: None,
|
267 | 267 | command_receiver: None,
|
@@ -431,7 +431,7 @@ impl FlycheckActor {
|
431 | 431 | cmd.env("RUSTUP_TOOLCHAIN", AsRef::<std::path::Path>::as_ref(sysroot_root));
|
432 | 432 | }
|
433 | 433 | cmd.arg(command);
|
434 |
| - cmd.current_dir(&self.root); |
| 434 | + cmd.current_dir(&*self.root); |
435 | 435 |
|
436 | 436 | match package {
|
437 | 437 | Some(pkg) => cmd.arg("-p").arg(pkg),
|
@@ -473,11 +473,11 @@ impl FlycheckActor {
|
473 | 473 |
|
474 | 474 | match invocation_strategy {
|
475 | 475 | InvocationStrategy::Once => {
|
476 |
| - cmd.current_dir(&self.root); |
| 476 | + cmd.current_dir(&*self.root); |
477 | 477 | }
|
478 | 478 | InvocationStrategy::PerWorkspace => {
|
479 | 479 | // FIXME: cmd.current_dir(&affected_workspace);
|
480 |
| - cmd.current_dir(&self.root); |
| 480 | + cmd.current_dir(&*self.root); |
481 | 481 | }
|
482 | 482 | }
|
483 | 483 |
|
|
0 commit comments