Skip to content

Commit 26a1076

Browse files
bors[bot]Veykril
andauthored
Merge #10401
10401: minor: Test runnables check for test prefix and suffix in attributes only r=Veykril a=Veykril Fixes #10393 bors r+ Co-authored-by: Lukas Wirth <[email protected]>
2 parents 7a36993 + b742dd3 commit 26a1076

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

crates/ide_assists/src/utils.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,12 @@ pub fn extract_trivial_expression(block_expr: &ast::BlockExpr) -> Option<ast::Ex
7474
pub fn test_related_attribute(fn_def: &ast::Fn) -> Option<ast::Attr> {
7575
fn_def.attrs().find_map(|attr| {
7676
let path = attr.path()?;
77-
path.syntax().text().to_string().contains("test").then(|| attr)
77+
let text = path.syntax().text().to_string();
78+
if text.starts_with("test") || text.ends_with("test") {
79+
Some(attr)
80+
} else {
81+
None
82+
}
7883
})
7984
}
8085

0 commit comments

Comments
 (0)