diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2024-03-01 17:51:29 +0100 | 
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-03-01 17:51:29 +0100 | 
| commit | 58825b4ea9354ab4e78ae96a1b0942d33c9db4ab (patch) | |
| tree | 202471ec72342f7724ad9b63345f49071d9d2e4d /compiler/rustc_lint/src/context/diagnostics.rs | |
| parent | dcde08f21c151989cb5fb10ad60c25f4dbe36212 (diff) | |
| parent | 748c6151be9906c8bc201fa79b8d1d49715968b2 (diff) | |
| download | rust-58825b4ea9354ab4e78ae96a1b0942d33c9db4ab.tar.gz rust-58825b4ea9354ab4e78ae96a1b0942d33c9db4ab.zip | |
Rollup merge of #121580 - Suyashtnt:issue-121502-fix, r=michaelwoerister
make unused_imports less assertive in test modules closes #121502 This is a fairly small change and I used the fix suggested in the example expected error message. Not sure if I should've rather used the alternatives but this one seems the most descriptive. Some alternatives: - if this is meant to be a test module, add `#[cfg(test)]` to the containing module - try adding #[cfg(test)] to this test module - consider adding #[allow(unused_imports)] if you want to silent the lint on the unused import - consider removing the unused import
Diffstat (limited to 'compiler/rustc_lint/src/context/diagnostics.rs')
| -rw-r--r-- | compiler/rustc_lint/src/context/diagnostics.rs | 2 | 
1 files changed, 1 insertions, 1 deletions
| diff --git a/compiler/rustc_lint/src/context/diagnostics.rs b/compiler/rustc_lint/src/context/diagnostics.rs index 14e4c79563b..728996f0741 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", ); } } | 
