Split AttrArgs from MacArgs.#96209
Conversation
`MacArgs` is confusing. It has three variants. It's used in two different cases. - Attributes, where all three variants are used. - Function-like macro calls, where only one variant is used. This commit separates these two cases. `AttrArgs` keeps much of the functionality of the old `MacArgs`. The new `MacArgs` is a greatly streamlined version of the old `MacArgs`. There is a small amount of code duplication, but I think this change improves readability. It also lets a few unreachable code paths (e.g. `unwrap`/`expect` calls) be removed. The commit also renames `MacDelimeter` as `AttrMacDelimeter`, because it's used for both `AttrArgs` and `MacArgs`. For this type, it makes more sense to share a single type between the two cases because all variants and methods are used in both cases.
|
Some changes occurred in src/tools/clippy. cc @rust-lang/clippy Some changes occurred in src/tools/rustfmt. cc @rust-lang/rustfmt |
Those two are the same case, that's why I introduced |
|
In what way are they the same case? I found this naming confusing. I also don't like it when types allow invalid values, e.g. if a macro call involves a |
|
I reviewed the changes, and I'm still against doing this. First about the terminology - Second, I'd like to keep This only leaves |
|
☔ The latest upstream changes (presumably #96495) made this pull request unmergeable. Please resolve the merge conflicts. |
MacArgsis confusing. It has three variants. It's used in twodifferent cases.
This commit separates these two cases.
AttrArgskeeps much of thefunctionality of the old
MacArgs. The newMacArgsis a greatlystreamlined version of the old
MacArgs. There is a small amount ofcode duplication, but I think this change improves readability. It also
lets a few unreachable code paths (e.g.
unwrap/expectcalls) beremoved.
The commit also renames
MacDelimeterasAttrMacDelimeter, becauseit's used for both
AttrArgsandMacArgs. For this type, it makesmore sense to share a single type between the two cases because all
variants and methods are used in both cases.
r? @matthiaskrgr