Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 4f754f4

Browse files
committed
fix: remove always! check for file_id in runnables
1 parent 2d895a7 commit 4f754f4

File tree

1 file changed

+3
-16
lines changed

1 file changed

+3
-16
lines changed

src/tools/rust-analyzer/crates/ide/src/runnables.rs

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use ide_db::{
1616
};
1717
use itertools::Itertools;
1818
use span::{Edition, TextSize};
19-
use stdx::{always, format_to};
19+
use stdx::format_to;
2020
use syntax::{
2121
ast::{self, AstNode},
2222
SmolStr, SyntaxNode, ToSmolStr,
@@ -130,14 +130,7 @@ pub(crate) fn runnables(db: &RootDatabase, file_id: FileId) -> Vec<Runnable> {
130130
// In case an expansion creates multiple runnables we want to name them to avoid emitting a bunch of equally named runnables.
131131
let mut in_macro_expansion = FxHashMap::<hir::HirFileId, Vec<Runnable>>::default();
132132
let mut add_opt = |runnable: Option<Runnable>, def| {
133-
if let Some(runnable) = runnable.filter(|runnable| {
134-
always!(
135-
runnable.nav.file_id == file_id,
136-
"tried adding a runnable pointing to a different file: {:?} for {:?}",
137-
runnable.kind,
138-
file_id
139-
)
140-
}) {
133+
if let Some(runnable) = runnable.filter(|runnable| runnable.nav.file_id == file_id) {
141134
if let Some(def) = def {
142135
let file_id = match def {
143136
Definition::Module(it) => {
@@ -161,13 +154,7 @@ pub(crate) fn runnables(db: &RootDatabase, file_id: FileId) -> Vec<Runnable> {
161154
Definition::SelfType(impl_) => runnable_impl(&sema, &impl_),
162155
_ => None,
163156
};
164-
add_opt(
165-
runnable
166-
.or_else(|| module_def_doctest(sema.db, def))
167-
// #[macro_export] mbe macros are declared in the root, while their definition may reside in a different module
168-
.filter(|it| it.nav.file_id == file_id),
169-
Some(def),
170-
);
157+
add_opt(runnable.or_else(|| module_def_doctest(sema.db, def)), Some(def));
171158
if let Definition::SelfType(impl_) = def {
172159
impl_.items(db).into_iter().for_each(|assoc| {
173160
let runnable = match assoc {

0 commit comments

Comments
 (0)