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) {
303303 PATH_STATEMENTS ,
304304 UNUSED_ATTRIBUTES ,
305305 UNUSED_MACROS ,
306+ UNUSED_MACRO_RULES ,
306307 UNUSED_ALLOCATION ,
307308 UNUSED_DOC_COMMENTS ,
308309 UNUSED_EXTERN_CRATES ,
Original file line number Diff line number Diff line change @@ -775,6 +775,35 @@ declare_lint! {
775775 "detects macros that were not used"
776776}
777777
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+
778807declare_lint ! {
779808 /// The `warnings` lint allows you to change the level of other
780809 /// lints which produce warnings.
@@ -3138,6 +3167,7 @@ declare_lint_pass! {
31383167 OVERLAPPING_RANGE_ENDPOINTS ,
31393168 BINDINGS_WITH_VARIANT_NAME ,
31403169 UNUSED_MACROS ,
3170+ UNUSED_MACRO_RULES ,
31413171 WARNINGS ,
31423172 UNUSED_FEATURES ,
31433173 STABLE_FEATURES ,
You can’t perform that action at this time.
0 commit comments