make unused_imports less assertive in test modules

closes #121502
This commit is contained in:
Suyashtnt 2024-02-25 09:37:57 +02:00
parent e9f9594913
commit 748c6151be
No known key found for this signature in database
2 changed files with 7 additions and 7 deletions

View File

@ -108,7 +108,7 @@ pub(super) fn builtin(
if let Some(span) = in_test_module { if let Some(span) = in_test_module {
db.span_help( db.span_help(
sess.source_map().guess_head_span(span), 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",
); );
} }
} }

View File

@ -16,7 +16,7 @@ error: unused import: `super::a`
LL | use 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 --> $DIR/unused-imports-in-test-module.rs:8:1
| |
LL | mod test { LL | mod test {
@ -28,7 +28,7 @@ error: unused import: `super::a`
LL | use 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 --> $DIR/unused-imports-in-test-module.rs:18:1
| |
LL | mod tests { LL | mod tests {
@ -40,7 +40,7 @@ error: unused import: `super::a`
LL | use 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 --> $DIR/unused-imports-in-test-module.rs:28:1
| |
LL | mod test_a { LL | mod test_a {
@ -52,7 +52,7 @@ error: unused import: `super::a`
LL | use 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 --> $DIR/unused-imports-in-test-module.rs:38:1
| |
LL | mod a_test { LL | mod a_test {
@ -64,7 +64,7 @@ error: unused import: `super::a`
LL | use 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 --> $DIR/unused-imports-in-test-module.rs:48:1
| |
LL | mod tests_a { LL | mod tests_a {
@ -76,7 +76,7 @@ error: unused import: `super::a`
LL | use 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 --> $DIR/unused-imports-in-test-module.rs:58:1
| |
LL | mod a_tests { LL | mod a_tests {