diff --git a/compiler/rustc_lint/src/context/diagnostics.rs b/compiler/rustc_lint/src/context/diagnostics.rs index 14e4c79563bb3..728996f07417c 100644 --- a/compiler/rustc_lint/src/context/diagnostics.rs +++ b/compiler/rustc_lint/src/context/diagnostics.rs @@ -104,7 +104,7 @@ pub(super) fn builtin(sess: &Session, diagnostic: BuiltinLintDiagnostics, diag: if let Some(span) = in_test_module { diag.span_help( sess.source_map().guess_head_span(span), - "consider adding a `#[cfg(test)]` to the containing module", + "if this is a test module, consider adding a `#[cfg(test)]` to the containing module", ); } } diff --git a/tests/ui/imports/unused-imports-in-test-module.stderr b/tests/ui/imports/unused-imports-in-test-module.stderr index 1598368eb32cc..2d885efc099b3 100644 --- a/tests/ui/imports/unused-imports-in-test-module.stderr +++ b/tests/ui/imports/unused-imports-in-test-module.stderr @@ -16,7 +16,7 @@ error: unused import: `super::a` LL | use super::a; | ^^^^^^^^ | -help: consider adding a `#[cfg(test)]` to the containing module +help: if this is a test module, consider adding a `#[cfg(test)]` to the containing module --> $DIR/unused-imports-in-test-module.rs:8:1 | LL | mod test { @@ -28,7 +28,7 @@ error: unused import: `super::a` LL | use super::a; | ^^^^^^^^ | -help: consider adding a `#[cfg(test)]` to the containing module +help: if this is a test module, consider adding a `#[cfg(test)]` to the containing module --> $DIR/unused-imports-in-test-module.rs:18:1 | LL | mod tests { @@ -40,7 +40,7 @@ error: unused import: `super::a` LL | use super::a; | ^^^^^^^^ | -help: consider adding a `#[cfg(test)]` to the containing module +help: if this is a test module, consider adding a `#[cfg(test)]` to the containing module --> $DIR/unused-imports-in-test-module.rs:28:1 | LL | mod test_a { @@ -52,7 +52,7 @@ error: unused import: `super::a` LL | use super::a; | ^^^^^^^^ | -help: consider adding a `#[cfg(test)]` to the containing module +help: if this is a test module, consider adding a `#[cfg(test)]` to the containing module --> $DIR/unused-imports-in-test-module.rs:38:1 | LL | mod a_test { @@ -64,7 +64,7 @@ error: unused import: `super::a` LL | use super::a; | ^^^^^^^^ | -help: consider adding a `#[cfg(test)]` to the containing module +help: if this is a test module, consider adding a `#[cfg(test)]` to the containing module --> $DIR/unused-imports-in-test-module.rs:48:1 | LL | mod tests_a { @@ -76,7 +76,7 @@ error: unused import: `super::a` LL | use super::a; | ^^^^^^^^ | -help: consider adding a `#[cfg(test)]` to the containing module +help: if this is a test module, consider adding a `#[cfg(test)]` to the containing module --> $DIR/unused-imports-in-test-module.rs:58:1 | LL | mod a_tests {