Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add matches! checking to nonstandard_macro_braces #9471

Merged
merged 1 commit into from
Sep 21, 2022

Conversation

jplatte
Copy link
Contributor

@jplatte jplatte commented Sep 13, 2022

changelog: Enhancement: [nonstandard_macro_braces]: Now includes matches!() in the default lint config
#9471

@rust-highfive
Copy link

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @flip1995 (or someone else) soon.

Please see the contribution instructions for more information.

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Sep 13, 2022
Comment on lines +187 to +190
macro_matcher!(
name: "matches",
braces: ("(", ")"),
),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be nice to add a test even though the change is trivial so that someone modifying the code latter won't break it

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just default configuration, if there are no tests at all for this feature I can kind of see your point, otherwise not. In any case I unfortunately don't have much time to figure out how to add completely new testing for this feature, but if there are already some tests and you insist of having them extended for this change, let me know where to find them.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tests are here. If you don't have time to add them I don't think it's a blocker, I can add them later

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a test and squashed everything. The output in the particular test case I've added is a little strange since it re-"format"s {} to () inside the macro invocation. Should I open an issue about that or is it something known from other lint suggestions that already has an issue?

Copy link
Contributor

@kraktus kraktus Sep 19, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch, I've opened an issue: #9498 Looks like it's there from the initial implementation. Would you like to fix it at the same time? If not it can be done independently

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have no idea where to even look so I'll let you take care of it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've opened #9499 and rebase on your work so you won't have any conflit

@xFrednet
Copy link
Member

Since I'm assigned to the follow-up PR and flip is quite busy AFAIK, I'm taking over this review 🙃

r? @xFrednet

@jplatte have you already seen the PR of @kraktus, and do we want to close this in favor of it? Otherwise, I can just review this first 🙃

@rust-highfive rust-highfive assigned xFrednet and unassigned flip1995 Sep 19, 2022
@jplatte
Copy link
Contributor Author

jplatte commented Sep 19, 2022

If you don't want to merge this first, you can close this in favor of #9499, sure.

@xFrednet
Copy link
Member

Looks good to me, I'm merging this as is, since the follow-up PR includes this commit as well. Thank you for the addition and thank you to @kraktus for the feedback and follow-up PR 🙃

FYI, I've updated the changelog entry a bit. The previous one was already pretty good 👍

@bors r+

@bors
Copy link
Contributor

bors commented Sep 21, 2022

📌 Commit 25584c0 has been approved by xFrednet

It is now in the queue for this repository.

@bors
Copy link
Contributor

bors commented Sep 21, 2022

⌛ Testing commit 25584c0 with merge 7248d06...

@bors
Copy link
Contributor

bors commented Sep 21, 2022

☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test
Approved by: xFrednet
Pushing 7248d06 to master...

@bors bors merged commit 7248d06 into rust-lang:master Sep 21, 2022
@jplatte jplatte deleted the patch-1 branch September 21, 2022 13:11
bors added a commit that referenced this pull request Sep 22, 2022
[`nonstandard_macro_braces`] Do not modify macro arguments

fix #9498

based on top of #9471

Also simplify the lint by not caring about code format which should be `rustfmt` job, and turn the lint into machine Applicable

changelog: Suggestion: [`nonstandard_macro_braces`]: The suggestion is now machine applicable and will no longer replace brackets inside the macro argument.
  [#9499](#9499)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants