@@ -66,8 +66,8 @@ extern crate declare_clippy_lint;
6666#[ cfg_attr( feature = "internal" , allow( clippy:: missing_clippy_version_attribute) ) ]
6767mod utils;
6868
69- mod declared_lints;
70- mod deprecated_lints;
69+ pub mod declared_lints;
70+ pub mod deprecated_lints;
7171
7272// begin lints modules, do not remove this comment, it’s used in `update_lints`
7373mod absolute_paths;
@@ -440,7 +440,7 @@ impl RegistrationGroups {
440440 }
441441}
442442
443- #[ derive( Copy , Clone ) ]
443+ #[ derive( Copy , Clone , Debug ) ]
444444pub ( crate ) enum LintCategory {
445445 Cargo ,
446446 Complexity ,
@@ -479,11 +479,39 @@ impl LintCategory {
479479 }
480480}
481481
482- pub ( crate ) struct LintInfo {
482+ pub struct LintInfo {
483483 /// Double reference to maintain pointer equality
484- lint : & ' static & ' static Lint ,
484+ pub lint : & ' static & ' static Lint ,
485485 category : LintCategory ,
486- explanation : & ' static str ,
486+ pub explanation : & ' static str ,
487+ /// e.g. `clippy_lints/src/absolute_paths.rs#43`
488+ pub location : & ' static str ,
489+ pub version : Option < & ' static str > ,
490+ }
491+
492+ impl LintInfo {
493+ /// Returns the lint name in lowercase without the `clippy::` prefix
494+ #[ allow( clippy:: missing_panics_doc) ]
495+ pub fn name_lower ( & self ) -> String {
496+ self . lint . name . strip_prefix ( "clippy::" ) . unwrap ( ) . to_ascii_lowercase ( )
497+ }
498+
499+ /// Returns the name of the lint's category in lowercase (`style`, `pedantic`)
500+ pub fn category_str ( & self ) -> & ' static str {
501+ match self . category {
502+ Cargo => "cargo" ,
503+ Complexity => "complexity" ,
504+ Correctness => "correctness" ,
505+ Nursery => "nursery" ,
506+ Pedantic => "pedantic" ,
507+ Perf => "perf" ,
508+ Restriction => "restriction" ,
509+ Style => "style" ,
510+ Suspicious => "suspicious" ,
511+ #[ cfg( feature = "internal" ) ]
512+ Internal => "internal" ,
513+ }
514+ }
487515}
488516
489517pub fn explain ( name : & str ) -> i32 {
@@ -538,14 +566,6 @@ pub fn register_lints(store: &mut rustc_lint::LintStore, conf: &'static Conf) {
538566 store. register_removed ( name, reason) ;
539567 }
540568
541- #[ cfg( feature = "internal" ) ]
542- {
543- if std:: env:: var ( "ENABLE_METADATA_COLLECTION" ) . eq ( & Ok ( "1" . to_string ( ) ) ) {
544- store. register_late_pass ( |_| Box :: new ( utils:: internal_lints:: metadata_collector:: MetadataCollector :: new ( ) ) ) ;
545- return ;
546- }
547- }
548-
549569 let format_args_storage = FormatArgsStorage :: default ( ) ;
550570 let format_args = format_args_storage. clone ( ) ;
551571 store. register_early_pass ( move || {
0 commit comments