Skip to content

Commit 97d7216

Browse files
committed
Revert "Change config option from format_doc_comments to format_code_in_doc_comments."
This reverts commit 6a6924c.
1 parent 6a6924c commit 97d7216

17 files changed

+19
-19
lines changed

Configurations.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1978,9 +1978,9 @@ fn main() {
19781978
}
19791979
```
19801980

1981-
## `format_code_in_doc_comments`
1981+
## `format_doc_comments`
19821982

1983-
Format code snippet included in doc comments.
1983+
Format doc comments.
19841984

19851985
- **Default value**: `false`
19861986
- **Possible values**: `true`, `false`

src/comment.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ fn identify_comment(
353353
trim_left_preserve_layout(first_group, shape.indent, config)?
354354
} else if !config.normalize_comments()
355355
&& !config.wrap_comments()
356-
&& !config.format_code_in_doc_comments()
356+
&& !config.format_doc_comments()
357357
{
358358
light_rewrite_comment(first_group, shape.indent, config, is_doc_comment)
359359
} else {
@@ -656,7 +656,7 @@ impl<'a> CommentRewrite<'a> {
656656
_ => {
657657
let mut config = self.fmt.config.clone();
658658
config.set().wrap_comments(false);
659-
if config.format_code_in_doc_comments() {
659+
if config.format_doc_comments() {
660660
if let Some(s) =
661661
crate::format_code_block(&self.code_block_buffer, &config)
662662
{

src/config/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ create_config! {
3737

3838
// Comments. macros, and strings
3939
wrap_comments: bool, false, false, "Break comments to fit on the line";
40-
format_code_in_doc_comments: bool, false, false, "Format the code snippet in doc comments.";
40+
format_doc_comments: bool, false, false, "Format doc comments.";
4141
comment_width: usize, 80, false,
4242
"Maximum length of comments. No effect unless wrap_comments = true";
4343
normalize_comments: bool, false, false, "Convert /* */ comments to // comments where possible";

tests/source/doc-comment-with-example.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// rustfmt-format_code_in_doc_comments: true
1+
// rustfmt-format_doc_comments: true
22

33
/// Foo
44
///

tests/source/invalid-rust-code-in-doc-comment.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// rustfmt-format_code_in_doc_comments: true
1+
// rustfmt-format_doc_comments: true
22

33
/// ```rust
44
/// if (true) { … }

tests/source/issue-2520.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// rustfmt-normalize_comments: true
2-
// rustfmt-format_code_in_doc_comments: true
2+
// rustfmt-format_doc_comments: true
33

44
//! ```rust
55
//! println!( "hello, world" );

tests/source/issue-2523.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// rustfmt-normalize_comments: true
2-
// rustfmt-format_code_in_doc_comments: true
2+
// rustfmt-format_doc_comments: true
33

44
// Do not unindent macro calls in comment with unformattable syntax.
55
//! ```rust

tests/source/issue-3055/original.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// rustfmt-wrap_comments: true
2-
// rustfmt-format_code_in_doc_comments: true
2+
// rustfmt-format_doc_comments: true
33

44
/// Vestibulum elit nibh, rhoncus non, euismod sit amet, pretium eu, enim. Nunc commodo ultricies dui.
55
///

tests/source/itemized-blocks/no_wrap.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// rustfmt-normalize_comments: true
2-
// rustfmt-format_code_in_doc_comments: true
2+
// rustfmt-format_doc_comments: true
33

44
//! This is a list:
55
//! * Outer

tests/source/itemized-blocks/wrap.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// rustfmt-wrap_comments: true
2-
// rustfmt-format_code_in_doc_comments: true
2+
// rustfmt-format_doc_comments: true
33
// rustfmt-max_width: 50
44

55
//! This is a list:

tests/target/doc-comment-with-example.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// rustfmt-format_code_in_doc_comments: true
1+
// rustfmt-format_doc_comments: true
22

33
/// Foo
44
///

tests/target/invalid-rust-code-in-doc-comment.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// rustfmt-format_code_in_doc_comments: true
1+
// rustfmt-format_doc_comments: true
22

33
/// ```rust
44
/// if (true) { … }

tests/target/issue-2520.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// rustfmt-normalize_comments: true
2-
// rustfmt-format_code_in_doc_comments: true
2+
// rustfmt-format_doc_comments: true
33

44
//! ```rust
55
//! println!("hello, world");

tests/target/issue-2523.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// rustfmt-normalize_comments: true
2-
// rustfmt-format_code_in_doc_comments: true
2+
// rustfmt-format_doc_comments: true
33

44
// Do not unindent macro calls in comment with unformattable syntax.
55
//! ```rust

tests/target/issue-3055/original.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// rustfmt-wrap_comments: true
2-
// rustfmt-format_code_in_doc_comments: true
2+
// rustfmt-format_doc_comments: true
33

44
/// Vestibulum elit nibh, rhoncus non, euismod sit amet, pretium eu, enim. Nunc
55
/// commodo ultricies dui.

tests/target/itemized-blocks/no_wrap.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// rustfmt-normalize_comments: true
2-
// rustfmt-format_code_in_doc_comments: true
2+
// rustfmt-format_doc_comments: true
33

44
//! This is a list:
55
//! * Outer

tests/target/itemized-blocks/wrap.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// rustfmt-wrap_comments: true
2-
// rustfmt-format_code_in_doc_comments: true
2+
// rustfmt-format_doc_comments: true
33
// rustfmt-max_width: 50
44

55
//! This is a list:

0 commit comments

Comments
 (0)