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
Doc comments are not allowed in function parameters, so rustfmt should either refuse to format code that has them or format them as if they were normal comments. Instead, rustfmt incorrectly formats the code by merging the parameter into the doc comment or sometimes removing the doc comment.
To Reproduce
For example, rustfmt formats
fnfoo(/// This is `bar`.bar:bool,){}
into
fnfoo(/// This is `bar`. bar: bool){}
and formats
fnfoo(/// This is `bar`.bar:bool,/// This has a long name.veeeeeeeeeeery_long_paramater_name_to_force_multiline_parameter_list:bool,){}
into
fnfoo(/// This is `bar`. bar: bool,veeeeeeeeeeery_long_paramater_name_to_force_multiline_parameter_list:bool,){}
In general, while in many cases rustfmt can still format around invalid code, one should not expect rustfmt to be able to handle all cases of invalid syntax, as that way lies madness.
We did opt to go ahead and support this particular use case, but that was primarily because there seemed to be a plan for making this potential valid with macros.
Description
Doc comments are not allowed in function parameters, so
rustfmt
should either refuse to format code that has them or format them as if they were normal comments. Instead,rustfmt
incorrectly formats the code by merging the parameter into the doc comment or sometimes removing the doc comment.To Reproduce
For example,
rustfmt
formatsinto
and formats
into
Meta
rustup
rustfmt
tooThe text was updated successfully, but these errors were encountered: