Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir-expand/src/cfg_process.rs')
-rw-r--r--crates/hir-expand/src/cfg_process.rs24
1 files changed, 9 insertions, 15 deletions
diff --git a/crates/hir-expand/src/cfg_process.rs b/crates/hir-expand/src/cfg_process.rs
index 227a62ff9f..a0de36548e 100644
--- a/crates/hir-expand/src/cfg_process.rs
+++ b/crates/hir-expand/src/cfg_process.rs
@@ -162,25 +162,19 @@ fn macro_input_callback(
}
}
Meta::TokenTree { path, tt } => {
- if path.segments.len() != 1
+ if path.is1("cfg") {
+ let cfg_expr = CfgExpr::parse_from_ast(
+ &mut TokenTreeChildren::new(&tt).peekable(),
+ );
+ if cfg_options().check(&cfg_expr) == Some(false) {
+ return ControlFlow::Break(ItemIsCfgedOut);
+ }
+ strip_current_attr = true;
+ } else if path.segments.len() != 1
|| !is_item_tree_filtered_attr(path.segments[0].text())
{
strip_current_attr = should_strip_attr();
}
-
- if path.segments.len() == 1 {
- let name = path.segments[0].text();
-
- if name == "cfg" {
- let cfg_expr = CfgExpr::parse_from_ast(
- &mut TokenTreeChildren::new(&tt).peekable(),
- );
- if cfg_options().check(&cfg_expr) == Some(false) {
- return ControlFlow::Break(ItemIsCfgedOut);
- }
- strip_current_attr = true;
- }
- }
}
Meta::Path { path } => {
if path.segments.len() != 1