Skip to content

write_with_newline should not warn when "\n" is preceded by "\r" #4208

Closed
@Geobert

Description

@Geobert

Writing to a file, I need CRLF format so I have no other choice than using write with \r\n.

warning: using `write!()` with a format string that ends in a single newline, consider using `writeln!()` instead
  --> src\main.rs:49:13
   |
49 |             write!(out, "{}\r\n", line)?;
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: #[warn(clippy::write_with_newline)] on by default
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#write_with_newline

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: Clippy is not doing the correct thinggood first issueThese issues are a good way to get started with Clippy

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions