-
Notifications
You must be signed in to change notification settings - Fork 898
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add width for codeblocks in comments (#5372)
* add doc_comment_code_block_width configuration * updated config docu * Updated docu and changed tests to config folder
- Loading branch information
Showing
9 changed files
with
131 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: 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() ) | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
tests/source/configs/doc_comment_code_block_width/100_greater_max_width.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// 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() ) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() ) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: 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()) | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
tests/target/configs/doc_comment_code_block_width/100_greater_max_width.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(), | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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()) | ||
} | ||
} |