mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-13 21:54:42 +00:00
add support of feature flag for runnables #4464
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
This commit is contained in:
parent
48d7c61e26
commit
27ed376bc4
2 changed files with 1 additions and 15 deletions
|
@ -5,7 +5,7 @@ use itertools::Itertools;
|
|||
use ra_ide_db::RootDatabase;
|
||||
use ra_syntax::{
|
||||
ast::{self, AstNode, AttrsOwner, ModuleItemOwner, NameOwner},
|
||||
match_ast, SmolStr, SyntaxNode, TextRange,
|
||||
match_ast, SyntaxNode, TextRange,
|
||||
};
|
||||
|
||||
use crate::FileId;
|
||||
|
|
|
@ -39,7 +39,6 @@ use crate::{
|
|||
world::WorldSnapshot,
|
||||
LspError, Result,
|
||||
};
|
||||
use hir::Attrs;
|
||||
|
||||
pub fn handle_analyzer_status(world: WorldSnapshot, _: ()) -> Result<String> {
|
||||
let _p = profile("handle_analyzer_status");
|
||||
|
@ -1039,19 +1038,6 @@ fn to_lsp_runnable(
|
|||
})
|
||||
}
|
||||
|
||||
fn get_features_needed(attrs: Attrs) -> Option<Vec<SmolStr>> {
|
||||
let cfg_expr = attrs.by_key("cfg").tt_values().map(|subtree| ra_cfg::parse_cfg(subtree));
|
||||
let features_needed = cfg_expr
|
||||
.map(|cfg| {
|
||||
let mut min_features = vec![];
|
||||
collect_minimal_features_needed(&cfg, &mut min_features);
|
||||
min_features
|
||||
})
|
||||
.flatten()
|
||||
.collect();
|
||||
Some(features_needed).filter(|it: &Vec<SmolStr>| !it.is_empty())
|
||||
}
|
||||
|
||||
/// Fill minimal features needed
|
||||
fn collect_minimal_features_needed(cfg_expr: &CfgExpr, features: &mut Vec<SmolStr>) {
|
||||
match cfg_expr {
|
||||
|
|
Loading…
Reference in a new issue