aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
authorBenjamin Coenen <[email protected]>2020-05-24 12:34:34 +0100
committerBenjamin Coenen <[email protected]>2020-05-24 12:34:34 +0100
commit27ed376bc4dfed39295af650effe63007e443b6f (patch)
tree08c92728901ef4033bb427467f5d1d8a4040d670 /crates
parent48d7c61e26398fa33b94e0e4bd0d2d1697ed4921 (diff)
add support of feature flag for runnables #4464
Signed-off-by: Benjamin Coenen <[email protected]>
Diffstat (limited to 'crates')
-rw-r--r--crates/ra_ide/src/runnables.rs2
-rw-r--r--crates/rust-analyzer/src/main_loop/handlers.rs14
2 files changed, 1 insertions, 15 deletions
diff --git a/crates/ra_ide/src/runnables.rs b/crates/ra_ide/src/runnables.rs
index a96c5f157..ed98e58e0 100644
--- a/crates/ra_ide/src/runnables.rs
+++ b/crates/ra_ide/src/runnables.rs
@@ -5,7 +5,7 @@ use itertools::Itertools;
5use ra_ide_db::RootDatabase; 5use ra_ide_db::RootDatabase;
6use ra_syntax::{ 6use ra_syntax::{
7 ast::{self, AstNode, AttrsOwner, ModuleItemOwner, NameOwner}, 7 ast::{self, AstNode, AttrsOwner, ModuleItemOwner, NameOwner},
8 match_ast, SmolStr, SyntaxNode, TextRange, 8 match_ast, SyntaxNode, TextRange,
9}; 9};
10 10
11use crate::FileId; 11use crate::FileId;
diff --git a/crates/rust-analyzer/src/main_loop/handlers.rs b/crates/rust-analyzer/src/main_loop/handlers.rs
index 5f6e845a8..c51e4346a 100644
--- a/crates/rust-analyzer/src/main_loop/handlers.rs
+++ b/crates/rust-analyzer/src/main_loop/handlers.rs
@@ -39,7 +39,6 @@ use crate::{
39 world::WorldSnapshot, 39 world::WorldSnapshot,
40 LspError, Result, 40 LspError, Result,
41}; 41};
42use hir::Attrs;
43 42
44pub fn handle_analyzer_status(world: WorldSnapshot, _: ()) -> Result<String> { 43pub fn handle_analyzer_status(world: WorldSnapshot, _: ()) -> Result<String> {
45 let _p = profile("handle_analyzer_status"); 44 let _p = profile("handle_analyzer_status");
@@ -1039,19 +1038,6 @@ fn to_lsp_runnable(
1039 }) 1038 })
1040} 1039}
1041 1040
1042fn get_features_needed(attrs: Attrs) -> Option<Vec<SmolStr>> {
1043 let cfg_expr = attrs.by_key("cfg").tt_values().map(|subtree| ra_cfg::parse_cfg(subtree));
1044 let features_needed = cfg_expr
1045 .map(|cfg| {
1046 let mut min_features = vec![];
1047 collect_minimal_features_needed(&cfg, &mut min_features);
1048 min_features
1049 })
1050 .flatten()
1051 .collect();
1052 Some(features_needed).filter(|it: &Vec<SmolStr>| !it.is_empty())
1053}
1054
1055/// Fill minimal features needed 1041/// Fill minimal features needed
1056fn collect_minimal_features_needed(cfg_expr: &CfgExpr, features: &mut Vec<SmolStr>) { 1042fn collect_minimal_features_needed(cfg_expr: &CfgExpr, features: &mut Vec<SmolStr>) {
1057 match cfg_expr { 1043 match cfg_expr {