Skip to content

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

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

Closed
tomers opened this issue Jan 15, 2022 · 1 comment
Closed

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

tomers opened this issue Jan 15, 2022 · 1 comment

Comments

@tomers
Copy link

tomers commented Jan 15, 2022

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
@calebcartwright
Copy link
Member

Thanks for reaching out, but going to close as a duplicate of #4839

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants