@@ -28,7 +28,7 @@ use std::path::Path;
28
28
29
29
use crate :: utils:: internal_lints:: is_lint_ref_type;
30
30
use clippy_utils:: {
31
- diagnostics:: span_lint, last_path_segment, match_def_path , match_function_call, match_path, paths, ty:: match_type,
31
+ diagnostics:: span_lint, last_path_segment, match_function_call, match_path, paths, ty:: match_type,
32
32
ty:: walk_ptrs_ty_depth,
33
33
} ;
34
34
@@ -41,8 +41,6 @@ const BLACK_LISTED_LINTS: [&str; 3] = ["lint_author", "deep_code_inspection", "i
41
41
const IGNORED_LINT_GROUPS : [ & str ; 1 ] = [ "clippy::all" ] ;
42
42
/// Lints within this group will be excluded from the collection
43
43
const EXCLUDED_LINT_GROUPS : [ & str ; 1 ] = [ "clippy::internal" ] ;
44
- /// Collected deprecated lint will be assigned to this group in the JSON output
45
- const DEPRECATED_LINT_GROUP_STR : & str = "DEPRECATED" ;
46
44
47
45
const LINT_EMISSION_FUNCTIONS : [ & [ & str ] ; 7 ] = [
48
46
& [ "clippy_utils" , "diagnostics" , "span_lint" ] ,
@@ -68,7 +66,6 @@ const SUGGESTION_FUNCTIONS: [&[&str]; 2] = [
68
66
& [ "clippy_utils" , "diagnostics" , "multispan_sugg" ] ,
69
67
& [ "clippy_utils" , "diagnostics" , "multispan_sugg_with_applicability" ] ,
70
68
] ;
71
- const DEPRECATED_LINT_TYPE : [ & str ; 3 ] = [ "clippy_lints" , "deprecated_lints" , "ClippyDeprecatedLint" ] ;
72
69
73
70
/// The index of the applicability name of `paths::APPLICABILITY_VALUES`
74
71
const APPLICABILITY_NAME_INDEX : usize = 2 ;
@@ -228,42 +225,23 @@ impl<'hir> LateLintPass<'hir> for MetadataCollector {
228
225
/// }
229
226
/// ```
230
227
fn check_item ( & mut self , cx : & LateContext < ' hir > , item : & ' hir Item < ' _ > ) {
231
- if let ItemKind :: Static ( ref ty, Mutability :: Not , _) = item. kind {
232
- // Normal lint
233
- if_chain ! {
234
- // item validation
235
- if is_lint_ref_type( cx, ty) ;
236
- // blacklist check
237
- let lint_name = sym_to_string( item. ident. name) . to_ascii_lowercase( ) ;
238
- if !BLACK_LISTED_LINTS . contains( & lint_name. as_str( ) ) ;
239
- // metadata extraction
240
- if let Some ( group) = get_lint_group_or_lint( cx, & lint_name, item) ;
241
- if let Some ( docs) = extract_attr_docs_or_lint( cx, item) ;
242
- then {
243
- self . lints. push( LintMetadata :: new(
244
- lint_name,
245
- SerializableSpan :: from_item( cx, item) ,
246
- group,
247
- docs,
248
- ) ) ;
249
- }
250
- }
251
-
252
- if_chain ! {
253
- if is_deprecated_lint( cx, ty) ;
254
- // blacklist check
255
- let lint_name = sym_to_string( item. ident. name) . to_ascii_lowercase( ) ;
256
- if !BLACK_LISTED_LINTS . contains( & lint_name. as_str( ) ) ;
257
- // Metadata the little we can get from a deprecated lint
258
- if let Some ( docs) = extract_attr_docs_or_lint( cx, item) ;
259
- then {
260
- self . lints. push( LintMetadata :: new(
261
- lint_name,
262
- SerializableSpan :: from_item( cx, item) ,
263
- DEPRECATED_LINT_GROUP_STR . to_string( ) ,
264
- docs,
265
- ) ) ;
266
- }
228
+ if_chain ! {
229
+ // item validation
230
+ if let ItemKind :: Static ( ref ty, Mutability :: Not , _) = item. kind;
231
+ if is_lint_ref_type( cx, ty) ;
232
+ // blacklist check
233
+ let lint_name = sym_to_string( item. ident. name) . to_ascii_lowercase( ) ;
234
+ if !BLACK_LISTED_LINTS . contains( & lint_name. as_str( ) ) ;
235
+ // metadata extraction
236
+ if let Some ( group) = get_lint_group_or_lint( cx, & lint_name, item) ;
237
+ if let Some ( docs) = extract_attr_docs_or_lint( cx, item) ;
238
+ then {
239
+ self . lints. push( LintMetadata :: new(
240
+ lint_name,
241
+ SerializableSpan :: from_item( cx, item) ,
242
+ group,
243
+ docs,
244
+ ) ) ;
267
245
}
268
246
}
269
247
}
@@ -290,7 +268,7 @@ impl<'hir> LateLintPass<'hir> for MetadataCollector {
290
268
// - src/misc.rs:734:9
291
269
// - src/methods/mod.rs:3545:13
292
270
// - src/methods/mod.rs:3496:13
293
- // We are basically unable to resolve the lint name itself .
271
+ // We are basically unable to resolve the lint name it self .
294
272
return ;
295
273
}
296
274
@@ -369,16 +347,6 @@ fn get_lint_group(cx: &LateContext<'_>, lint_id: LintId) -> Option<String> {
369
347
None
370
348
}
371
349
372
- fn is_deprecated_lint ( cx : & LateContext < ' _ > , ty : & hir:: Ty < ' _ > ) -> bool {
373
- if let hir:: TyKind :: Path ( ref path) = ty. kind {
374
- if let hir:: def:: Res :: Def ( DefKind :: Struct , def_id) = cx. qpath_res ( path, ty. hir_id ) {
375
- return match_def_path ( cx, def_id, & DEPRECATED_LINT_TYPE ) ;
376
- }
377
- }
378
-
379
- false
380
- }
381
-
382
350
// ==================================================================
383
351
// Lint emission
384
352
// ==================================================================
0 commit comments