Skip to content

Commit ae491f3

Browse files
tests_outside_test_module: put code in backticks in the lint message (#17387)
changelog: none
2 parents e5251c9 + 4ad3b14 commit ae491f3

3 files changed

Lines changed: 6 additions & 6 deletions

File tree

clippy_lints/src/tests_outside_test_module.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,9 @@ impl LateLintPass<'_> for TestsOutsideTestModule {
6666
cx,
6767
TESTS_OUTSIDE_TEST_MODULE,
6868
sp,
69-
"this function marked with #[test] is outside a #[cfg(test)] module",
69+
"this function marked with `#[test]` is outside a `#[cfg(test)]` module",
7070
|diag| {
71-
diag.note("move it to a testing module marked with #[cfg(test)]");
71+
diag.note("move it to a testing module marked with `#[cfg(test)]`");
7272
},
7373
);
7474
}

tests/ui/tests_outside_test_module.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ fn main() {
88
// Should lint
99
#[test]
1010
fn my_test() {}
11-
//~^ ERROR: this function marked with #[test] is outside a #[cfg(test)] module
12-
//~| NOTE: move it to a testing module marked with #[cfg(test)]
11+
//~^ ERROR: this function marked with `#[test]` is outside a `#[cfg(test)]` module
12+
//~| NOTE: move it to a testing module marked with `#[cfg(test)]`
1313

1414
#[cfg(test)]
1515
mod tests {

tests/ui/tests_outside_test_module.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
error: this function marked with #[test] is outside a #[cfg(test)] module
1+
error: this function marked with `#[test]` is outside a `#[cfg(test)]` module
22
--> tests/ui/tests_outside_test_module.rs:10:1
33
|
44
LL | fn my_test() {}
55
| ^^^^^^^^^^^^^^^
66
|
7-
= note: move it to a testing module marked with #[cfg(test)]
7+
= note: move it to a testing module marked with `#[cfg(test)]`
88
= note: `-D clippy::tests-outside-test-module` implied by `-D warnings`
99
= help: to override `-D warnings` add `#[allow(clippy::tests_outside_test_module)]`
1010

0 commit comments

Comments
 (0)