Skip to content

Unclear message for comments with trailing spaces #6545

Open
@giluis

Description

@giluis

When a comment ends with a trailing whitespace, cargo fmt --check gives an unclear error message.

fn main() {
    // Comment with trailing whitespace 
    println!("Hello world");
}

Error message:

Image

output of rustfmt -V on my machine: rustfmt 1.8.0-nightly (b48576b4db 2025-03-22)

I think there are Unicode characters that can be used to represent unwanted spaces, like U+2423, U+23B5 or U+25AF

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions