Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir-ty/src/target_feature.rs')
| -rw-r--r-- | crates/hir-ty/src/target_feature.rs | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/crates/hir-ty/src/target_feature.rs b/crates/hir-ty/src/target_feature.rs index fe9416c6cf..9d1238701b 100644 --- a/crates/hir-ty/src/target_feature.rs +++ b/crates/hir-ty/src/target_feature.rs @@ -4,7 +4,7 @@ use std::sync::LazyLock; use hir_def::attr::Attrs; use hir_def::tt; -use intern::{sym, Symbol}; +use intern::{Symbol, sym}; use rustc_hash::{FxHashMap, FxHashSet}; #[derive(Debug, Default)] @@ -36,17 +36,19 @@ impl TargetFeatures { /// Retrieves the target features from the attributes, and does not expand the target features implied by them. pub(crate) fn from_attrs_no_implications(attrs: &Attrs) -> Self { let enabled = attrs - .by_key(&sym::target_feature) + .by_key(sym::target_feature) .tt_values() - .filter_map(|tt| { - match tt.token_trees().flat_tokens() { - [ - tt::TokenTree::Leaf(tt::Leaf::Ident(enable_ident)), - tt::TokenTree::Leaf(tt::Leaf::Punct(tt::Punct { char: '=', .. })), - tt::TokenTree::Leaf(tt::Leaf::Literal(tt::Literal { kind: tt::LitKind::Str, symbol: features, .. })), - ] if enable_ident.sym == sym::enable => Some(features), - _ => None, - } + .filter_map(|tt| match tt.token_trees().flat_tokens() { + [ + tt::TokenTree::Leaf(tt::Leaf::Ident(enable_ident)), + tt::TokenTree::Leaf(tt::Leaf::Punct(tt::Punct { char: '=', .. })), + tt::TokenTree::Leaf(tt::Leaf::Literal(tt::Literal { + kind: tt::LitKind::Str, + symbol: features, + .. + })), + ] if enable_ident.sym == sym::enable => Some(features), + _ => None, }) .flat_map(|features| features.as_str().split(',').map(Symbol::intern)) .collect(); |