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