@@ -236,9 +236,7 @@ fn find_related_tests(
236236 . filter_map ( |token| token. ancestors ( ) . find_map ( ast:: Fn :: cast) )
237237 . map ( |f| hir:: InFile :: new ( sema. hir_file_for ( f. syntax ( ) ) , f) ) ;
238238
239- for fn_def in functions {
240- // #[test/bench] expands to just the item causing us to lose the attribute, so recover them by going out of the attribute
241- let InFile { value : fn_def, .. } = & fn_def. node_with_attributes ( sema. db ) ;
239+ for InFile { value : ref fn_def, .. } in functions {
242240 if let Some ( runnable) = as_test_runnable ( sema, fn_def) {
243241 // direct test
244242 tests. insert ( runnable) ;
@@ -294,8 +292,7 @@ fn parent_test_module(sema: &Semantics<RootDatabase>, fn_def: &ast::Fn) -> Optio
294292}
295293
296294pub ( crate ) fn runnable_fn ( sema : & Semantics < RootDatabase > , def : hir:: Function ) -> Option < Runnable > {
297- // #[test/bench] expands to just the item causing us to lose the attribute, so recover them by going out of the attribute
298- let func = def. source ( sema. db ) ?. node_with_attributes ( sema. db ) ;
295+ let func = def. source ( sema. db ) ?;
299296 let name_string = def. name ( sema. db ) . to_string ( ) ;
300297
301298 let root = def. module ( sema. db ) . krate ( ) . root_module ( sema. db ) ;
@@ -504,8 +501,6 @@ fn has_test_function_or_multiple_test_submodules(
504501 match item {
505502 hir:: ModuleDef :: Function ( f) => {
506503 if let Some ( it) = f. source ( sema. db ) {
507- // #[test/bench] expands to just the item causing us to lose the attribute, so recover them by going out of the attribute
508- let it = it. node_with_attributes ( sema. db ) ;
509504 if test_related_attribute ( & it. value ) . is_some ( ) {
510505 return true ;
511506 }
0 commit comments