forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of rust-lang#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 rust-lang#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 rust-lang#96149 and rust-lang#96156. Fixes rust-lang#73576
- Loading branch information
Showing
34 changed files
with
400 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,6 @@ version = "0.0.0" | |
edition = "2021" | ||
|
||
[lib] | ||
test = false | ||
doctest = false | ||
|
||
[dependencies] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
use super::ordinalize; | ||
|
||
#[test] | ||
fn test_ordinalize() { | ||
assert_eq!(ordinalize(1), "1st"); | ||
assert_eq!(ordinalize(2), "2nd"); | ||
assert_eq!(ordinalize(3), "3rd"); | ||
assert_eq!(ordinalize(4), "4th"); | ||
assert_eq!(ordinalize(5), "5th"); | ||
// ... | ||
assert_eq!(ordinalize(10), "10th"); | ||
assert_eq!(ordinalize(11), "11th"); | ||
assert_eq!(ordinalize(12), "12th"); | ||
assert_eq!(ordinalize(13), "13th"); | ||
assert_eq!(ordinalize(14), "14th"); | ||
// ... | ||
assert_eq!(ordinalize(20), "20th"); | ||
assert_eq!(ordinalize(21), "21st"); | ||
assert_eq!(ordinalize(22), "22nd"); | ||
assert_eq!(ordinalize(23), "23rd"); | ||
assert_eq!(ordinalize(24), "24th"); | ||
// ... | ||
assert_eq!(ordinalize(30), "30th"); | ||
assert_eq!(ordinalize(31), "31st"); | ||
assert_eq!(ordinalize(32), "32nd"); | ||
assert_eq!(ordinalize(33), "33rd"); | ||
assert_eq!(ordinalize(34), "34th"); | ||
// ... | ||
assert_eq!(ordinalize(7010), "7010th"); | ||
assert_eq!(ordinalize(7011), "7011th"); | ||
assert_eq!(ordinalize(7012), "7012th"); | ||
assert_eq!(ordinalize(7013), "7013th"); | ||
assert_eq!(ordinalize(7014), "7014th"); | ||
// ... | ||
assert_eq!(ordinalize(7020), "7020th"); | ||
assert_eq!(ordinalize(7021), "7021st"); | ||
assert_eq!(ordinalize(7022), "7022nd"); | ||
assert_eq!(ordinalize(7023), "7023rd"); | ||
assert_eq!(ordinalize(7024), "7024th"); | ||
} |
Oops, something went wrong.