Handle rustc_middle cases of rustc::potential_query_instability lint

This commit is contained in:
ismailarilik 2025-05-05 16:36:04 +03:00
parent 39c98c7301
commit 59aaecbbf9
7 changed files with 31 additions and 31 deletions

View file

@ -150,7 +150,7 @@ impl LateLintPass<'_> for WildcardImports {
(span, false)
};
let mut imports = used_imports.items().map(ToString::to_string).into_sorted_stable_ord();
let mut imports: Vec<_> = used_imports.iter().map(ToString::to_string).collect();
let imports_string = if imports.len() == 1 {
imports.pop().unwrap()
} else if braced_glob {

View file

@ -16,7 +16,7 @@ use crate::fn_mod::foo;
//~^ wildcard_imports
use crate::mod_mod::inner_mod;
//~^ wildcard_imports
use crate::multi_fn_mod::{multi_bar, multi_foo, multi_inner_mod};
use crate::multi_fn_mod::{multi_foo, multi_bar, multi_inner_mod};
//~^ wildcard_imports
#[macro_use]
use crate::struct_mod::{A, inner_struct_mod};
@ -26,7 +26,7 @@ use crate::struct_mod::{A, inner_struct_mod};
use wildcard_imports_helper::inner::inner_for_self_import;
use wildcard_imports_helper::inner::inner_for_self_import::inner_extern_bar;
//~^ wildcard_imports
use wildcard_imports_helper::{ExternA, extern_foo};
use wildcard_imports_helper::{extern_foo, ExternA};
//~^ wildcard_imports
use std::io::prelude::*;
@ -138,7 +138,7 @@ mod in_fn_test {
fn test_extern() {
use wildcard_imports_helper::inner::inner_for_self_import::{self, inner_extern_foo};
//~^ wildcard_imports
use wildcard_imports_helper::{ExternA, extern_foo};
use wildcard_imports_helper::{extern_foo, ExternA};
//~^ wildcard_imports
inner_for_self_import::inner_extern_foo();
@ -160,7 +160,7 @@ mod in_fn_test {
}
fn test_extern_reexported() {
use wildcard_imports_helper::{ExternExportedEnum, ExternExportedStruct, extern_exported};
use wildcard_imports_helper::{extern_exported, ExternExportedStruct, ExternExportedEnum};
//~^ wildcard_imports
extern_exported();
@ -190,7 +190,7 @@ mod in_fn_test {
}
fn test_reexported() {
use crate::in_fn_test::{ExportedEnum, ExportedStruct, exported};
use crate::in_fn_test::{exported, ExportedStruct, ExportedEnum};
//~^ wildcard_imports
exported();

View file

@ -17,7 +17,7 @@ error: usage of wildcard import
--> tests/ui/wildcard_imports.rs:19:5
|
LL | use crate::multi_fn_mod::*;
| ^^^^^^^^^^^^^^^^^^^^^^ help: try: `crate::multi_fn_mod::{multi_bar, multi_foo, multi_inner_mod}`
| ^^^^^^^^^^^^^^^^^^^^^^ help: try: `crate::multi_fn_mod::{multi_foo, multi_bar, multi_inner_mod}`
error: usage of wildcard import
--> tests/ui/wildcard_imports.rs:22:5
@ -35,7 +35,7 @@ error: usage of wildcard import
--> tests/ui/wildcard_imports.rs:29:5
|
LL | use wildcard_imports_helper::*;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `wildcard_imports_helper::{ExternA, extern_foo}`
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `wildcard_imports_helper::{extern_foo, ExternA}`
error: usage of wildcard import
--> tests/ui/wildcard_imports.rs:100:13
@ -59,7 +59,7 @@ error: usage of wildcard import
--> tests/ui/wildcard_imports.rs:141:13
|
LL | use wildcard_imports_helper::*;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `wildcard_imports_helper::{ExternA, extern_foo}`
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `wildcard_imports_helper::{extern_foo, ExternA}`
error: usage of wildcard import
--> tests/ui/wildcard_imports.rs:154:20
@ -77,13 +77,13 @@ error: usage of wildcard import
--> tests/ui/wildcard_imports.rs:163:13
|
LL | use wildcard_imports_helper::*;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `wildcard_imports_helper::{ExternExportedEnum, ExternExportedStruct, extern_exported}`
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `wildcard_imports_helper::{extern_exported, ExternExportedStruct, ExternExportedEnum}`
error: usage of wildcard import
--> tests/ui/wildcard_imports.rs:193:9
|
LL | use crate::in_fn_test::*;
| ^^^^^^^^^^^^^^^^^^^^ help: try: `crate::in_fn_test::{ExportedEnum, ExportedStruct, exported}`
| ^^^^^^^^^^^^^^^^^^^^ help: try: `crate::in_fn_test::{exported, ExportedStruct, ExportedEnum}`
error: usage of wildcard import
--> tests/ui/wildcard_imports.rs:203:9

View file

@ -14,7 +14,7 @@ use crate::fn_mod::foo;
//~^ wildcard_imports
use crate::mod_mod::inner_mod;
//~^ wildcard_imports
use crate::multi_fn_mod::{multi_bar, multi_foo, multi_inner_mod};
use crate::multi_fn_mod::{multi_foo, multi_bar, multi_inner_mod};
//~^ wildcard_imports
use crate::struct_mod::{A, inner_struct_mod};
//~^ wildcard_imports
@ -23,7 +23,7 @@ use crate::struct_mod::{A, inner_struct_mod};
use wildcard_imports_helper::inner::inner_for_self_import::inner_extern_bar;
//~^ wildcard_imports
use wildcard_imports_helper::prelude::v1::*;
use wildcard_imports_helper::{ExternA, extern_foo};
use wildcard_imports_helper::{extern_foo, ExternA};
//~^ wildcard_imports
use std::io::prelude::*;
@ -132,7 +132,7 @@ mod in_fn_test {
fn test_extern() {
use wildcard_imports_helper::inner::inner_for_self_import::{self, inner_extern_foo};
//~^ wildcard_imports
use wildcard_imports_helper::{ExternA, extern_foo};
use wildcard_imports_helper::{extern_foo, ExternA};
//~^ wildcard_imports
inner_for_self_import::inner_extern_foo();
@ -154,7 +154,7 @@ mod in_fn_test {
}
fn test_extern_reexported() {
use wildcard_imports_helper::{ExternExportedEnum, ExternExportedStruct, extern_exported};
use wildcard_imports_helper::{extern_exported, ExternExportedStruct, ExternExportedEnum};
//~^ wildcard_imports
extern_exported();
@ -184,7 +184,7 @@ mod in_fn_test {
}
fn test_reexported() {
use crate::in_fn_test::{ExportedEnum, ExportedStruct, exported};
use crate::in_fn_test::{exported, ExportedStruct, ExportedEnum};
//~^ wildcard_imports
exported();

View file

@ -17,7 +17,7 @@ error: usage of wildcard import
--> tests/ui/wildcard_imports_2021.rs:17:5
|
LL | use crate::multi_fn_mod::*;
| ^^^^^^^^^^^^^^^^^^^^^^ help: try: `crate::multi_fn_mod::{multi_bar, multi_foo, multi_inner_mod}`
| ^^^^^^^^^^^^^^^^^^^^^^ help: try: `crate::multi_fn_mod::{multi_foo, multi_bar, multi_inner_mod}`
error: usage of wildcard import
--> tests/ui/wildcard_imports_2021.rs:19:5
@ -35,7 +35,7 @@ error: usage of wildcard import
--> tests/ui/wildcard_imports_2021.rs:26:5
|
LL | use wildcard_imports_helper::*;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `wildcard_imports_helper::{ExternA, extern_foo}`
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `wildcard_imports_helper::{extern_foo, ExternA}`
error: usage of wildcard import
--> tests/ui/wildcard_imports_2021.rs:95:13
@ -59,7 +59,7 @@ error: usage of wildcard import
--> tests/ui/wildcard_imports_2021.rs:135:13
|
LL | use wildcard_imports_helper::*;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `wildcard_imports_helper::{ExternA, extern_foo}`
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `wildcard_imports_helper::{extern_foo, ExternA}`
error: usage of wildcard import
--> tests/ui/wildcard_imports_2021.rs:148:20
@ -77,13 +77,13 @@ error: usage of wildcard import
--> tests/ui/wildcard_imports_2021.rs:157:13
|
LL | use wildcard_imports_helper::*;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `wildcard_imports_helper::{ExternExportedEnum, ExternExportedStruct, extern_exported}`
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `wildcard_imports_helper::{extern_exported, ExternExportedStruct, ExternExportedEnum}`
error: usage of wildcard import
--> tests/ui/wildcard_imports_2021.rs:187:9
|
LL | use crate::in_fn_test::*;
| ^^^^^^^^^^^^^^^^^^^^ help: try: `crate::in_fn_test::{ExportedEnum, ExportedStruct, exported}`
| ^^^^^^^^^^^^^^^^^^^^ help: try: `crate::in_fn_test::{exported, ExportedStruct, ExportedEnum}`
error: usage of wildcard import
--> tests/ui/wildcard_imports_2021.rs:197:9

View file

@ -14,7 +14,7 @@ use crate::fn_mod::foo;
//~^ wildcard_imports
use crate::mod_mod::inner_mod;
//~^ wildcard_imports
use crate::multi_fn_mod::{multi_bar, multi_foo, multi_inner_mod};
use crate::multi_fn_mod::{multi_foo, multi_bar, multi_inner_mod};
//~^ wildcard_imports
use crate::struct_mod::{A, inner_struct_mod};
//~^ wildcard_imports
@ -23,7 +23,7 @@ use crate::struct_mod::{A, inner_struct_mod};
use wildcard_imports_helper::inner::inner_for_self_import::inner_extern_bar;
//~^ wildcard_imports
use wildcard_imports_helper::prelude::v1::*;
use wildcard_imports_helper::{ExternA, extern_foo};
use wildcard_imports_helper::{extern_foo, ExternA};
//~^ wildcard_imports
use std::io::prelude::*;
@ -132,7 +132,7 @@ mod in_fn_test {
fn test_extern() {
use wildcard_imports_helper::inner::inner_for_self_import::{self, inner_extern_foo};
//~^ wildcard_imports
use wildcard_imports_helper::{ExternA, extern_foo};
use wildcard_imports_helper::{extern_foo, ExternA};
//~^ wildcard_imports
inner_for_self_import::inner_extern_foo();
@ -154,7 +154,7 @@ mod in_fn_test {
}
fn test_extern_reexported() {
use wildcard_imports_helper::{ExternExportedEnum, ExternExportedStruct, extern_exported};
use wildcard_imports_helper::{extern_exported, ExternExportedStruct, ExternExportedEnum};
//~^ wildcard_imports
extern_exported();
@ -184,7 +184,7 @@ mod in_fn_test {
}
fn test_reexported() {
use crate::in_fn_test::{ExportedEnum, ExportedStruct, exported};
use crate::in_fn_test::{exported, ExportedStruct, ExportedEnum};
//~^ wildcard_imports
exported();

View file

@ -17,7 +17,7 @@ error: usage of wildcard import
--> tests/ui/wildcard_imports_2021.rs:17:5
|
LL | use crate::multi_fn_mod::*;
| ^^^^^^^^^^^^^^^^^^^^^^ help: try: `crate::multi_fn_mod::{multi_bar, multi_foo, multi_inner_mod}`
| ^^^^^^^^^^^^^^^^^^^^^^ help: try: `crate::multi_fn_mod::{multi_foo, multi_bar, multi_inner_mod}`
error: usage of wildcard import
--> tests/ui/wildcard_imports_2021.rs:19:5
@ -35,7 +35,7 @@ error: usage of wildcard import
--> tests/ui/wildcard_imports_2021.rs:26:5
|
LL | use wildcard_imports_helper::*;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `wildcard_imports_helper::{ExternA, extern_foo}`
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `wildcard_imports_helper::{extern_foo, ExternA}`
error: usage of wildcard import
--> tests/ui/wildcard_imports_2021.rs:95:13
@ -59,7 +59,7 @@ error: usage of wildcard import
--> tests/ui/wildcard_imports_2021.rs:135:13
|
LL | use wildcard_imports_helper::*;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `wildcard_imports_helper::{ExternA, extern_foo}`
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `wildcard_imports_helper::{extern_foo, ExternA}`
error: usage of wildcard import
--> tests/ui/wildcard_imports_2021.rs:148:20
@ -77,13 +77,13 @@ error: usage of wildcard import
--> tests/ui/wildcard_imports_2021.rs:157:13
|
LL | use wildcard_imports_helper::*;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `wildcard_imports_helper::{ExternExportedEnum, ExternExportedStruct, extern_exported}`
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `wildcard_imports_helper::{extern_exported, ExternExportedStruct, ExternExportedEnum}`
error: usage of wildcard import
--> tests/ui/wildcard_imports_2021.rs:187:9
|
LL | use crate::in_fn_test::*;
| ^^^^^^^^^^^^^^^^^^^^ help: try: `crate::in_fn_test::{ExportedEnum, ExportedStruct, exported}`
| ^^^^^^^^^^^^^^^^^^^^ help: try: `crate::in_fn_test::{exported, ExportedStruct, ExportedEnum}`
error: usage of wildcard import
--> tests/ui/wildcard_imports_2021.rs:197:9