You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fn myfunc1() {
println!("hi"); // yes I want my comments here
} // keep this comment here too
fn myfunc2() {
println!("bye"); // i want it that way
} // tell me why
The behavior I'm trying to get is something that doesn't change anything about these comments.
First, I tried skipping each of these functions, but running cargo +nightly fmtstill changes the whitespace between the closing curly brackets of the functions and the start of the trailing comments, which isn't what I want:
#[rustfmt::skip]
fn myfunc1() {
println!("hi"); // yes I want my comments here
} // keep this comment here too
#[rustfmt::skip]
fn myfunc2() {
println!("bye"); // i want it that way
} // tell me why
#![rustfmt::skip]
fn myfunc1() {
println!("hi"); // yes I want my comments here
} // keep this comment here too
fn myfunc2() {
println!("bye"); // i want it that way
}
I expected the last comment to stay there, just like the keep this comment here too comment was left alone. That seems like a bug :(
The text was updated successfully, but these errors were encountered:
Possibly related to #2781 and friends?
Versions
$ cargo +nightly --version
cargo 1.42.0-nightly (f6449ba23 2020-01-21)
$ rustc +nightly --version
rustc 1.42.0-nightly (41f41b2 2020-01-23)
What happened
I have these steps in a repo as well with commits for the different things I tried.
I have some weird comment placement that I'm trying to keep, so I want to skip formatting for them.
Here's the code with the weird comments:
The behavior I'm trying to get is something that doesn't change anything about these comments.
First, I tried skipping each of these functions, but running
cargo +nightly fmt
still changes the whitespace between the closing curly brackets of the functions and the start of the trailing comments, which isn't what I want:So next, I tried changing the attribute to applying to the containing item instead, and this time the last comment gets completely removed:
I expected the last comment to stay there, just like the
keep this comment here too
comment was left alone. That seems like a bug :(The text was updated successfully, but these errors were encountered: