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