-
Notifications
You must be signed in to change notification settings - Fork 888
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
error[internal]: left behind trailing whitespace #6141
Comments
@skrobchik thanks for the report. When you get a chance, can you try to minimize the reproducible example to be as small as possible. Taking a look at the commit that you referenced I suspect this might be another duplicate of #3863 leading to rustfmt complaining about whitespace that exists within the source code. |
this error also happen in my project, while formating chain-call, like: let benches: Vec<_> = self[gidx]
.res
.iter() then: yiyue@terc ~/Pin1Yin1-Compiler-Rust (main)> rustfmt py-ast/src/semantic/declare/map.rs
error[internal]: left behind trailing whitespace
--> /home/yiyue/Pin1Yin1-Compiler-Rust/py-ast/src/semantic/declare/map.rs:72:72:1
|
72 |
| ^^^^^^^^^^^^
|
warning: rustfmt has failed to format. See previous 1 errors. because i always use vscode's format on save to format my code, it's hard to not notice that the code is not formated after i changed the code although i can get error by using cli, there are not any log are printed... |
Here's a semi minimal example (make sure your ide doesn't remove trailing whitespace by default): impl Preferences {
fn from_iter() -> Self {
Self(
preferences
.filter_map(|preference| {
trace!(
"Excluding {} from preferences due to unmatched markers.", requirement.name
);
match requirement {
UvSource => {
if *ve {
trace!(
"Excluding {} from preferences due to inexact version specifier.", requirement.name
);
}
}
}
})
.collect(),
)
}
} Playground: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=01c66f1e423afb96d09aaebbbf5f7e33 |
@konstin your example is definitely a duplicate of #3863. Because of the nested nature of the code, the line with the string literal exceeds the default width of 100. trace!(
"Excluding {} from preferences due to inexact version specifier.", requirement.name
); You have 3 options:
|
@skrobchik having just reviewed the commit it would seem that this line 👇🏼 is causing the
Taking a look at the file shows that there is indeed trailing whitespace in the commit: The advice to resolve this is the same as I mentioned above, with the addition that you could refactor your code and extract your message into a constant. For example: const HOVER_TEXT: &str = "El programa intentara asignar una aula de las categorias seleccionadas a esta clase.";
ui.label(RichText::new("Aulas Permitidas").strong()).on_hover_text(HOVER_TEXT); |
Would it be possible to disable the trailing whitespace check if rustfmt gave up on a too long line? Rustfmt not touching a piece of the AST is fine, the current error makes it look like you discovered a bad rustfmt bug |
Hello 👋
I'm getting an error when running
cargo fmt
in my project. Here's the commit.Not sure if you need any logs? I didn't see any guidelines for filing bug reports, so please let me know if anything is needed 😄
The text was updated successfully, but these errors were encountered: