@@ -25,7 +25,6 @@ declare_clippy_lint! {
25
25
"various things that will negatively affect your clippy experience"
26
26
}
27
27
28
-
29
28
/// **What it does:** Ensures every lint is associated to a `LintPass`.
30
29
///
31
30
/// **Why is this bad?** The compiler only knows lints via a `LintPass`. Without
@@ -55,7 +54,6 @@ declare_clippy_lint! {
55
54
"declaring a lint without associating it in a LintPass"
56
55
}
57
56
58
-
59
57
/// **What it does:** Checks for the presence of the default hash types "HashMap" or "HashSet"
60
58
/// and recommends the FxHash* variants.
61
59
///
@@ -144,7 +142,6 @@ pub struct LintWithoutLintPass {
144
142
registered_lints : FxHashSet < Name > ,
145
143
}
146
144
147
-
148
145
impl LintPass for LintWithoutLintPass {
149
146
fn get_lints ( & self ) -> LintArray {
150
147
lint_array ! ( LINT_WITHOUT_LINT_PASS )
@@ -196,7 +193,6 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for LintWithoutLintPass {
196
193
}
197
194
}
198
195
199
-
200
196
fn is_lint_ref_type ( ty : & Ty ) -> bool {
201
197
if let TyKind :: Rptr (
202
198
_,
@@ -213,7 +209,6 @@ fn is_lint_ref_type(ty: &Ty) -> bool {
213
209
false
214
210
}
215
211
216
-
217
212
fn is_lint_array_type ( ty : & Ty ) -> bool {
218
213
if let TyKind :: Path ( ref path) = ty. node {
219
214
match_qpath ( path, & paths:: LINT_ARRAY )
@@ -249,8 +244,8 @@ pub struct DefaultHashTypes {
249
244
impl DefaultHashTypes {
250
245
pub fn default ( ) -> Self {
251
246
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 ( ) ) ;
254
249
Self { map }
255
250
}
256
251
}
@@ -265,8 +260,17 @@ impl EarlyLintPass for DefaultHashTypes {
265
260
fn check_ident ( & mut self , cx : & EarlyContext < ' _ > , ident : Ident ) {
266
261
let ident_string = ident. to_string ( ) ;
267
262
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
+ ) ;
270
274
}
271
275
}
272
276
}
0 commit comments