Skip to content

Commit 8a1d133

Browse files
committed
Auto merge of #96150 - est31:unused_macro_rules, r=petrochenkov
Implement a lint to warn about unused macro rules This implements a new lint to warn about unused macro rules (arms/matchers), similar to the `unused_macros` lint added by #41907 that warns about entire macros. ```rust macro_rules! unused_empty { (hello) => { println!("Hello, world!") }; () => { println!("empty") }; //~ ERROR: 1st rule of macro `unused_empty` is never used } fn main() { unused_empty!(hello); } ``` Builds upon #96149 and #96156. Fixes #73576
2 parents d7e7fc6 + 9cfe5e7 commit 8a1d133

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

alloc/src/macros.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ macro_rules! vec {
5656
// `slice::into_vec` function which is only available with cfg(test)
5757
// NB see the slice::hack module in slice.rs for more information
5858
#[cfg(all(not(no_global_oom_handling), test))]
59+
#[cfg_attr(not(bootstrap), allow(unused_macro_rules))]
5960
macro_rules! vec {
6061
() => (
6162
$crate::vec::Vec::new()

stdarch

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Subproject commit d215afe9d1cf79c5edb0dfd3cdf4c50aca1f1760
1+
Subproject commit 28335054b1f417175ab5005cf1d9cf7937737930

0 commit comments

Comments
 (0)