From 684b6fa1b8cd41b03ba485084690f78991820645 Mon Sep 17 00:00:00 2001 From: Clemens Wasser Date: Tue, 9 Jun 2020 21:47:54 +0200 Subject: flycheck now uses the configured features --- crates/ra_flycheck/src/lib.rs | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) (limited to 'crates/ra_flycheck/src') diff --git a/crates/ra_flycheck/src/lib.rs b/crates/ra_flycheck/src/lib.rs index 041e38a9f..6c4170529 100644 --- a/crates/ra_flycheck/src/lib.rs +++ b/crates/ra_flycheck/src/lib.rs @@ -18,8 +18,17 @@ pub use cargo_metadata::diagnostic::{ #[derive(Clone, Debug, PartialEq, Eq)] pub enum FlycheckConfig { - CargoCommand { command: String, all_targets: bool, all_features: bool, extra_args: Vec }, - CustomCommand { command: String, args: Vec }, + CargoCommand { + command: String, + all_targets: bool, + all_features: bool, + features: Vec, + extra_args: Vec, + }, + CustomCommand { + command: String, + args: Vec, + }, } /// Flycheck wraps the shared state and communication machinery used for @@ -188,7 +197,13 @@ impl FlycheckThread { self.check_process = None; let mut cmd = match &self.config { - FlycheckConfig::CargoCommand { command, all_targets, all_features, extra_args } => { + FlycheckConfig::CargoCommand { + command, + all_targets, + all_features, + extra_args, + features, + } => { let mut cmd = Command::new(ra_toolchain::cargo()); cmd.arg(command); cmd.args(&["--workspace", "--message-format=json", "--manifest-path"]) @@ -198,6 +213,9 @@ impl FlycheckThread { } if *all_features { cmd.arg("--all-features"); + } else if !features.is_empty() { + cmd.arg("--features"); + cmd.arg(features.join(" ")); } cmd.args(extra_args); cmd -- cgit v1.2.3