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

Preserve raw strs for: format!(s) to s.to_string() lint #6151

Merged
merged 1 commit into from
Oct 9, 2020

Conversation

bofh69
Copy link
Contributor

@bofh69 bofh69 commented Oct 9, 2020

fixes #6142

clippy::useless_format will keep the source's string (after converting {{ and }} to { and }) when suggesting a change from format!() to .to_string() usage. Ie:
| let s = format!(r#""hello {{}}""#);
| ^^^^^^^^^^^^^^^^^^^^^ help: consider using .to_string(): r#""hello {}""#.to_string()

changelog: [useless_format]: preserve raw string literals when no arguments to format!() are provided.

Ie:
|     let s = format!(r#""hello""#);
|             ^^^^^^^^^^^^^^^^^^^^^ help: consider using `.to_string()`: `r#""hello""#.to_string()`
@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 @ebroto (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

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 Oct 9, 2020
@ebroto
Copy link
Member

ebroto commented Oct 9, 2020

@bors r+

Thanks for your contribution!

@bors
Copy link
Collaborator

bors commented Oct 9, 2020

📌 Commit 7b7ddfa has been approved by ebroto

@bors
Copy link
Collaborator

bors commented Oct 9, 2020

⌛ Testing commit 7b7ddfa with merge 2bdadd8...

@ebroto ebroto removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Oct 9, 2020
@bors
Copy link
Collaborator

bors commented Oct 9, 2020

☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test
Approved by: ebroto
Pushing 2bdadd8 to master...

@bors bors merged commit 2bdadd8 into rust-lang:master Oct 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

clippy --fix does not preserve whether strings were raw string literals
4 participants