suggest: remove redundant $()?
around vis
fragments
This commit is contained in:
parent
95ad6dfeab
commit
f97da855b1
3 changed files with 110 additions and 6 deletions
28
tests/ui/macros/remove-repetition-issue-139480.rs
Normal file
28
tests/ui/macros/remove-repetition-issue-139480.rs
Normal file
|
@ -0,0 +1,28 @@
|
|||
macro_rules! ciallo {
|
||||
($($v: vis)? $name: ident) => {
|
||||
//~^ error: repetition matches empty token tree
|
||||
};
|
||||
}
|
||||
|
||||
macro_rules! meow {
|
||||
($name: ident $($v: vis)?) => {
|
||||
//~^ error: repetition matches empty token tree
|
||||
};
|
||||
}
|
||||
|
||||
macro_rules! gbc {
|
||||
($name: ident $/*
|
||||
this comment gets removed by the suggestion
|
||||
*/
|
||||
($v: vis)?) => {
|
||||
//~^ error: repetition matches empty token tree
|
||||
};
|
||||
}
|
||||
|
||||
ciallo!(hello);
|
||||
|
||||
meow!(miaow, pub);
|
||||
|
||||
gbc!(mygo,);
|
||||
|
||||
fn main() {}
|
44
tests/ui/macros/remove-repetition-issue-139480.stderr
Normal file
44
tests/ui/macros/remove-repetition-issue-139480.stderr
Normal file
|
@ -0,0 +1,44 @@
|
|||
error: repetition matches empty token tree
|
||||
--> $DIR/remove-repetition-issue-139480.rs:2:7
|
||||
|
|
||||
LL | ($($v: vis)? $name: ident) => {
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: a `vis` fragment can already be empty
|
||||
help: remove the `$(` and `)?`
|
||||
|
|
||||
LL - ($($v: vis)? $name: ident) => {
|
||||
LL + ($v: vis $name: ident) => {
|
||||
|
|
||||
|
||||
error: repetition matches empty token tree
|
||||
--> $DIR/remove-repetition-issue-139480.rs:8:20
|
||||
|
|
||||
LL | ($name: ident $($v: vis)?) => {
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: a `vis` fragment can already be empty
|
||||
help: remove the `$(` and `)?`
|
||||
|
|
||||
LL - ($name: ident $($v: vis)?) => {
|
||||
LL + ($name: ident $v: vis) => {
|
||||
|
|
||||
|
||||
error: repetition matches empty token tree
|
||||
--> $DIR/remove-repetition-issue-139480.rs:17:9
|
||||
|
|
||||
LL | ($v: vis)?) => {
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: a `vis` fragment can already be empty
|
||||
help: remove the `$(` and `)?`
|
||||
|
|
||||
LL - ($name: ident $/*
|
||||
LL - this comment gets removed by the suggestion
|
||||
LL - */
|
||||
LL - ($v: vis)?) => {
|
||||
LL + ($name: ident $v: vis) => {
|
||||
|
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue