Skip to content

Commit 5361b84

Browse files
committed
Remove clippy::default_hash_types internal lint
1 parent 0973f68 commit 5361b84

File tree

6 files changed

+3
-123
lines changed

6 files changed

+3
-123
lines changed

clippy_dev/src/lib.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#![allow(clippy::default_hash_types)]
2-
31
use itertools::Itertools;
42
use lazy_static::lazy_static;
53
use regex::Regex;

clippy_lints/src/lib.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,6 @@ pub fn register_plugins(reg: &mut rustc_plugin::Registry<'_>, conf: &Conf) {
423423
reg.register_late_lint_pass(box serde_api::Serde);
424424
reg.register_early_lint_pass(box utils::internal_lints::Clippy);
425425
reg.register_late_lint_pass(box utils::internal_lints::CompilerLintFunctions::new());
426-
reg.register_early_lint_pass(box utils::internal_lints::DefaultHashTypes::default());
427426
reg.register_late_lint_pass(box utils::internal_lints::LintWithoutLintPass::default());
428427
reg.register_late_lint_pass(box utils::inspector::Pass);
429428
reg.register_late_lint_pass(box utils::author::Pass);
@@ -647,7 +646,6 @@ pub fn register_plugins(reg: &mut rustc_plugin::Registry<'_>, conf: &Conf) {
647646
reg.register_lint_group("clippy::internal", Some("clippy_internal"), vec![
648647
utils::internal_lints::CLIPPY_LINTS_INTERNAL,
649648
utils::internal_lints::COMPILER_LINT_FUNCTIONS,
650-
utils::internal_lints::DEFAULT_HASH_TYPES,
651649
utils::internal_lints::LINT_WITHOUT_LINT_PASS,
652650
]);
653651

clippy_lints/src/types.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#![allow(clippy::default_hash_types)]
21

32
use std::borrow::Cow;
43
use std::cmp::Ordering;

clippy_lints/src/utils/internal_lints.rs

Lines changed: 3 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
use crate::utils::{
2-
match_def_path, match_type, paths, span_help_and_lint, span_lint, span_lint_and_sugg, walk_ptrs_ty,
3-
};
1+
use crate::utils::{match_def_path, match_type, paths, span_help_and_lint, span_lint, walk_ptrs_ty};
42
use if_chain::if_chain;
53
use rustc::hir;
64
use rustc::hir::def::Def;
@@ -9,8 +7,7 @@ use rustc::hir::*;
97
use rustc::lint::{EarlyContext, EarlyLintPass, LateContext, LateLintPass, LintArray, LintPass};
108
use rustc::{declare_tool_lint, lint_array};
119
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
12-
use rustc_errors::Applicability;
13-
use syntax::ast::{Crate as AstCrate, Ident, ItemKind, Name};
10+
use syntax::ast::{Crate as AstCrate, ItemKind, Name};
1411
use syntax::source_map::Span;
1512
use syntax::symbol::LocalInternedString;
1613

@@ -56,17 +53,6 @@ declare_clippy_lint! {
5653
"declaring a lint without associating it in a LintPass"
5754
}
5855

59-
declare_clippy_lint! {
60-
/// **What it does:** Checks for the presence of the default hash types "HashMap" or "HashSet"
61-
/// and recommends the FxHash* variants.
62-
///
63-
/// **Why is this bad?** The FxHash variants have better performance
64-
/// and we don't need any collision prevention in clippy.
65-
pub DEFAULT_HASH_TYPES,
66-
internal,
67-
"forbid HashMap and HashSet and suggest the FxHash* variants"
68-
}
69-
7056
declare_clippy_lint! {
7157
/// **What it does:** Checks for calls to `cx.span_lint*` and suggests to use the `utils::*`
7258
/// variant of the function.
@@ -238,51 +224,6 @@ impl<'a, 'tcx: 'a> Visitor<'tcx> for LintCollector<'a, 'tcx> {
238224
}
239225
}
240226

241-
pub struct DefaultHashTypes {
242-
map: FxHashMap<String, String>,
243-
}
244-
245-
impl DefaultHashTypes {
246-
pub fn default() -> Self {
247-
let mut map = FxHashMap::default();
248-
map.insert("HashMap".to_string(), "FxHashMap".to_string());
249-
map.insert("HashSet".to_string(), "FxHashSet".to_string());
250-
Self { map }
251-
}
252-
}
253-
254-
impl LintPass for DefaultHashTypes {
255-
fn get_lints(&self) -> LintArray {
256-
lint_array!(DEFAULT_HASH_TYPES)
257-
}
258-
259-
fn name(&self) -> &'static str {
260-
"DefaultHashType"
261-
}
262-
}
263-
264-
impl EarlyLintPass for DefaultHashTypes {
265-
fn check_ident(&mut self, cx: &EarlyContext<'_>, ident: Ident) {
266-
let ident_string = ident.to_string();
267-
if let Some(replace) = self.map.get(&ident_string) {
268-
let msg = format!(
269-
"Prefer {} over {}, it has better performance \
270-
and we don't need any collision prevention in clippy",
271-
replace, ident_string
272-
);
273-
span_lint_and_sugg(
274-
cx,
275-
DEFAULT_HASH_TYPES,
276-
ident.span,
277-
&msg,
278-
"use",
279-
replace.to_string(),
280-
Applicability::MaybeIncorrect, // FxHashMap, ... needs another import
281-
);
282-
}
283-
}
284-
}
285-
286227
#[derive(Clone, Default)]
287228
pub struct CompilerLintFunctions {
288229
map: FxHashMap<String, String>,
@@ -325,7 +266,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for CompilerLintFunctions {
325266
COMPILER_LINT_FUNCTIONS,
326267
path.ident.span,
327268
"usage of a compiler lint function",
328-
&format!("Please use the Clippy variant of this function: `{}`", sugg),
269+
&format!("please use the Clippy variant of this function: `{}`", sugg),
329270
);
330271
}
331272
}

tests/ui/fxhash.rs

Lines changed: 0 additions & 16 deletions
This file was deleted.

tests/ui/fxhash.stderr

Lines changed: 0 additions & 40 deletions
This file was deleted.

0 commit comments

Comments
 (0)