Skip to content

Add format_in_format_args and to_string_in_format_args lints#7743

Merged
bors merged 3 commits into
rust-lang:masterfrom
smoelius:master
Oct 15, 2021
Merged

Add format_in_format_args and to_string_in_format_args lints#7743
bors merged 3 commits into
rust-lang:masterfrom
smoelius:master

Conversation

@smoelius

Copy link
Copy Markdown
Contributor

Fixes #7667 and #7729

I put these in perf since that was one of @jplatte's suggestions, and redundant_clone (which I consider to be similar) lives there as well.

However, I am open to changing the category or anything else.

r? @camsteffen

changelog: Add format_in_format_args and to_string_in_format_args lints

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Sep 30, 2021
@smoelius

Copy link
Copy Markdown
Contributor Author

Sorry for the late addition. I added two more test cases.

Comment thread clippy_utils/src/format.rs Outdated
Comment thread clippy_lints/src/format_args.rs Outdated
@smoelius

smoelius commented Oct 2, 2021

Copy link
Copy Markdown
Contributor Author

I pushed the changes using bitflags.

bitflags 1.2 is already in rust's lockfile, so hopefully this won't be a problem: https://github.com/rust-lang/rust/blob/a8387aef8c378a771686878062e544af4d5e2245/Cargo.lock#L125

Please let me know what other changes are needed.

@bors

bors commented Oct 3, 2021

Copy link
Copy Markdown
Contributor

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

Comment thread clippy_lints/src/format_args.rs Outdated
Comment thread clippy_lints/src/format_args.rs Outdated
Comment thread clippy_lints/src/format_args.rs Outdated
Comment thread clippy_lints/src/format_args.rs Outdated
Comment thread clippy_utils/src/higher.rs Outdated
Comment thread clippy_utils/src/higher.rs Outdated
Comment thread clippy_lints/src/format_args.rs
Comment thread clippy_utils/src/higher.rs Outdated
Comment thread clippy_utils/src/higher.rs Outdated
Comment thread tests/ui/format_args.rs
@camsteffen camsteffen added S-waiting-on-author Status: This is awaiting some action from the author. (Use `@rustbot ready` to update this status) and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties labels Oct 5, 2021
@bors

bors commented Oct 6, 2021

Copy link
Copy Markdown
Contributor

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

@smoelius

smoelius commented Oct 7, 2021

Copy link
Copy Markdown
Contributor Author

@camsteffen I apologize for the delay. The Deref case was trickier than I expected. I think the most recent push addresses all of your comments up to this point.

@bors

bors commented Oct 8, 2021

Copy link
Copy Markdown
Contributor

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

@camsteffen camsteffen left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No problem at all!

Okay, I have another round of feedback. We're definitely getting closer. This may be the most complex macro processing that Clippy has even seen so really great work!

Comment thread clippy_lints/src/format.rs Outdated
Comment thread clippy_utils/src/higher.rs Outdated
Comment thread clippy_utils/src/higher.rs Outdated
Comment thread clippy_lints/src/format_args.rs Outdated
Comment thread clippy_lints/src/format_args.rs Outdated
Comment thread clippy_lints/src/format_args.rs Outdated
Comment thread clippy_lints/src/format_args.rs Outdated
Comment thread tests/ui/format_args_unfixable.stderr Outdated
Comment thread tests/ui/format_args_unfixable.stderr Outdated
Comment thread tests/ui/format_args_unfixable.rs Outdated
@smoelius

Copy link
Copy Markdown
Contributor Author

I think I'm ready for the next round of feedback, @camsteffen. Thanks for doing this.

@camsteffen camsteffen left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think we're nearing the end now. Thanks for sticking with it.

Comment thread clippy_lints/src/format_args.rs Outdated
Comment thread clippy_lints/src/format_args.rs Outdated
Comment thread tests/ui/format_args.rs
Comment thread clippy_lints/src/format_args.rs Outdated
Comment thread clippy_lints/src/format_args.rs
Comment thread clippy_utils/src/higher.rs
Comment thread clippy_lints/src/format_args.rs
Comment thread clippy_lints/src/format_args.rs Outdated
@bors

bors commented Oct 12, 2021

Copy link
Copy Markdown
Contributor

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

@smoelius

Copy link
Copy Markdown
Contributor Author

@camsteffen The paths I added to path.rs appear to be the only ones that refer to macros. I am guessing this is why INVALID_PATHS is failing. Assuming this is right, do you have any suggestions on how to fix it?

@camsteffen

Copy link
Copy Markdown
Contributor

@camsteffen The paths I added to path.rs appear to be the only ones that refer to macros. I am guessing this is why INVALID_PATHS is failing. Assuming this is right, do you have any suggestions on how to fix it?

@smoelius I'd probably have to debug the invalid_paths lint to figure it out. But the paths should be migrated to diagnostic items anyways so it's kinda not worth the effort. So it's okay to use paths for now and allow the lint on those items with a todo. Or, if you feel inclined, you can add the diagnostic items in rustc and wait for them to be synced in the following Rustup PR.

@smoelius

Copy link
Copy Markdown
Contributor Author

it's okay to use paths for now and allow the lint on those items with a todo.

OK, that's what I did.

I also did some optimistic squashing. But I can undo it if it's a problem.

Comment thread clippy_lints/src/format_args.rs Outdated

@camsteffen camsteffen left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please squash the last commit and this is ready to merge!

@smoelius

Copy link
Copy Markdown
Contributor Author

Thanks very much for your patience, @camsteffen.

@camsteffen

Copy link
Copy Markdown
Contributor

You bet. Thanks for the PR!

@bors r+

@bors

bors commented Oct 15, 2021

Copy link
Copy Markdown
Contributor

📌 Commit 75e9f8c has been approved by camsteffen

@bors

bors commented Oct 15, 2021

Copy link
Copy Markdown
Contributor

⌛ Testing commit 75e9f8c with merge e1871ba...

@bors

bors commented Oct 15, 2021

Copy link
Copy Markdown
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-author Status: This is awaiting some action from the author. (Use `@rustbot ready` to update this status)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Lint suggestion: nested format!

4 participants