-
Notifications
You must be signed in to change notification settings - Fork 901
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add width for codeblocks in comments #5372
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// rustfmt-max_width: 50 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These tests look good! However, we actually put tests for config option in a special directory, named Please move these when you get a chance, and with that move you may be able to rename the files (though don't feel obligated to do so) |
||
// rustfmt-format_code_in_doc_comments: true | ||
// rustfmt-doc_comment_code_block_width: 100 | ||
|
||
/// ```rust | ||
/// impl Test { | ||
/// pub const fn from_bytes(v: &[u8]) -> Result<Self, ParserError> { | ||
/// Self::from_bytes_manual_slice(v, 0, v.len() ) | ||
/// } | ||
/// } | ||
/// ``` | ||
|
||
impl Test { | ||
pub const fn from_bytes(v: &[u8]) -> Result<Self, ParserError> { | ||
Self::from_bytes_manual_slice(v, 0, v.len() ) | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// rustfmt-format_code_in_doc_comments: true | ||
// rustfmt-doc_comment_code_block_width: 50 | ||
|
||
/// ```rust | ||
/// impl Test { | ||
/// pub const fn from_bytes(v: &[u8]) -> Result<Self, ParserError> { | ||
/// Self::from_bytes_manual_slice(v, 0, v.len() ) | ||
/// } | ||
/// } | ||
/// ``` | ||
|
||
impl Test { | ||
pub const fn from_bytes(v: &[u8]) -> Result<Self, ParserError> { | ||
Self::from_bytes_manual_slice(v, 0, v.len() ) | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// rustfmt-format_code_in_doc_comments: true | ||
|
||
/// ```rust | ||
/// impl Test { | ||
/// pub const fn from_bytes(v: &[u8]) -> Result<Self, ParserError> { | ||
/// Self::from_bytes_manual_slice(v, 0, v.len() ) | ||
/// } | ||
/// } | ||
/// ``` | ||
|
||
impl Test { | ||
pub const fn from_bytes(v: &[u8]) -> Result<Self, ParserError> { | ||
Self::from_bytes_manual_slice(v, 0, v.len() ) | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// rustfmt-max_width: 50 | ||
// rustfmt-format_code_in_doc_comments: true | ||
// rustfmt-doc_comment_code_block_width: 100 | ||
|
||
/// ```rust | ||
/// impl Test { | ||
/// pub const fn from_bytes( | ||
/// v: &[u8], | ||
/// ) -> Result<Self, ParserError> { | ||
/// Self::from_bytes_manual_slice( | ||
/// v, | ||
/// 0, | ||
/// v.len(), | ||
/// ) | ||
/// } | ||
/// } | ||
/// ``` | ||
|
||
impl Test { | ||
pub const fn from_bytes( | ||
v: &[u8], | ||
) -> Result<Self, ParserError> { | ||
Self::from_bytes_manual_slice( | ||
v, | ||
0, | ||
v.len(), | ||
) | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// rustfmt-format_code_in_doc_comments: true | ||
// rustfmt-doc_comment_code_block_width: 50 | ||
|
||
/// ```rust | ||
/// impl Test { | ||
/// pub const fn from_bytes( | ||
/// v: &[u8], | ||
/// ) -> Result<Self, ParserError> { | ||
/// Self::from_bytes_manual_slice( | ||
/// v, | ||
/// 0, | ||
/// v.len(), | ||
/// ) | ||
/// } | ||
/// } | ||
/// ``` | ||
|
||
impl Test { | ||
pub const fn from_bytes(v: &[u8]) -> Result<Self, ParserError> { | ||
Self::from_bytes_manual_slice(v, 0, v.len()) | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// rustfmt-format_code_in_doc_comments: true | ||
|
||
/// ```rust | ||
/// impl Test { | ||
/// pub const fn from_bytes(v: &[u8]) -> Result<Self, ParserError> { | ||
/// Self::from_bytes_manual_slice(v, 0, v.len()) | ||
/// } | ||
/// } | ||
/// ``` | ||
|
||
impl Test { | ||
pub const fn from_bytes(v: &[u8]) -> Result<Self, ParserError> { | ||
Self::from_bytes_manual_slice(v, 0, v.len()) | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be good to include a link to the
format_code_in_doc_comments
option, similar to what's done for other options https://github.com/rust-lang/rustfmt/blob/master/Configurations.md#array_widthWhat do you think?