1
1
use crate :: msrvs:: Msrv ;
2
2
use crate :: types:: { DisallowedPath , MacroMatcher , MatchLintBehaviour , PubUnderscoreFieldsBehaviour , Rename } ;
3
3
use crate :: ClippyConfiguration ;
4
- use rustc_data_structures:: fx:: FxHashSet ;
5
4
use rustc_errors:: Applicability ;
6
5
use rustc_session:: Session ;
7
6
use rustc_span:: edit_distance:: edit_distance;
@@ -218,7 +217,7 @@ macro_rules! define_Conf {
218
217
define_Conf ! {
219
218
/// Which crates to allow absolute paths from
220
219
#[ lints( absolute_paths) ]
221
- absolute_paths_allowed_crates: FxHashSet <String > = FxHashSet :: default ( ) ,
220
+ absolute_paths_allowed_crates: Vec <String > = Vec :: new ( ) ,
222
221
/// The maximum number of segments a path can have before being linted, anything above this will
223
222
/// be linted.
224
223
#[ lints( absolute_paths) ]
@@ -280,12 +279,12 @@ define_Conf! {
280
279
allowed_dotfiles: Vec <String > = Vec :: default ( ) ,
281
280
/// A list of crate names to allow duplicates of
282
281
#[ lints( multiple_crate_versions) ]
283
- allowed_duplicate_crates: FxHashSet <String > = FxHashSet :: default ( ) ,
282
+ allowed_duplicate_crates: Vec <String > = Vec :: new ( ) ,
284
283
/// Allowed names below the minimum allowed characters. The value `".."` can be used as part of
285
284
/// the list to indicate, that the configured values should be appended to the default
286
285
/// configuration of Clippy. By default, any configuration will replace the default value.
287
286
#[ lints( min_ident_chars) ]
288
- allowed_idents_below_min_chars: FxHashSet <String > =
287
+ allowed_idents_below_min_chars: Vec <String > =
289
288
DEFAULT_ALLOWED_IDENTS_BELOW_MIN_CHARS . iter( ) . map( ToString :: to_string) . collect( ) ,
290
289
/// List of prefixes to allow when determining whether an item's name ends with the module's name.
291
290
/// If the rest of an item's name is an allowed prefix (e.g. item `ToFoo` or `to_foo` in module `foo`),
@@ -323,7 +322,7 @@ define_Conf! {
323
322
/// 2. Paths with any segment that containing the word 'prelude'
324
323
/// are already allowed by default.
325
324
#[ lints( wildcard_imports) ]
326
- allowed_wildcard_imports: FxHashSet <String > = FxHashSet :: default ( ) ,
325
+ allowed_wildcard_imports: Vec <String > = Vec :: new ( ) ,
327
326
/// Suppress checking of the passed type names in all types of operations.
328
327
///
329
328
/// If a specific operation is desired, consider using `arithmetic_side_effects_allowed_binary` or `arithmetic_side_effects_allowed_unary` instead.
@@ -355,7 +354,7 @@ define_Conf! {
355
354
/// arithmetic-side-effects-allowed-binary = [["SomeType" , "f32"], ["AnotherType", "*"]]
356
355
/// ```
357
356
#[ lints( arithmetic_side_effects) ]
358
- arithmetic_side_effects_allowed_binary: Vec <[ String ; 2 ] > = <_>:: default ( ) ,
357
+ arithmetic_side_effects_allowed_binary: Vec <( String , String ) > = <_>:: default ( ) ,
359
358
/// Suppress checking of the passed type names in unary operations like "negation" (`-`).
360
359
///
361
360
/// #### Example
@@ -431,7 +430,7 @@ define_Conf! {
431
430
/// * `doc-valid-idents = ["ClipPy"]` would replace the default list with `["ClipPy"]`.
432
431
/// * `doc-valid-idents = ["ClipPy", ".."]` would append `ClipPy` to the default list.
433
432
#[ lints( doc_markdown) ]
434
- doc_valid_idents: FxHashSet <String > = DEFAULT_DOC_VALID_IDENTS . iter( ) . map( ToString :: to_string) . collect( ) ,
433
+ doc_valid_idents: Vec <String > = DEFAULT_DOC_VALID_IDENTS . iter( ) . map( ToString :: to_string) . collect( ) ,
435
434
/// Whether to apply the raw pointer heuristic to determine if a type is `Send`.
436
435
#[ lints( non_send_fields_in_send_ty) ]
437
436
enable_raw_pointer_heuristic_for_send: bool = true ,
@@ -706,12 +705,12 @@ fn deserialize(file: &SourceFile) -> TryConf {
706
705
DEFAULT_ALLOWED_TRAITS_WITH_RENAMED_PARAMS ,
707
706
) ;
708
707
// TODO: THIS SHOULD BE TESTED, this comment will be gone soon
709
- if conf. conf . allowed_idents_below_min_chars . contains ( ".." ) {
708
+ if conf. conf . allowed_idents_below_min_chars . iter ( ) . any ( |e| e == ".." ) {
710
709
conf. conf
711
710
. allowed_idents_below_min_chars
712
711
. extend ( DEFAULT_ALLOWED_IDENTS_BELOW_MIN_CHARS . iter ( ) . map ( ToString :: to_string) ) ;
713
712
}
714
- if conf. conf . doc_valid_idents . contains ( ".." ) {
713
+ if conf. conf . doc_valid_idents . iter ( ) . any ( |e| e == ".." ) {
715
714
conf. conf
716
715
. doc_valid_idents
717
716
. extend ( DEFAULT_DOC_VALID_IDENTS . iter ( ) . map ( ToString :: to_string) ) ;
@@ -890,14 +889,14 @@ fn calculate_dimensions(fields: &[&str]) -> (usize, Vec<usize>) {
890
889
891
890
#[ cfg( test) ]
892
891
mod tests {
893
- use rustc_data_structures:: fx:: { FxHashMap , FxHashSet } ;
894
892
use serde:: de:: IgnoredAny ;
893
+ use std:: collections:: { HashMap , HashSet } ;
895
894
use std:: fs;
896
895
use walkdir:: WalkDir ;
897
896
898
897
#[ test]
899
898
fn configs_are_tested ( ) {
900
- let mut names: FxHashSet < String > = crate :: get_configuration_metadata ( )
899
+ let mut names: HashSet < String > = crate :: get_configuration_metadata ( )
901
900
. into_iter ( )
902
901
. map ( |meta| meta. name . replace ( '_' , "-" ) )
903
902
. collect ( ) ;
@@ -910,7 +909,7 @@ mod tests {
910
909
for entry in toml_files {
911
910
let file = fs:: read_to_string ( entry. path ( ) ) . unwrap ( ) ;
912
911
#[ allow( clippy:: zero_sized_map_values) ]
913
- if let Ok ( map) = toml:: from_str :: < FxHashMap < String , IgnoredAny > > ( & file) {
912
+ if let Ok ( map) = toml:: from_str :: < HashMap < String , IgnoredAny > > ( & file) {
914
913
for name in map. keys ( ) {
915
914
names. remove ( name. as_str ( ) ) ;
916
915
}
0 commit comments