mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-11-25 21:37:39 +00:00
Auto merge of #15157 - HKalbasi:tokio-test, r=HKalbasi
Fix runnable detection for `#[tokio::test]` fix #15141 It is hacky, and it wouldn't work for e.g. this case: ```Rust use ::core::prelude; #[prelude::v1::test] fn foo() { } ``` But it works for the tokio case. We should use the name resolution here somehow, and after that we should probably also get rid of the ast based `test_related_attribute` function.
This commit is contained in:
commit
ad434fc4ac
2 changed files with 38 additions and 7 deletions
|
|
@ -273,7 +273,14 @@ impl Attrs {
|
|||
}
|
||||
|
||||
pub fn is_test(&self) -> bool {
|
||||
self.by_key("test").exists()
|
||||
self.iter().any(|x| {
|
||||
x.path()
|
||||
.segments()
|
||||
.iter()
|
||||
.rev()
|
||||
.zip(["core", "prelude", "v1", "test"].iter().rev())
|
||||
.all(|x| x.0.as_str() == Some(x.1))
|
||||
})
|
||||
}
|
||||
|
||||
pub fn is_ignore(&self) -> bool {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue