Skip to content

Conversation

@matthewhughes934
Copy link

The comment style detection (i.e. comment_style) checks the start of a line to determine the style, so it will misidentify lines starting with spaces, e.g. //# some content would be identified as CommentStyle::DoubleSlash and not CommentStyle::Custom("//# ") resulting in it determining there to be a comment of "", which it then indents and appends a \n before writing back the original comment.

Fix this by trimming the line before trying to identify its style.

Fixes: #6612

The comment style detection (i.e. `comment_style`) checks the start of a line to determine the style, so it will misidentify lines starting with spaces, e.g. ` //# some content` would be identified as `CommentStyle::DoubleSlash` and not `CommentStyle::Custom("//# ")` resulting in it determining there to be a comment of `""`, which it then indents and appends a `\n` before writing back the original comment. Fix this by trimming the line before trying to identify its style. Fixes: rust-lang#6612
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

2 participants