Skip to content

Commit 144281c

Browse files
committed
Formatting
1 parent a4e1a90 commit 144281c

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

clippy_lints/src/utils/internal_lints.rs

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ declare_clippy_lint! {
2525
"various things that will negatively affect your clippy experience"
2626
}
2727

28-
2928
/// **What it does:** Ensures every lint is associated to a `LintPass`.
3029
///
3130
/// **Why is this bad?** The compiler only knows lints via a `LintPass`. Without
@@ -55,7 +54,6 @@ declare_clippy_lint! {
5554
"declaring a lint without associating it in a LintPass"
5655
}
5756

58-
5957
/// **What it does:** Checks for the presence of the default hash types "HashMap" or "HashSet"
6058
/// and recommends the FxHash* variants.
6159
///
@@ -144,7 +142,6 @@ pub struct LintWithoutLintPass {
144142
registered_lints: FxHashSet<Name>,
145143
}
146144

147-
148145
impl LintPass for LintWithoutLintPass {
149146
fn get_lints(&self) -> LintArray {
150147
lint_array!(LINT_WITHOUT_LINT_PASS)
@@ -196,7 +193,6 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for LintWithoutLintPass {
196193
}
197194
}
198195

199-
200196
fn is_lint_ref_type(ty: &Ty) -> bool {
201197
if let TyKind::Rptr(
202198
_,
@@ -213,7 +209,6 @@ fn is_lint_ref_type(ty: &Ty) -> bool {
213209
false
214210
}
215211

216-
217212
fn is_lint_array_type(ty: &Ty) -> bool {
218213
if let TyKind::Path(ref path) = ty.node {
219214
match_qpath(path, &paths::LINT_ARRAY)
@@ -249,8 +244,8 @@ pub struct DefaultHashTypes {
249244
impl DefaultHashTypes {
250245
pub fn default() -> Self {
251246
let mut map = FxHashMap::default();
252-
map.insert("HashMap".to_owned(), "FxHashMap".to_owned());
253-
map.insert("HashSet".to_owned(), "FxHashSet".to_owned());
247+
map.insert("HashMap".to_string(), "FxHashMap".to_string());
248+
map.insert("HashSet".to_string(), "FxHashSet".to_string());
254249
Self { map }
255250
}
256251
}
@@ -265,8 +260,17 @@ impl EarlyLintPass for DefaultHashTypes {
265260
fn check_ident(&mut self, cx: &EarlyContext<'_>, ident: Ident) {
266261
let ident_string = ident.to_string();
267262
if let Some(replace) = self.map.get(&ident_string) {
268-
let msg = format!("Prefer {} over {}, it has better performance and we don't need any collision prevention in clippy", replace, ident_string);
269-
span_lint_and_sugg(cx, DEFAULT_HASH_TYPES, ident.span, &msg, "use", replace.to_owned());
263+
let msg = format!("Prefer {} over {}, it has better performance \
264+
and we don't need any collision prevention in clippy",
265+
replace, ident_string);
266+
span_lint_and_sugg(
267+
cx,
268+
DEFAULT_HASH_TYPES,
269+
ident.span,
270+
&msg,
271+
"use",
272+
replace.to_string(),
273+
);
270274
}
271275
}
272276
}

0 commit comments

Comments
 (0)