diff --git a/crates/rust-analyzer/src/config.rs b/crates/rust-analyzer/src/config.rs index 9c5af5ff6a55..69229c067b7b 100644 --- a/crates/rust-analyzer/src/config.rs +++ b/crates/rust-analyzer/src/config.rs @@ -36,7 +36,7 @@ use vfs::{AbsPath, AbsPathBuf, VfsPath}; use crate::{ diagnostics::DiagnosticsMapConfig, - flycheck::{CargoOptions, FlycheckConfig}, + flycheck::command::{CargoOptions, FlycheckConfig}, lsp::capabilities::ClientCapabilities, lsp_ext::{WorkspaceSymbolSearchKind, WorkspaceSymbolSearchScope}, }; @@ -2082,9 +2082,11 @@ impl Config { args, extra_env: self.check_extra_env(source_root), invocation_strategy: match self.check_invocationStrategy(source_root) { - InvocationStrategy::Once => crate::flycheck::InvocationStrategy::Once, + InvocationStrategy::Once => { + crate::flycheck::command::InvocationStrategy::Once + } InvocationStrategy::PerWorkspace => { - crate::flycheck::InvocationStrategy::PerWorkspace + crate::flycheck::command::InvocationStrategy::PerWorkspace } }, } diff --git a/crates/rust-analyzer/src/flycheck.rs b/crates/rust-analyzer/src/flycheck.rs index 22f06d68d80d..56fd36e99388 100644 --- a/crates/rust-analyzer/src/flycheck.rs +++ b/crates/rust-analyzer/src/flycheck.rs @@ -1,103 +1,24 @@ //! Flycheck provides the functionality needed to run `cargo check` to provide //! LSP diagnostics based on the output of the command. -use std::{fmt, io, process::Command, time::Duration}; +use std::{fmt, io, time::Duration}; use cargo_metadata::PackageId; +use command::{check_command, FlycheckConfig, Target}; use crossbeam_channel::{select_biased, unbounded, Receiver, Sender}; use ide_db::FxHashSet; -use paths::{AbsPath, AbsPathBuf, Utf8PathBuf}; -use rustc_hash::FxHashMap; +use paths::AbsPathBuf; use serde::Deserialize as _; use serde_derive::Deserialize; pub(crate) use cargo_metadata::diagnostic::{ Applicability, Diagnostic, DiagnosticCode, DiagnosticLevel, DiagnosticSpan, }; -use toolchain::Tool; use triomphe::Arc; use crate::command::{CommandHandle, ParseFromLine}; -#[derive(Clone, Debug, Default, PartialEq, Eq)] -pub(crate) enum InvocationStrategy { - Once, - #[default] - PerWorkspace, -} - -#[derive(Clone, Debug, PartialEq, Eq)] -pub(crate) struct CargoOptions { - pub(crate) target_tuples: Vec, - pub(crate) all_targets: bool, - pub(crate) no_default_features: bool, - pub(crate) all_features: bool, - pub(crate) features: Vec, - pub(crate) extra_args: Vec, - pub(crate) extra_test_bin_args: Vec, - pub(crate) extra_env: FxHashMap, - pub(crate) target_dir: Option, -} - -#[derive(Clone, Debug)] -pub(crate) enum Target { - Bin(String), - Example(String), - Benchmark(String), - Test(String), -} - -impl CargoOptions { - pub(crate) fn apply_on_command(&self, cmd: &mut Command) { - for target in &self.target_tuples { - cmd.args(["--target", target.as_str()]); - } - if self.all_targets { - cmd.arg("--all-targets"); - } - if self.all_features { - cmd.arg("--all-features"); - } else { - if self.no_default_features { - cmd.arg("--no-default-features"); - } - if !self.features.is_empty() { - cmd.arg("--features"); - cmd.arg(self.features.join(" ")); - } - } - if let Some(target_dir) = &self.target_dir { - cmd.arg("--target-dir").arg(target_dir); - } - cmd.envs(&self.extra_env); - } -} - -#[derive(Clone, Debug, PartialEq, Eq)] -pub(crate) enum FlycheckConfig { - CargoCommand { - command: String, - options: CargoOptions, - ansi_color_output: bool, - }, - CustomCommand { - command: String, - args: Vec, - extra_env: FxHashMap, - invocation_strategy: InvocationStrategy, - }, -} - -impl fmt::Display for FlycheckConfig { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - match self { - FlycheckConfig::CargoCommand { command, .. } => write!(f, "cargo {command}"), - FlycheckConfig::CustomCommand { command, args, .. } => { - write!(f, "{command} {}", args.join(" ")) - } - } - } -} +pub(crate) mod command; /// Flycheck wraps the shared state and communication machinery used for /// running `cargo check` (or other compatible command) and providing @@ -115,13 +36,11 @@ impl FlycheckHandle { pub(crate) fn spawn( id: usize, sender: Sender, - config: FlycheckConfig, sysroot_root: Option, workspace_root: AbsPathBuf, manifest_path: Option, ) -> FlycheckHandle { - let actor = - FlycheckActor::new(id, sender, config, sysroot_root, workspace_root, manifest_path); + let actor = FlycheckActor::new(id, sender, sysroot_root, workspace_root, manifest_path); let (sender, receiver) = unbounded::(); let thread = stdx::thread::Builder::new(stdx::thread::ThreadIntent::Worker) .name("Flycheck".to_owned()) @@ -131,14 +50,21 @@ impl FlycheckHandle { } /// Schedule a re-start of the cargo check worker to do a workspace wide check. - pub(crate) fn restart_workspace(&self, saved_file: Option) { - self.sender.send(StateChange::Restart { package: None, saved_file, target: None }).unwrap(); + pub(crate) fn restart_workspace(&self, saved_file: Option, config: FlycheckConfig) { + self.sender + .send(StateChange::Restart { package: None, saved_file, target: None, config }) + .unwrap(); } /// Schedule a re-start of the cargo check worker to do a package wide check. - pub(crate) fn restart_for_package(&self, package: String, target: Option) { + pub(crate) fn restart_for_package( + &self, + package: String, + target: Option, + config: FlycheckConfig, + ) { self.sender - .send(StateChange::Restart { package: Some(package), saved_file: None, target }) + .send(StateChange::Restart { package: Some(package), saved_file: None, target, config }) .unwrap(); } @@ -208,7 +134,12 @@ pub(crate) enum Progress { } enum StateChange { - Restart { package: Option, saved_file: Option, target: Option }, + Restart { + package: Option, + saved_file: Option, + target: Option, + config: FlycheckConfig, + }, Cancel, } @@ -218,7 +149,6 @@ struct FlycheckActor { id: usize, sender: Sender, - config: FlycheckConfig, manifest_path: Option, /// Either the workspace root of the workspace we are flychecking, /// or the project root of the project. @@ -243,13 +173,10 @@ enum Event { CheckEvent(Option), } -pub(crate) const SAVED_FILE_PLACEHOLDER: &str = "$saved_file"; - impl FlycheckActor { fn new( id: usize, sender: Sender, - config: FlycheckConfig, sysroot_root: Option, workspace_root: AbsPathBuf, manifest_path: Option, @@ -258,7 +185,6 @@ impl FlycheckActor { FlycheckActor { id, sender, - config, sysroot_root, root: Arc::new(workspace_root), manifest_path, @@ -293,7 +219,12 @@ impl FlycheckActor { tracing::debug!(flycheck_id = self.id, "flycheck cancelled"); self.cancel_check_process(); } - Event::RequestStateChange(StateChange::Restart { package, saved_file, target }) => { + Event::RequestStateChange(StateChange::Restart { + package, + saved_file, + target, + config, + }) => { // Cancel the previously spawned process self.cancel_check_process(); while let Ok(restart) = inbox.recv_timeout(Duration::from_millis(50)) { @@ -303,9 +234,15 @@ impl FlycheckActor { } } - let Some(command) = - self.check_command(package.as_deref(), saved_file.as_deref(), target) - else { + let Some(command) = check_command( + &self.root, + &self.sysroot_root, + &self.manifest_path, + config, + package.as_deref(), + saved_file.as_deref(), + target, + ) else { continue; }; @@ -438,95 +375,6 @@ impl FlycheckActor { self.diagnostics_received = false; } - /// Construct a `Command` object for checking the user's code. If the user - /// has specified a custom command with placeholders that we cannot fill, - /// return None. - fn check_command( - &self, - package: Option<&str>, - saved_file: Option<&AbsPath>, - target: Option, - ) -> Option { - match &self.config { - FlycheckConfig::CargoCommand { command, options, ansi_color_output } => { - let mut cmd = toolchain::command(Tool::Cargo.path(), &*self.root); - if let Some(sysroot_root) = &self.sysroot_root { - cmd.env("RUSTUP_TOOLCHAIN", AsRef::::as_ref(sysroot_root)); - } - cmd.arg(command); - - match package { - Some(pkg) => cmd.arg("-p").arg(pkg), - None => cmd.arg("--workspace"), - }; - - if let Some(tgt) = target { - match tgt { - Target::Bin(tgt) => cmd.arg("--bin").arg(tgt), - Target::Example(tgt) => cmd.arg("--example").arg(tgt), - Target::Test(tgt) => cmd.arg("--test").arg(tgt), - Target::Benchmark(tgt) => cmd.arg("--bench").arg(tgt), - }; - } - - cmd.arg(if *ansi_color_output { - "--message-format=json-diagnostic-rendered-ansi" - } else { - "--message-format=json" - }); - - if let Some(manifest_path) = &self.manifest_path { - cmd.arg("--manifest-path"); - cmd.arg(manifest_path); - if manifest_path.extension() == Some("rs") { - cmd.arg("-Zscript"); - } - } - - cmd.arg("--keep-going"); - - options.apply_on_command(&mut cmd); - cmd.args(&options.extra_args); - Some(cmd) - } - FlycheckConfig::CustomCommand { command, args, extra_env, invocation_strategy } => { - let root = match invocation_strategy { - InvocationStrategy::Once => &*self.root, - InvocationStrategy::PerWorkspace => { - // FIXME: &affected_workspace - &*self.root - } - }; - let mut cmd = toolchain::command(command, root); - cmd.envs(extra_env); - - // If the custom command has a $saved_file placeholder, and - // we're saving a file, replace the placeholder in the arguments. - if let Some(saved_file) = saved_file { - for arg in args { - if arg == SAVED_FILE_PLACEHOLDER { - cmd.arg(saved_file); - } else { - cmd.arg(arg); - } - } - } else { - for arg in args { - if arg == SAVED_FILE_PLACEHOLDER { - // The custom command has a $saved_file placeholder, - // but we had an IDE event that wasn't a file save. Do nothing. - return None; - } - - cmd.arg(arg); - } - } - - Some(cmd) - } - } - } - #[track_caller] fn send(&self, check_task: FlycheckMessage) { self.sender.send(check_task).unwrap(); diff --git a/crates/rust-analyzer/src/flycheck/command.rs b/crates/rust-analyzer/src/flycheck/command.rs new file mode 100644 index 000000000000..5575a9628a68 --- /dev/null +++ b/crates/rust-analyzer/src/flycheck/command.rs @@ -0,0 +1,180 @@ +use std::{fmt, process::Command}; + +use ide_db::FxHashMap; +use paths::Utf8PathBuf; +use toolchain::Tool; +use vfs::{AbsPath, AbsPathBuf}; + +pub(crate) const SAVED_FILE_PLACEHOLDER: &str = "$saved_file"; + +#[derive(Clone, Debug, Default, PartialEq, Eq)] +pub(crate) enum InvocationStrategy { + Once, + #[default] + PerWorkspace, +} + +#[derive(Clone, Debug, PartialEq, Eq)] +pub(crate) struct CargoOptions { + pub(crate) target_tuples: Vec, + pub(crate) all_targets: bool, + pub(crate) no_default_features: bool, + pub(crate) all_features: bool, + pub(crate) features: Vec, + pub(crate) extra_args: Vec, + pub(crate) extra_test_bin_args: Vec, + pub(crate) extra_env: FxHashMap, + pub(crate) target_dir: Option, +} + +#[derive(Clone, Debug)] +pub(crate) enum Target { + Bin(String), + Example(String), + Benchmark(String), + Test(String), +} + +impl CargoOptions { + pub(crate) fn apply_on_command(&self, cmd: &mut Command) { + for target in &self.target_tuples { + cmd.args(["--target", target.as_str()]); + } + if self.all_targets { + cmd.arg("--all-targets"); + } + if self.all_features { + cmd.arg("--all-features"); + } else { + if self.no_default_features { + cmd.arg("--no-default-features"); + } + if !self.features.is_empty() { + cmd.arg("--features"); + cmd.arg(self.features.join(" ")); + } + } + if let Some(target_dir) = &self.target_dir { + cmd.arg("--target-dir").arg(target_dir); + } + cmd.envs(&self.extra_env); + } +} + +#[derive(Clone, Debug, PartialEq, Eq)] +pub(crate) enum FlycheckConfig { + CargoCommand { + command: String, + options: CargoOptions, + ansi_color_output: bool, + }, + CustomCommand { + command: String, + args: Vec, + extra_env: FxHashMap, + invocation_strategy: InvocationStrategy, + }, +} + +impl fmt::Display for FlycheckConfig { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + match self { + FlycheckConfig::CargoCommand { command, .. } => write!(f, "cargo {command}"), + FlycheckConfig::CustomCommand { command, args, .. } => { + write!(f, "{command} {}", args.join(" ")) + } + } + } +} + +/// Construct a `Command` object for checking the user's code. If the user +/// has specified a custom command with placeholders that we cannot fill, +/// return None. +pub(super) fn check_command( + root: &AbsPathBuf, + sysroot_root: &Option, + manifest_path: &Option, + config: FlycheckConfig, + package: Option<&str>, + saved_file: Option<&AbsPath>, + target: Option, +) -> Option { + match config { + FlycheckConfig::CargoCommand { command, options, ansi_color_output } => { + let mut cmd = toolchain::command(Tool::Cargo.path(), &*root); + if let Some(sysroot_root) = &sysroot_root { + cmd.env("RUSTUP_TOOLCHAIN", AsRef::::as_ref(sysroot_root)); + } + cmd.arg(command); + + match package { + Some(pkg) => cmd.arg("-p").arg(pkg), + None => cmd.arg("--workspace"), + }; + + if let Some(tgt) = target { + match tgt { + Target::Bin(tgt) => cmd.arg("--bin").arg(tgt), + Target::Example(tgt) => cmd.arg("--example").arg(tgt), + Target::Test(tgt) => cmd.arg("--test").arg(tgt), + Target::Benchmark(tgt) => cmd.arg("--bench").arg(tgt), + }; + } + + cmd.arg(if ansi_color_output { + "--message-format=json-diagnostic-rendered-ansi" + } else { + "--message-format=json" + }); + + if let Some(manifest_path) = &manifest_path { + cmd.arg("--manifest-path"); + cmd.arg(manifest_path); + if manifest_path.extension() == Some("rs") { + cmd.arg("-Zscript"); + } + } + + cmd.arg("--keep-going"); + + options.apply_on_command(&mut cmd); + cmd.args(&options.extra_args); + Some(cmd) + } + FlycheckConfig::CustomCommand { command, args, extra_env, invocation_strategy } => { + let root = match invocation_strategy { + InvocationStrategy::Once => &*root, + InvocationStrategy::PerWorkspace => { + // FIXME: &affected_workspace + &*root + } + }; + let mut cmd = toolchain::command(command, root); + cmd.envs(extra_env); + + // If the custom command has a $saved_file placeholder, and + // we're saving a file, replace the placeholder in the arguments. + if let Some(saved_file) = saved_file { + for arg in args { + if arg == SAVED_FILE_PLACEHOLDER { + cmd.arg(saved_file); + } else { + cmd.arg(arg); + } + } + } else { + for arg in args { + if arg == SAVED_FILE_PLACEHOLDER { + // The custom command has a $saved_file placeholder, + // but we had an IDE event that wasn't a file save. Do nothing. + return None; + } + + cmd.arg(arg); + } + } + + Some(cmd) + } + } +} diff --git a/crates/rust-analyzer/src/global_state.rs b/crates/rust-analyzer/src/global_state.rs index 0f2d7823b7e7..82ea2ce73232 100644 --- a/crates/rust-analyzer/src/global_state.rs +++ b/crates/rust-analyzer/src/global_state.rs @@ -152,6 +152,10 @@ pub(crate) struct GlobalState { /// the user just adds comments or whitespace to Cargo.toml, we do not want /// to invalidate any salsa caches. pub(crate) workspaces: Arc>, + + /// Maps a workspace to its corresponding top level `SourceRootId`. + /// The key used here is the index as used by the `workspaces` field. + pub(crate) workspace_source_root_map: Arc>, pub(crate) crate_graph_file_dependencies: FxHashSet, pub(crate) detached_files: FxHashSet, @@ -183,6 +187,9 @@ pub(crate) struct GlobalStateSnapshot { pub(crate) semantic_tokens_cache: Arc>>, vfs: Arc)>>, pub(crate) workspaces: Arc>, + // FIXME : @alibektas remove this as soon as flycheck_rewrite is in place. + #[allow(dead_code)] + pub(crate) workspace_source_root_map: Arc>, // used to signal semantic highlighting to fall back to syntax based highlighting until // proc-macros have been loaded // FIXME: Can we derive this from somewhere else? @@ -273,6 +280,8 @@ impl GlobalState { wants_to_switch: None, workspaces: Arc::from(Vec::new()), + workspace_source_root_map: Arc::new(FxHashMap::default()), + crate_graph_file_dependencies: FxHashSet::default(), detached_files: FxHashSet::default(), fetch_workspaces_queue: OpQueue::default(), @@ -392,6 +401,36 @@ impl GlobalState { let _p = span!(Level::INFO, "GlobalState::process_changes/apply_change").entered(); self.analysis_host.apply_change(change); + + { + let vfs = self.vfs.read(); + let analysis = self.analysis_host.analysis(); + let mut workspace_source_root_map = FxHashMap::default(); + + let mut insert_map = |workspace_id, manifest_path: Option<&ManifestPath>| { + if let Some(manifest_path) = manifest_path { + let vfs_path = VfsPath::from(manifest_path.normalize()); + if let Some(file_id) = vfs.0.file_id(&vfs_path) { + if let Ok(sr) = analysis.source_root_id(file_id) { + workspace_source_root_map.insert(workspace_id, sr); + } + } + } + }; + + self.workspaces.iter().enumerate().for_each(|(ws_id, ws)| match &ws.kind { + ProjectWorkspaceKind::Cargo { cargo, .. } => { + insert_map(ws_id, Some(cargo.manifest_path())); + } + ProjectWorkspaceKind::Json(project_json) => { + insert_map(ws_id, project_json.manifest()) + } + ProjectWorkspaceKind::DetachedFile { file, .. } => insert_map(ws_id, Some(file)), + }); + + self.workspace_source_root_map = Arc::new(workspace_source_root_map); + } + if !modified_ratoml_files.is_empty() || !self.config.same_source_root_parent_map(&self.local_roots_parent_map) { @@ -518,6 +557,7 @@ impl GlobalState { GlobalStateSnapshot { config: Arc::clone(&self.config), workspaces: Arc::clone(&self.workspaces), + workspace_source_root_map: Arc::clone(&self.workspace_source_root_map), analysis: self.analysis_host.analysis(), vfs: Arc::clone(&self.vfs), check_fixes: Arc::clone(&self.diagnostics.check_fixes), diff --git a/crates/rust-analyzer/src/handlers/notification.rs b/crates/rust-analyzer/src/handlers/notification.rs index 98efc637c2c8..2893d88104d1 100644 --- a/crates/rust-analyzer/src/handlers/notification.rs +++ b/crates/rust-analyzer/src/handlers/notification.rs @@ -15,7 +15,7 @@ use vfs::{AbsPathBuf, ChangeKind, VfsPath}; use crate::{ config::{Config, ConfigChange}, - flycheck::Target, + flycheck::command::Target, global_state::{FetchWorkspaceRequest, GlobalState}, lsp::{from_proto, utils::apply_document_changes}, lsp_ext::{self, RunFlycheckParams}, @@ -190,7 +190,9 @@ pub(crate) fn handle_did_save_text_document( } else if state.config.check_on_save(None) && state.config.flycheck_workspace(None) { // No specific flycheck was triggered, so let's trigger all of them. for flycheck in state.flycheck.iter() { - flycheck.restart_workspace(None); + let sr = state.workspace_source_root_map.get(&flycheck.id()); + let config = state.config.flycheck(sr.cloned()); + flycheck.restart_workspace(None, config); } } @@ -330,7 +332,10 @@ fn run_flycheck(state: &mut GlobalState, vfs_path: VfsPath) -> bool { _ => false, }); if let Some((idx, _)) = workspace { - world.flycheck[idx].restart_for_package(package, target); + let flycheck = &world.flycheck[idx]; + let source_root = world.workspace_source_root_map.get(&flycheck.id()); + let config = world.config.flycheck(source_root.cloned()); + flycheck.restart_for_package(package, target, config); } } } @@ -391,7 +396,9 @@ fn run_flycheck(state: &mut GlobalState, vfs_path: VfsPath) -> bool { for (id, _) in workspace_ids.clone() { if id == flycheck.id() { updated = true; - flycheck.restart_workspace(saved_file.clone()); + let sr = world.workspace_source_root_map.get(&id); + let config = world.config.flycheck(sr.cloned()); + flycheck.restart_workspace(saved_file.clone(), config); continue 'flychecks; } } @@ -399,7 +406,9 @@ fn run_flycheck(state: &mut GlobalState, vfs_path: VfsPath) -> bool { // No specific flycheck was triggered, so let's trigger all of them. if !updated { for flycheck in world.flycheck.iter() { - flycheck.restart_workspace(saved_file.clone()); + let sr = world.workspace_source_root_map.get(&flycheck.id()); + let config = world.config.flycheck(sr.cloned()); + flycheck.restart_workspace(saved_file.clone(), config); } } Ok(()) @@ -442,7 +451,9 @@ pub(crate) fn handle_run_flycheck( // No specific flycheck was triggered, so let's trigger all of them. if state.config.flycheck_workspace(None) { for flycheck in state.flycheck.iter() { - flycheck.restart_workspace(None); + let sr = state.workspace_source_root_map.get(&flycheck.id()); + let config = state.config.flycheck(sr.cloned()); + flycheck.restart_workspace(None, config); } } Ok(()) diff --git a/crates/rust-analyzer/src/main_loop.rs b/crates/rust-analyzer/src/main_loop.rs index d6dc8b521fd6..a4252b06525b 100644 --- a/crates/rust-analyzer/src/main_loop.rs +++ b/crates/rust-analyzer/src/main_loop.rs @@ -413,7 +413,11 @@ impl GlobalState { && !self.fetch_build_data_queue.op_requested() { // Project has loaded properly, kick off initial flycheck - self.flycheck.iter().for_each(|flycheck| flycheck.restart_workspace(None)); + self.flycheck.iter().for_each(|flycheck| { + let sr = self.workspace_source_root_map.get(&flycheck.id()); + let config = self.config.flycheck(sr.cloned()); + flycheck.restart_workspace(None, config) + }); } if self.config.prefill_caches() { self.prime_caches_queue.request_op("became quiescent".to_owned(), ()); diff --git a/crates/rust-analyzer/src/reload.rs b/crates/rust-analyzer/src/reload.rs index 0add2cdf5a71..29e790b104c8 100644 --- a/crates/rust-analyzer/src/reload.rs +++ b/crates/rust-analyzer/src/reload.rs @@ -32,7 +32,7 @@ use vfs::{AbsPath, AbsPathBuf, ChangeKind}; use crate::{ config::{Config, FilesWatcher, LinkedProject}, - flycheck::{FlycheckConfig, FlycheckHandle}, + flycheck::{command::FlycheckConfig, FlycheckHandle}, global_state::{ FetchBuildDataResponse, FetchWorkspaceRequest, FetchWorkspaceResponse, GlobalState, }, @@ -802,7 +802,7 @@ impl GlobalState { let sender = self.flycheck_sender.clone(); let invocation_strategy = match config { FlycheckConfig::CargoCommand { .. } => { - crate::flycheck::InvocationStrategy::PerWorkspace + crate::flycheck::command::InvocationStrategy::PerWorkspace } FlycheckConfig::CustomCommand { ref invocation_strategy, .. } => { invocation_strategy.clone() @@ -810,17 +810,10 @@ impl GlobalState { }; self.flycheck = match invocation_strategy { - crate::flycheck::InvocationStrategy::Once => { - vec![FlycheckHandle::spawn( - 0, - sender, - config, - None, - self.config.root_path().clone(), - None, - )] + crate::flycheck::command::InvocationStrategy::Once => { + vec![FlycheckHandle::spawn(0, sender, None, self.config.root_path().clone(), None)] } - crate::flycheck::InvocationStrategy::PerWorkspace => { + crate::flycheck::command::InvocationStrategy::PerWorkspace => { self.workspaces .iter() .enumerate() @@ -852,7 +845,6 @@ impl GlobalState { FlycheckHandle::spawn( id, sender.clone(), - config.clone(), sysroot_root, root.to_path_buf(), manifest_path.map(|it| it.to_path_buf()), diff --git a/crates/rust-analyzer/src/test_runner.rs b/crates/rust-analyzer/src/test_runner.rs index 503b3ee43a12..4eccc55ddffd 100644 --- a/crates/rust-analyzer/src/test_runner.rs +++ b/crates/rust-analyzer/src/test_runner.rs @@ -9,7 +9,7 @@ use toolchain::Tool; use crate::{ command::{CommandHandle, ParseFromLine}, - flycheck::CargoOptions, + flycheck::command::CargoOptions, }; #[derive(Debug, Deserialize)]