File tree Expand file tree Collapse file tree 2 files changed +31
-0
lines changed Expand file tree Collapse file tree 2 files changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -303,6 +303,7 @@ fn register_builtins(store: &mut LintStore, no_interleave_lints: bool) {
303
303
PATH_STATEMENTS ,
304
304
UNUSED_ATTRIBUTES ,
305
305
UNUSED_MACROS ,
306
+ UNUSED_MACRO_RULES ,
306
307
UNUSED_ALLOCATION ,
307
308
UNUSED_DOC_COMMENTS ,
308
309
UNUSED_EXTERN_CRATES ,
Original file line number Diff line number Diff line change @@ -775,6 +775,35 @@ declare_lint! {
775
775
"detects macros that were not used"
776
776
}
777
777
778
+ declare_lint ! {
779
+ /// The `unused_macro_rules` lint detects macro rules that were not used.
780
+ ///
781
+ /// ### Example
782
+ ///
783
+ /// ```rust
784
+ /// macro_rules! unused_empty {
785
+ /// (hello) => { println!("Hello, world!") };
786
+ /// () => { println!("empty") };
787
+ /// }
788
+ ///
789
+ /// fn main() {
790
+ /// unused_empty!(hello);
791
+ /// }
792
+ /// ```
793
+ ///
794
+ /// {{produces}}
795
+ ///
796
+ /// ### Explanation
797
+ ///
798
+ /// Unused macro rules may signal a mistake or unfinished code. Furthermore,
799
+ /// they slow down compilation. Right now, silencing the warning is not
800
+ /// supported on a single rule level, so you have to add an allow to the
801
+ /// entire macro definition.
802
+ pub UNUSED_MACRO_RULES ,
803
+ Warn ,
804
+ "detects macro rules that were not used"
805
+ }
806
+
778
807
declare_lint ! {
779
808
/// The `warnings` lint allows you to change the level of other
780
809
/// lints which produce warnings.
@@ -3138,6 +3167,7 @@ declare_lint_pass! {
3138
3167
OVERLAPPING_RANGE_ENDPOINTS ,
3139
3168
BINDINGS_WITH_VARIANT_NAME ,
3140
3169
UNUSED_MACROS ,
3170
+ UNUSED_MACRO_RULES ,
3141
3171
WARNINGS ,
3142
3172
UNUSED_FEATURES ,
3143
3173
STABLE_FEATURES ,
You can’t perform that action at this time.
0 commit comments