-
Notifications
You must be signed in to change notification settings - Fork 996
Closed
Labels
A-commentsArea: commentsArea: comments
Description
rustfmt does not format a function call whose last argument does not have a trailing comma and is followed by two or more comments, with the last comment ending in a comma. E.g.:
fn main() {
let _ = std::ops::Add::add(10, 20
// ...
// ...,
);
}is left unchanged by rustfmt.
When the last comment does not have a comma, rustfmt works correctly, although the positioning of the first comment might be questionable:
fn main() {
let _ = std::ops::Add::add(10, 20
// ...
// ...
);
}becomes
fn main() {
let _ = std::ops::Add::add(
10, 20, // ...
// ...
);
}When a single comment is present, rustfmt works correctly, with the positioning of the comment depending on whether there is a trailing comma after the last argument:
fn main() {
let _ = std::ops::Add::add(
10, 20, // ...
// ...
);
}When the last argument has a trailing comma, rustfmt works correctly:
fn main() {
let _ = std::ops::Add::add(10, 20
// ...,
);
}becomes
fn main() {
let _ = std::ops::Add::add(
10, 20, // ...,
);
}and
fn main() {
let _ = std::ops::Add::add(10, 20,
// ...,
);
}becomes
fn main() {
let _ = std::ops::Add::add(
10, 20,
// ...,
);
}rustfmt version: rustfmt 1.4.38-nightly (91b9319 2021-10-23)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
A-commentsArea: commentsArea: comments