diff options
| author | Cameron Steffen <cam.steffen94@gmail.com> | 2021-07-02 14:15:11 -0500 |
|---|---|---|
| committer | Cameron Steffen <cam.steffen94@gmail.com> | 2021-07-09 09:10:45 -0500 |
| commit | d6b0d0bf9746a441e5082415e7f929af2874b65a (patch) | |
| tree | 470c44be9a1471dc9090679dc2eee4c737861a76 /src/test | |
| parent | 2545459bff0aae43288e2e17bff0d332c49a6353 (diff) | |
| download | rust-d6b0d0bf9746a441e5082415e7f929af2874b65a.tar.gz rust-d6b0d0bf9746a441e5082415e7f929af2874b65a.zip | |
Fix default_hash_types to use resolved path
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/ui-fulldeps/internal-lints/default_hash_types.rs | 17 | ||||
| -rw-r--r-- | src/test/ui-fulldeps/internal-lints/default_hash_types.stderr | 30 | ||||
| -rw-r--r-- | src/test/ui/lint/issue-83477.rs | 3 | ||||
| -rw-r--r-- | src/test/ui/lint/issue-83477.stderr | 6 |
4 files changed, 31 insertions, 25 deletions
diff --git a/src/test/ui-fulldeps/internal-lints/default_hash_types.rs b/src/test/ui-fulldeps/internal-lints/default_hash_types.rs index 3786c6de7e7..795c7d2dcb7 100644 --- a/src/test/ui-fulldeps/internal-lints/default_hash_types.rs +++ b/src/test/ui-fulldeps/internal-lints/default_hash_types.rs @@ -1,22 +1,29 @@ // compile-flags: -Z unstable-options #![feature(rustc_private)] +#![deny(rustc::default_hash_types)] extern crate rustc_data_structures; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; use std::collections::{HashMap, HashSet}; -#[deny(rustc::default_hash_types)] +mod foo { + pub struct HashMap; +} + fn main() { let _map: HashMap<String, String> = HashMap::default(); - //~^ ERROR Prefer FxHashMap over HashMap, it has better performance - //~^^ ERROR Prefer FxHashMap over HashMap, it has better performance + //~^ ERROR prefer `FxHashMap` over `HashMap`, it has better performance + //~^^ ERROR prefer `FxHashMap` over `HashMap`, it has better performance let _set: HashSet<String> = HashSet::default(); - //~^ ERROR Prefer FxHashSet over HashSet, it has better performance - //~^^ ERROR Prefer FxHashSet over HashSet, it has better performance + //~^ ERROR prefer `FxHashSet` over `HashSet`, it has better performance + //~^^ ERROR prefer `FxHashSet` over `HashSet`, it has better performance // test that the lint doesn't also match the Fx variants themselves let _fx_map: FxHashMap<String, String> = FxHashMap::default(); let _fx_set: FxHashSet<String> = FxHashSet::default(); + + // test another struct of the same name + let _ = foo::HashMap; } diff --git a/src/test/ui-fulldeps/internal-lints/default_hash_types.stderr b/src/test/ui-fulldeps/internal-lints/default_hash_types.stderr index 4f78f51b676..9d13ee89bca 100644 --- a/src/test/ui-fulldeps/internal-lints/default_hash_types.stderr +++ b/src/test/ui-fulldeps/internal-lints/default_hash_types.stderr @@ -1,37 +1,37 @@ -error: Prefer FxHashMap over HashMap, it has better performance - --> $DIR/default_hash_types.rs:12:15 +error: prefer `FxHashMap` over `HashMap`, it has better performance + --> $DIR/default_hash_types.rs:16:41 | LL | let _map: HashMap<String, String> = HashMap::default(); - | ^^^^^^^ help: use: `FxHashMap` + | ^^^^^^^ | note: the lint level is defined here - --> $DIR/default_hash_types.rs:10:8 + --> $DIR/default_hash_types.rs:4:9 | -LL | #[deny(rustc::default_hash_types)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #![deny(rustc::default_hash_types)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^ = note: a `use rustc_data_structures::fx::FxHashMap` may be necessary -error: Prefer FxHashMap over HashMap, it has better performance - --> $DIR/default_hash_types.rs:12:41 +error: prefer `FxHashMap` over `HashMap`, it has better performance + --> $DIR/default_hash_types.rs:16:15 | LL | let _map: HashMap<String, String> = HashMap::default(); - | ^^^^^^^ help: use: `FxHashMap` + | ^^^^^^^^^^^^^^^^^^^^^^^ | = note: a `use rustc_data_structures::fx::FxHashMap` may be necessary -error: Prefer FxHashSet over HashSet, it has better performance - --> $DIR/default_hash_types.rs:15:15 +error: prefer `FxHashSet` over `HashSet`, it has better performance + --> $DIR/default_hash_types.rs:19:33 | LL | let _set: HashSet<String> = HashSet::default(); - | ^^^^^^^ help: use: `FxHashSet` + | ^^^^^^^ | = note: a `use rustc_data_structures::fx::FxHashSet` may be necessary -error: Prefer FxHashSet over HashSet, it has better performance - --> $DIR/default_hash_types.rs:15:33 +error: prefer `FxHashSet` over `HashSet`, it has better performance + --> $DIR/default_hash_types.rs:19:15 | LL | let _set: HashSet<String> = HashSet::default(); - | ^^^^^^^ help: use: `FxHashSet` + | ^^^^^^^^^^^^^^^ | = note: a `use rustc_data_structures::fx::FxHashSet` may be necessary diff --git a/src/test/ui/lint/issue-83477.rs b/src/test/ui/lint/issue-83477.rs index ab62f0c8b8c..4262a28799d 100644 --- a/src/test/ui/lint/issue-83477.rs +++ b/src/test/ui/lint/issue-83477.rs @@ -12,6 +12,5 @@ //~| SUGGESTION rustc::default_hash_types fn main() { let _ = std::collections::HashMap::<String, String>::new(); - //~^ WARN Prefer FxHashMap over HashMap, it has better performance - //~| HELP use + //~^ WARN prefer `FxHashMap` over `HashMap`, it has better performance } diff --git a/src/test/ui/lint/issue-83477.stderr b/src/test/ui/lint/issue-83477.stderr index 028890f3623..e619bcfe23f 100644 --- a/src/test/ui/lint/issue-83477.stderr +++ b/src/test/ui/lint/issue-83477.stderr @@ -12,11 +12,11 @@ warning: unknown lint: `rustc::foo::default_hash_types` LL | #[allow(rustc::foo::default_hash_types)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: did you mean: `rustc::default_hash_types` -warning: Prefer FxHashMap over HashMap, it has better performance - --> $DIR/issue-83477.rs:14:31 +warning: prefer `FxHashMap` over `HashMap`, it has better performance + --> $DIR/issue-83477.rs:14:13 | LL | let _ = std::collections::HashMap::<String, String>::new(); - | ^^^^^^^ help: use: `FxHashMap` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: the lint level is defined here --> $DIR/issue-83477.rs:3:9 |
