@@ -16,7 +16,7 @@ use ide_db::{
16
16
} ;
17
17
use itertools:: Itertools ;
18
18
use span:: { Edition , TextSize } ;
19
- use stdx:: { always , format_to} ;
19
+ use stdx:: format_to;
20
20
use syntax:: {
21
21
ast:: { self , AstNode } ,
22
22
SmolStr , SyntaxNode , ToSmolStr ,
@@ -130,14 +130,7 @@ pub(crate) fn runnables(db: &RootDatabase, file_id: FileId) -> Vec<Runnable> {
130
130
// In case an expansion creates multiple runnables we want to name them to avoid emitting a bunch of equally named runnables.
131
131
let mut in_macro_expansion = FxHashMap :: < hir:: HirFileId , Vec < Runnable > > :: default ( ) ;
132
132
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) {
141
134
if let Some ( def) = def {
142
135
let file_id = match def {
143
136
Definition :: Module ( it) => {
@@ -161,13 +154,7 @@ pub(crate) fn runnables(db: &RootDatabase, file_id: FileId) -> Vec<Runnable> {
161
154
Definition :: SelfType ( impl_) => runnable_impl ( & sema, & impl_) ,
162
155
_ => None ,
163
156
} ;
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) ) ;
171
158
if let Definition :: SelfType ( impl_) = def {
172
159
impl_. items ( db) . into_iter ( ) . for_each ( |assoc| {
173
160
let runnable = match assoc {
0 commit comments