Skip to content

Need to improve display in case of spaces at the end of line #5174

Closed
@tomers

Description

@tomers

When rustfmt complains when there are spaces at the end of the line, it is impossible to see in the diff, since these are, well, whitespaces. Note that in this markdown view you can clearly see the space due to syntax highlighting, but in actual terminal (at least in my Ubuntu setup), the background is black, and the syntax highlighting is done on the fore-color, so the whitespaces are not visible after all.

I think it should show the excess whitespaces in some visible form.

Linting with cargo fmt...
Diff in /build/src/clients/foo.rs at line 83:
         let url = request.url.as_str();
         let mut default_url = format!("{}{}", DEFAULT_URL_TEMPLATE, url);
         let service_header = get_service_header();
-        if service_header.is_none() {   
+        if service_header.is_none() {
             return default_url;
         };
         let mut headers = HeaderMap::new();
Use cargo fmt to format your code

So for example it can look like this:

Linting with cargo fmt...
Diff in /build/src/clients/foo.rs at line 83:
         let url = request.url.as_str();
         let mut default_url = format!("{}{}", DEFAULT_URL_TEMPLATE, url);
         let service_header = get_service_header();
-        if service_header.is_none() {␣␣␣
+        if service_header.is_none() {
             return default_url;
         };
         let mut headers = HeaderMap::new();
Use cargo fmt to format your code

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions