aboutsummaryrefslogtreecommitdiff
path: root/crates/flycheck/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/flycheck/src/lib.rs')
-rw-r--r--crates/flycheck/src/lib.rs23
1 files changed, 19 insertions, 4 deletions
diff --git a/crates/flycheck/src/lib.rs b/crates/flycheck/src/lib.rs
index 1023d3040..7c38f5ef9 100644
--- a/crates/flycheck/src/lib.rs
+++ b/crates/flycheck/src/lib.rs
@@ -14,14 +14,17 @@ use std::{
14use crossbeam_channel::{never, select, unbounded, Receiver, Sender}; 14use crossbeam_channel::{never, select, unbounded, Receiver, Sender};
15 15
16pub use cargo_metadata::diagnostic::{ 16pub use cargo_metadata::diagnostic::{
17 Applicability, Diagnostic, DiagnosticLevel, DiagnosticSpan, DiagnosticSpanMacroExpansion, 17 Applicability, Diagnostic, DiagnosticCode, DiagnosticLevel, DiagnosticSpan,
18 DiagnosticSpanMacroExpansion,
18}; 19};
19 20
20#[derive(Clone, Debug, PartialEq, Eq)] 21#[derive(Clone, Debug, PartialEq, Eq)]
21pub enum FlycheckConfig { 22pub enum FlycheckConfig {
22 CargoCommand { 23 CargoCommand {
23 command: String, 24 command: String,
25 target_triple: Option<String>,
24 all_targets: bool, 26 all_targets: bool,
27 no_default_features: bool,
25 all_features: bool, 28 all_features: bool,
26 features: Vec<String>, 29 features: Vec<String>,
27 extra_args: Vec<String>, 30 extra_args: Vec<String>,
@@ -132,6 +135,7 @@ impl FlycheckActor {
132 self.cancel_check_process(); 135 self.cancel_check_process();
133 136
134 let mut command = self.check_command(); 137 let mut command = self.check_command();
138 log::info!("restart flycheck {:?}", command);
135 command.stdout(Stdio::piped()).stderr(Stdio::null()).stdin(Stdio::null()); 139 command.stdout(Stdio::piped()).stderr(Stdio::null()).stdin(Stdio::null());
136 if let Ok(child) = command.spawn().map(JodChild) { 140 if let Ok(child) = command.spawn().map(JodChild) {
137 self.cargo_handle = Some(CargoHandle::spawn(child)); 141 self.cargo_handle = Some(CargoHandle::spawn(child));
@@ -176,6 +180,8 @@ impl FlycheckActor {
176 let mut cmd = match &self.config { 180 let mut cmd = match &self.config {
177 FlycheckConfig::CargoCommand { 181 FlycheckConfig::CargoCommand {
178 command, 182 command,
183 target_triple,
184 no_default_features,
179 all_targets, 185 all_targets,
180 all_features, 186 all_features,
181 extra_args, 187 extra_args,
@@ -185,14 +191,23 @@ impl FlycheckActor {
185 cmd.arg(command); 191 cmd.arg(command);
186 cmd.args(&["--workspace", "--message-format=json", "--manifest-path"]) 192 cmd.args(&["--workspace", "--message-format=json", "--manifest-path"])
187 .arg(self.workspace_root.join("Cargo.toml")); 193 .arg(self.workspace_root.join("Cargo.toml"));
194
195 if let Some(target) = target_triple {
196 cmd.args(&["--target", target.as_str()]);
197 }
188 if *all_targets { 198 if *all_targets {
189 cmd.arg("--all-targets"); 199 cmd.arg("--all-targets");
190 } 200 }
191 if *all_features { 201 if *all_features {
192 cmd.arg("--all-features"); 202 cmd.arg("--all-features");
193 } else if !features.is_empty() { 203 } else {
194 cmd.arg("--features"); 204 if *no_default_features {
195 cmd.arg(features.join(" ")); 205 cmd.arg("--no-default-features");
206 }
207 if !features.is_empty() {
208 cmd.arg("--features");
209 cmd.arg(features.join(" "));
210 }
196 } 211 }
197 cmd.args(extra_args); 212 cmd.args(extra_args);
198 cmd 213 cmd