Merge #10401
10401: minor: Test runnables check for test prefix and suffix in attributes only r=Veykril a=Veykril Fixes https://github.com/rust-analyzer/rust-analyzer/issues/10393 bors r+ Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
This commit is contained in:
commit
26a10767cb
@ -74,7 +74,12 @@ pub fn extract_trivial_expression(block_expr: &ast::BlockExpr) -> Option<ast::Ex
|
|||||||
pub fn test_related_attribute(fn_def: &ast::Fn) -> Option<ast::Attr> {
|
pub fn test_related_attribute(fn_def: &ast::Fn) -> Option<ast::Attr> {
|
||||||
fn_def.attrs().find_map(|attr| {
|
fn_def.attrs().find_map(|attr| {
|
||||||
let path = attr.path()?;
|
let path = attr.path()?;
|
||||||
path.syntax().text().to_string().contains("test").then(|| attr)
|
let text = path.syntax().text().to_string();
|
||||||
|
if text.starts_with("test") || text.ends_with("test") {
|
||||||
|
Some(attr)
|
||||||
|
} else {
|
||||||
|
None
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user