Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/ide-db/src/ra_fixture.rs')
-rw-r--r--crates/ide-db/src/ra_fixture.rs11
1 files changed, 8 insertions, 3 deletions
diff --git a/crates/ide-db/src/ra_fixture.rs b/crates/ide-db/src/ra_fixture.rs
index 2f4d319ec8..c8607a8099 100644
--- a/crates/ide-db/src/ra_fixture.rs
+++ b/crates/ide-db/src/ra_fixture.rs
@@ -3,6 +3,7 @@
use std::hash::{BuildHasher, Hash};
use hir::{CfgExpr, FilePositionWrapper, FileRangeWrapper, Semantics, Symbol};
+use itertools::Itertools;
use smallvec::SmallVec;
use span::{TextRange, TextSize};
use syntax::{
@@ -96,9 +97,13 @@ impl RaFixtureAnalysis {
let active_parameter = ActiveParameter::at_token(sema, expanded.syntax().clone())?;
let has_rust_fixture_attr = active_parameter.attrs().is_some_and(|attrs| {
attrs.filter_map(|attr| attr.as_simple_path()).any(|path| {
- path.segments()
- .zip(["rust_analyzer", "rust_fixture"])
- .all(|(seg, name)| seg.name_ref().map_or(false, |nr| nr.text() == name))
+ let Some([Some(segment1), Some(segment2)]) =
+ path.segments().map(|seg| seg.name_ref()).collect_array()
+ else {
+ return false;
+ };
+ segment1.text_non_mutable() == "rust_analyzer"
+ && segment2.text_non_mutable() == "rust_fixture"
})
});
if !has_rust_fixture_attr {