From b742dd313efb8101050238cd8eb9cdd30669cd15 Mon Sep 17 00:00:00 2001 From: Lukas Wirth Date: Thu, 30 Sep 2021 18:01:47 +0200 Subject: [PATCH] Test runnables check for test prefix and suffix in attributes only --- crates/ide_assists/src/utils.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/crates/ide_assists/src/utils.rs b/crates/ide_assists/src/utils.rs index 9bc70bc3fe7..af76cca24f4 100644 --- a/crates/ide_assists/src/utils.rs +++ b/crates/ide_assists/src/utils.rs @@ -74,7 +74,12 @@ pub fn extract_trivial_expression(block_expr: &ast::BlockExpr) -> Option Option { fn_def.attrs().find_map(|attr| { 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 + } }) }