New config option to support lower width limit on code blocks in doc comments #5359
Labels
feature-request
good first issue
Issues up for grabs, also good candidates for new rustfmt contributors
help wanted
The motivation for this new option is outlined in #5345, and the option proposed here is a potential solution to that scenario.
Specifically, we need to introduce a new config option named something like
doc_comment_code_block_width
(but feel free to come up with a better name) that's used to set the width threshold used when rustfmt is reformating code blocks residing within doc comments.This should be a fairly straightforward option to add, and a great way to start getting familiar with rustfmt, for anyone that's interested!
Implementation pointers:
100
rustfmt/src/comment.rs
Lines 726 to 742 in 79515f1
I suspect what you'll want to do is ensure the
max_width
value on the cloned config is overridden to the lowest value between the newdoc_comment_code_block_width
ormax_width
(since the overarchingmax_width
needs to be the ceiling anyway)#5228 may also serve as a helpful reference for adding new options
The text was updated successfully, but these errors were encountered: