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 allow-mixed-uninlined-format-args config #9865

Merged
merged 2 commits into from
Nov 28, 2022
Merged

Conversation

nyurik
Copy link
Contributor

@nyurik nyurik commented Nov 18, 2022

Implement allow-mixed-uninlined-format-args config param to change the behavior of the uninlined_format_args lint. Now it is a part of style per Zulip chat, and won't propose inlining in case of a mixed usage, e.g. print!("{} {}", var, 1+2). If the user sets allow-mixed-uninlined-format-args config param to false, the lint would behave like it did before -- proposing to inline args even in the mixed case.


changelog: [uninlined_format_args]: Added a new config allow-mixed-uninlined-format-args to allow the lint, if only some arguments can be inlined
#9865
changelog: Moved [uninlined_format_args] to style (Now warn-by-default)
#9865

@rust-highfive
Copy link

r? @xFrednet

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Nov 18, 2022
@xFrednet
Copy link
Member

Hey @nyurik, thank you for the PR! I've seen it, this is just a small warning, that the review will take some time due to its size. I'll try to get it done by Thursday, but it might take until the end of next weekend. I hope that's alright with you :)

@bors
Copy link
Collaborator

bors commented Nov 22, 2022

☔ The latest upstream changes (presumably #9924) made this pull request unmergeable. Please resolve the merge conflicts.

@nyurik
Copy link
Contributor Author

nyurik commented Nov 25, 2022

@xFrednet Let me know if there are any blockers on this one. BTW, note that the actual code change is just a few lines - the rest is just a copy/paste of an integration test - to see that the same test behaves properly with a different configuration parameter.

@xFrednet
Copy link
Member

There are no blockers, just a busy week on my end and I got a cold. My schedule is mostly free on the weekend. You'll have a review the latest on Sunday. Thank you for your patience. :)

@nyurik
Copy link
Contributor Author

nyurik commented Nov 25, 2022

Thanks @xFrednet, didn't mean to push you on this :) Get well soon!

@bors
Copy link
Collaborator

bors commented Nov 25, 2022

☔ The latest upstream changes (presumably #9945) made this pull request unmergeable. Please resolve the merge conflicts.

@nyurik nyurik force-pushed the allow-mixed branch 2 times, most recently from d5ab0ca to 029714a Compare November 25, 2022 19:08
Copy link
Member

@xFrednet xFrednet left a comment

Choose a reason for hiding this comment

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

Thank you for waiting on the review. The implementation itself looks good to me. It was actually less to review then I thought, as most of the changes come from the .stderr, which is almost identical to the one in the /ui/ folder.

@@ -305,11 +321,23 @@ fn check_uninlined_args(cx: &LateContext<'_>, args: &FormatArgsExpn<'_>, call_si
Applicability::MachineApplicable,
if multiline_fix { CompletelyHidden } else { ShowCode },
);
if ignore_mixed {
// Improve lint config discoverability
diag.note_once(
Copy link
Member

Choose a reason for hiding this comment

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

I'm unsure about this part. Configurations are currently hard to discover, and discussing this should be on our agenda. A solution could be these notes, like you also suggested in #9880. However, until that has been discussed (Most likely on Tuesday on Zulip) I would hold off on this one.

Even then, I'd recommend adding the message all at once, to ensure that they're the same/similar. If this should be included in this PR, we should try to find a shorter wording. I don't remember if that's an official guideline, or just one we follow, but messages should ideally be shorter than 80 characters, 100 would also be fine, but this is a bit too long IMO.

We could remove the reference to the clippy.toml file, just mention that there is a configuration which is described in the lint description or say that this message could be suppressed via the XYZ config value. All of these are viable options with different tradeoffs. Deciding on a phrasing, is one of the reasons why I would like to do this as part of #9880 and not here.

@bors
Copy link
Collaborator

bors commented Nov 27, 2022

☔ The latest upstream changes (presumably #9860) made this pull request unmergeable. Please resolve the merge conflicts.

Implement `allow-mixed-uninlined-format-args` config param to change the behavior of the `uninlined_format_args` lint. Now it is a part of `style`, and won't propose inlining in case of a mixed usage, e.g. `print!("{} {}", var, 1+2)`. If the user sets allow-mixed-uninlined-format-args config param to `false`, then it would behave like before, proposing to inline args even in the mixed case.
@nyurik
Copy link
Contributor Author

nyurik commented Nov 27, 2022

@xFrednet thanks, makes sense, i think I addressed all of your feedback points. Thx again!

@xFrednet
Copy link
Member

Looks good to me, thank you very much for the addition!

@bors r+

@bors
Copy link
Collaborator

bors commented Nov 28, 2022

📌 Commit ab576af has been approved by xFrednet

It is now in the queue for this repository.

@bors
Copy link
Collaborator

bors commented Nov 28, 2022

⌛ Testing commit ab576af with merge 1207480...

@bors
Copy link
Collaborator

bors commented Nov 28, 2022

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

@bors bors merged commit 1207480 into rust-lang:master Nov 28, 2022
@nyurik nyurik deleted the allow-mixed branch November 28, 2022 17:59
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.

4 participants