diff --git a/crates/rust-analyzer/src/config.rs b/crates/rust-analyzer/src/config.rs index 617612dc3a..1253db8361 100644 --- a/crates/rust-analyzer/src/config.rs +++ b/crates/rust-analyzer/src/config.rs @@ -241,15 +241,8 @@ impl Config { set(value, "/checkOnSave/extraArgs", extra_args); set(value, "/checkOnSave/command", command); set(value, "/checkOnSave/allTargets", all_targets); - if let Some(new_all_features) = get(value, "/checkOnSave/allFeatures") { - *all_features = new_all_features; - } else { - *all_features = self.cargo.all_features; - } - set(value, "/checkOnSave/features", features); - if features.is_empty() && !self.cargo.features.is_empty() { - *features = self.cargo.features.clone(); - } + *all_features = get(value, "/checkOnSave/allFeatures").unwrap_or(self.cargo.all_features); + *features = get(value, "/checkOnSave/features").unwrap_or(self.cargo.features.clone()); } } }; diff --git a/editors/code/package.json b/editors/code/package.json index 647c83685b..e2027970db 100644 --- a/editors/code/package.json +++ b/editors/code/package.json @@ -326,11 +326,14 @@ "markdownDescription": "Check with all features (will be passed as `--all-features`). Defaults to `rust-analyzer.cargo.allFeatures`." }, "rust-analyzer.checkOnSave.features": { - "type": "array", + "type": [ + "null", + "array" + ], "items": { "type": "string" }, - "default": [], + "default": null, "description": "List of features to activate. Defaults to `rust-analyzer.cargo.features`." }, "rust-analyzer.inlayHints.enable": {