parent
bcfc57ec8a
commit
b08130c590
@ -726,7 +726,7 @@ fn handle_line(
|
||||
let code_block = match self.code_block_attr.as_ref().unwrap() {
|
||||
CodeBlockAttribute::Rust
|
||||
if self.fmt.config.format_code_in_doc_comments()
|
||||
&& !self.code_block_buffer.is_empty() =>
|
||||
&& !self.code_block_buffer.trim().is_empty() =>
|
||||
{
|
||||
let mut config = self.fmt.config.clone();
|
||||
config.set().wrap_comments(false);
|
||||
|
51
tests/source/issue-5234.rs
Normal file
51
tests/source/issue-5234.rs
Normal file
@ -0,0 +1,51 @@
|
||||
// rustfmt-format_code_in_doc_comments: true
|
||||
|
||||
/// ```
|
||||
/// ```
|
||||
fn foo() {}
|
||||
|
||||
/// ```
|
||||
///Something
|
||||
/// ```
|
||||
fn foo() {}
|
||||
|
||||
/// ```
|
||||
///
|
||||
/// ```
|
||||
fn foo() {}
|
||||
|
||||
|
||||
/// /// ```
|
||||
fn foo() {}
|
||||
|
||||
/// /// ```
|
||||
/// ```
|
||||
///
|
||||
/// ```
|
||||
/// ```
|
||||
fn foo() {}
|
||||
|
||||
fn foo() {
|
||||
/// ```
|
||||
///
|
||||
/// ```
|
||||
struct bar {}
|
||||
}
|
||||
|
||||
/// ```
|
||||
/// fn com(){
|
||||
/// let i = 5;
|
||||
///
|
||||
/// let j = 6;
|
||||
/// }
|
||||
/// ```
|
||||
fn foo() {}
|
||||
|
||||
fn foo() {
|
||||
/// ```
|
||||
///fn com(){
|
||||
///let i = 5;
|
||||
///}
|
||||
/// ```
|
||||
struct bar {}
|
||||
}
|
47
tests/target/issue-5234.rs
Normal file
47
tests/target/issue-5234.rs
Normal file
@ -0,0 +1,47 @@
|
||||
// rustfmt-format_code_in_doc_comments: true
|
||||
|
||||
/// ```
|
||||
/// ```
|
||||
fn foo() {}
|
||||
|
||||
/// ```
|
||||
/// Something
|
||||
/// ```
|
||||
fn foo() {}
|
||||
|
||||
/// ```
|
||||
/// ```
|
||||
fn foo() {}
|
||||
|
||||
/// /// ```
|
||||
fn foo() {}
|
||||
|
||||
/// /// ```
|
||||
/// ```
|
||||
/// ```
|
||||
/// ```
|
||||
fn foo() {}
|
||||
|
||||
fn foo() {
|
||||
/// ```
|
||||
/// ```
|
||||
struct bar {}
|
||||
}
|
||||
|
||||
/// ```
|
||||
/// fn com() {
|
||||
/// let i = 5;
|
||||
///
|
||||
/// let j = 6;
|
||||
/// }
|
||||
/// ```
|
||||
fn foo() {}
|
||||
|
||||
fn foo() {
|
||||
/// ```
|
||||
/// fn com() {
|
||||
/// let i = 5;
|
||||
/// }
|
||||
/// ```
|
||||
struct bar {}
|
||||
}
|
Loading…
Reference in New Issue
Block a user