mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-23 12:23:22 +00:00
Test runnables check for test prefix and suffix in attributes only
This commit is contained in:
parent
533ca584c3
commit
b742dd313e
@ -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> {
|
||||
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
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user