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

Revive suggestion on explicit_write #4542

Closed
JohnTitor opened this issue Sep 14, 2019 · 0 comments · Fixed by #8365
Closed

Revive suggestion on explicit_write #4542

JohnTitor opened this issue Sep 14, 2019 · 0 comments · Fixed by #8365
Labels
C-enhancement Category: Enhancement of lints, like adding more cases or adding help messages L-suggestion Lint: Improving, adding or fixing lint suggestions

Comments

@JohnTitor
Copy link
Member

JohnTitor commented Sep 14, 2019

writeln!(std::io::stderr(), "foo {}", "bar").unwrap();

should be

eprintln!("foo {}","bar");

but clippy suggests

  |
4 |     writeln!(std::io::stderr(), "foo {}", "bar").unwrap();
  |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `eprintln!("foo ")`

It should be

  |
4 |     writeln!(std::io::stderr(), "foo {}", "bar").unwrap();
  |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `eprintln!("foo {}", "bar")`

(Playground)


UPDATE

#4544 removed the wrong suggestion. We should find the right way and revive suggestions.

@JohnTitor JohnTitor added the L-suggestion Lint: Improving, adding or fixing lint suggestions label Sep 14, 2019
@phansch phansch added C-bug Category: Clippy is not doing the correct thing I-suggestion-causes-error Issue: The suggestions provided by this Lint cause an ICE/error when applied labels Sep 14, 2019
JoshMcguigan added a commit to JoshMcguigan/rust-clippy that referenced this issue Sep 15, 2019
JoshMcguigan added a commit to JoshMcguigan/rust-clippy that referenced this issue Sep 17, 2019
JoshMcguigan added a commit to JoshMcguigan/rust-clippy that referenced this issue Sep 17, 2019
JoshMcguigan added a commit to JoshMcguigan/rust-clippy that referenced this issue Sep 17, 2019
JoshMcguigan added a commit to JoshMcguigan/rust-clippy that referenced this issue Sep 17, 2019
JoshMcguigan added a commit to JoshMcguigan/rust-clippy that referenced this issue Sep 18, 2019
bors added a commit that referenced this issue Sep 19, 2019
#4542 remove machine applicable suggestion

This helps #4542 (but does not completely resolve) by removing the machine applicable suggestion (which was incorrect) for that case.

I would have preferred to fix the machine applicable suggestion to handle format strings, but that's a bit beyond my current understanding of the clippy codebase. I'd be happy to give it a try given some guidance.
flip1995 added a commit to flip1995/rust-clippy that referenced this issue Sep 19, 2019
rust-lang#4542 remove machine applicable suggestion

This helps rust-lang#4542 (but does not completely resolve) by removing the machine applicable suggestion (which was incorrect) for that case.

I would have preferred to fix the machine applicable suggestion to handle format strings, but that's a bit beyond my current understanding of the clippy codebase. I'd be happy to give it a try given some guidance.
flip1995 added a commit to flip1995/rust-clippy that referenced this issue Sep 19, 2019
rust-lang#4542 remove machine applicable suggestion

This helps rust-lang#4542 (but does not completely resolve) by removing the machine applicable suggestion (which was incorrect) for that case.

I would have preferred to fix the machine applicable suggestion to handle format strings, but that's a bit beyond my current understanding of the clippy codebase. I'd be happy to give it a try given some guidance.

changelog: only produce machine applicable suggestions on `explicit_write` lint
bors added a commit that referenced this issue Sep 19, 2019
Rollup of 4 pull requests

Successful merges:

 - #4511 (New lint: mem_replace_with_uninit)
 - #4535 (New lint: Require `# Safety` section in pub unsafe fn docs)
 - #4539 (Changes cast-lossless to a pedantic lint)
 - #4544 (#4542 remove machine applicable suggestion)

Failed merges:

r? @ghost

changelog: none
bors added a commit that referenced this issue Sep 19, 2019
#4542 remove machine applicable suggestion

This helps #4542 (but does not completely resolve) by removing the machine applicable suggestion (which was incorrect) for that case.

I would have preferred to fix the machine applicable suggestion to handle format strings, but that's a bit beyond my current understanding of the clippy codebase. I'd be happy to give it a try given some guidance.

changelog: only produce machine applicable suggestions on `explicit_write` lint
@JohnTitor JohnTitor added C-enhancement Category: Enhancement of lints, like adding more cases or adding help messages and removed C-bug Category: Clippy is not doing the correct thing I-suggestion-causes-error Issue: The suggestions provided by this Lint cause an ICE/error when applied labels Dec 31, 2019
@JohnTitor JohnTitor changed the title Wrong suggestion on explicit_write Revive suggestion on explicit_write Dec 31, 2019
@bors bors closed this as completed in 68b4498 Feb 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement Category: Enhancement of lints, like adding more cases or adding help messages L-suggestion Lint: Improving, adding or fixing lint suggestions
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants