Skip to content

Revive suggestion on explicit_write #4542

Closed
@JohnTitor

Description

@JohnTitor
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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-enhancementCategory: Enhancement of lints, like adding more cases or adding help messagesL-suggestionLint: Improving, adding or fixing lint suggestions

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions