@@ -66,8 +66,8 @@ extern crate declare_clippy_lint;
66
66
#[ cfg_attr( feature = "internal" , allow( clippy:: missing_clippy_version_attribute) ) ]
67
67
mod utils;
68
68
69
- mod declared_lints;
70
- mod deprecated_lints;
69
+ pub mod declared_lints;
70
+ pub mod deprecated_lints;
71
71
72
72
// begin lints modules, do not remove this comment, it’s used in `update_lints`
73
73
mod absolute_paths;
@@ -440,7 +440,7 @@ impl RegistrationGroups {
440
440
}
441
441
}
442
442
443
- #[ derive( Copy , Clone ) ]
443
+ #[ derive( Copy , Clone , Debug ) ]
444
444
pub ( crate ) enum LintCategory {
445
445
Cargo ,
446
446
Complexity ,
@@ -479,11 +479,39 @@ impl LintCategory {
479
479
}
480
480
}
481
481
482
- pub ( crate ) struct LintInfo {
482
+ pub struct LintInfo {
483
483
/// Double reference to maintain pointer equality
484
- lint : & ' static & ' static Lint ,
484
+ pub lint : & ' static & ' static Lint ,
485
485
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
+ }
487
515
}
488
516
489
517
pub fn explain ( name : & str ) -> i32 {
@@ -538,14 +566,6 @@ pub fn register_lints(store: &mut rustc_lint::LintStore, conf: &'static Conf) {
538
566
store. register_removed ( name, reason) ;
539
567
}
540
568
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
-
549
569
let format_args_storage = FormatArgsStorage :: default ( ) ;
550
570
let format_args = format_args_storage. clone ( ) ;
551
571
store. register_early_pass ( move || {
0 commit comments