11use crate :: msrvs:: Msrv ;
22use crate :: types:: { DisallowedPath , MacroMatcher , MatchLintBehaviour , PubUnderscoreFieldsBehaviour , Rename } ;
33use crate :: ClippyConfiguration ;
4- use rustc_data_structures:: fx:: FxHashSet ;
54use rustc_errors:: Applicability ;
65use rustc_session:: Session ;
76use rustc_span:: edit_distance:: edit_distance;
@@ -218,7 +217,7 @@ macro_rules! define_Conf {
218217define_Conf ! {
219218 /// Which crates to allow absolute paths from
220219 #[ lints( absolute_paths) ]
221- absolute_paths_allowed_crates: FxHashSet <String > = FxHashSet :: default ( ) ,
220+ absolute_paths_allowed_crates: Vec <String > = Vec :: new ( ) ,
222221 /// The maximum number of segments a path can have before being linted, anything above this will
223222 /// be linted.
224223 #[ lints( absolute_paths) ]
@@ -280,12 +279,12 @@ define_Conf! {
280279 allowed_dotfiles: Vec <String > = Vec :: default ( ) ,
281280 /// A list of crate names to allow duplicates of
282281 #[ lints( multiple_crate_versions) ]
283- allowed_duplicate_crates: FxHashSet <String > = FxHashSet :: default ( ) ,
282+ allowed_duplicate_crates: Vec <String > = Vec :: new ( ) ,
284283 /// Allowed names below the minimum allowed characters. The value `".."` can be used as part of
285284 /// the list to indicate, that the configured values should be appended to the default
286285 /// configuration of Clippy. By default, any configuration will replace the default value.
287286 #[ lints( min_ident_chars) ]
288- allowed_idents_below_min_chars: FxHashSet <String > =
287+ allowed_idents_below_min_chars: Vec <String > =
289288 DEFAULT_ALLOWED_IDENTS_BELOW_MIN_CHARS . iter( ) . map( ToString :: to_string) . collect( ) ,
290289 /// List of prefixes to allow when determining whether an item's name ends with the module's name.
291290 /// 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! {
323322 /// 2. Paths with any segment that containing the word 'prelude'
324323 /// are already allowed by default.
325324 #[ lints( wildcard_imports) ]
326- allowed_wildcard_imports: FxHashSet <String > = FxHashSet :: default ( ) ,
325+ allowed_wildcard_imports: Vec <String > = Vec :: new ( ) ,
327326 /// Suppress checking of the passed type names in all types of operations.
328327 ///
329328 /// 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! {
355354 /// arithmetic-side-effects-allowed-binary = [["SomeType" , "f32"], ["AnotherType", "*"]]
356355 /// ```
357356 #[ lints( arithmetic_side_effects) ]
358- arithmetic_side_effects_allowed_binary: Vec <[ String ; 2 ] > = <_>:: default ( ) ,
357+ arithmetic_side_effects_allowed_binary: Vec <( String , String ) > = <_>:: default ( ) ,
359358 /// Suppress checking of the passed type names in unary operations like "negation" (`-`).
360359 ///
361360 /// #### Example
@@ -431,7 +430,7 @@ define_Conf! {
431430 /// * `doc-valid-idents = ["ClipPy"]` would replace the default list with `["ClipPy"]`.
432431 /// * `doc-valid-idents = ["ClipPy", ".."]` would append `ClipPy` to the default list.
433432 #[ 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( ) ,
435434 /// Whether to apply the raw pointer heuristic to determine if a type is `Send`.
436435 #[ lints( non_send_fields_in_send_ty) ]
437436 enable_raw_pointer_heuristic_for_send: bool = true ,
@@ -706,12 +705,12 @@ fn deserialize(file: &SourceFile) -> TryConf {
706705 DEFAULT_ALLOWED_TRAITS_WITH_RENAMED_PARAMS ,
707706 ) ;
708707 // 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 == ".." ) {
710709 conf. conf
711710 . allowed_idents_below_min_chars
712711 . extend ( DEFAULT_ALLOWED_IDENTS_BELOW_MIN_CHARS . iter ( ) . map ( ToString :: to_string) ) ;
713712 }
714- if conf. conf . doc_valid_idents . contains ( ".." ) {
713+ if conf. conf . doc_valid_idents . iter ( ) . any ( |e| e == ".." ) {
715714 conf. conf
716715 . doc_valid_idents
717716 . extend ( DEFAULT_DOC_VALID_IDENTS . iter ( ) . map ( ToString :: to_string) ) ;
@@ -890,14 +889,14 @@ fn calculate_dimensions(fields: &[&str]) -> (usize, Vec<usize>) {
890889
891890#[ cfg( test) ]
892891mod tests {
893- use rustc_data_structures:: fx:: { FxHashMap , FxHashSet } ;
894892 use serde:: de:: IgnoredAny ;
893+ use std:: collections:: { HashMap , HashSet } ;
895894 use std:: fs;
896895 use walkdir:: WalkDir ;
897896
898897 #[ test]
899898 fn configs_are_tested ( ) {
900- let mut names: FxHashSet < String > = crate :: get_configuration_metadata ( )
899+ let mut names: HashSet < String > = crate :: get_configuration_metadata ( )
901900 . into_iter ( )
902901 . map ( |meta| meta. name . replace ( '_' , "-" ) )
903902 . collect ( ) ;
@@ -910,7 +909,7 @@ mod tests {
910909 for entry in toml_files {
911910 let file = fs:: read_to_string ( entry. path ( ) ) . unwrap ( ) ;
912911 #[ 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) {
914913 for name in map. keys ( ) {
915914 names. remove ( name. as_str ( ) ) ;
916915 }
0 commit comments