Fix multiline doc comments
Use str::lines() to split the doc comment into one #[doc] block per comment line.
Note: The diff is large, but it's all just the test expectations for the comments being updated. The actual change is -1 + 3 lines.
Fixes #3073
Could we add an option for users to choose their preferred style?
Could we add an option for users to choose their preferred style?
Could you elaborate what you mean with preferred style? I think the current policy is to leave it up to rustfmt / prettyplease to format the output according to the users preferences.
Could we add an option for users to choose their preferred style?
Could you elaborate what you mean with preferred style? I think the current policy is to leave it up to rustfmt / prettyplease to format the output according to the users preferences.
So the only cases this impacts is where no formatter is set?
I've changed how comments are processed slightly in the attributes implementation, it will run all attributes through prettyplease and collapse all comments into a single #[doc = "..."] tag right before calling the process_attributes callback.
Do you think this change will survive the new behavior?
@emilio Would you accept this PR to fix multiline doc comments? If yes I would go ahead and rebase the test expectations.
There was a request by @rich-ayr to add an option to keep the current behavior (of a single #[doc = "..."] tag), and it would be good to have a maintainers opinion on that before I implement any changes.