Revert "Revert "Change config option from format_doc_comments to format_code_in_doc_comments.""
This reverts commit 97d7216cd4ebce511d5707ec5dd8b7b8fe771cba.
This commit is contained in:
parent
de425f1eb8
commit
a956a20532
@ -1978,9 +1978,9 @@ fn main() {
|
||||
}
|
||||
```
|
||||
|
||||
## `format_doc_comments`
|
||||
## `format_code_in_doc_comments`
|
||||
|
||||
Format code snippet in doc comments.
|
||||
Format code snippet included in doc comments.
|
||||
|
||||
- **Default value**: `false`
|
||||
- **Possible values**: `true`, `false`
|
||||
|
@ -353,7 +353,7 @@ fn identify_comment(
|
||||
trim_left_preserve_layout(first_group, shape.indent, config)?
|
||||
} else if !config.normalize_comments()
|
||||
&& !config.wrap_comments()
|
||||
&& !config.format_doc_comments()
|
||||
&& !config.format_code_in_doc_comments()
|
||||
{
|
||||
light_rewrite_comment(first_group, shape.indent, config, is_doc_comment)
|
||||
} else {
|
||||
@ -656,7 +656,7 @@ impl<'a> CommentRewrite<'a> {
|
||||
_ => {
|
||||
let mut config = self.fmt.config.clone();
|
||||
config.set().wrap_comments(false);
|
||||
if config.format_doc_comments() {
|
||||
if config.format_code_in_doc_comments() {
|
||||
if let Some(s) =
|
||||
crate::format_code_block(&self.code_block_buffer, &config)
|
||||
{
|
||||
|
@ -37,7 +37,7 @@ create_config! {
|
||||
|
||||
// Comments. macros, and strings
|
||||
wrap_comments: bool, false, false, "Break comments to fit on the line";
|
||||
format_doc_comments: bool, false, false, "Format doc comments.";
|
||||
format_code_in_doc_comments: bool, false, false, "Format the code snippet in doc comments.";
|
||||
comment_width: usize, 80, false,
|
||||
"Maximum length of comments. No effect unless wrap_comments = true";
|
||||
normalize_comments: bool, false, false, "Convert /* */ comments to // comments where possible";
|
||||
|
@ -1,4 +1,4 @@
|
||||
// rustfmt-format_doc_comments: true
|
||||
// rustfmt-format_code_in_doc_comments: true
|
||||
|
||||
/// Foo
|
||||
///
|
||||
|
@ -1,4 +1,4 @@
|
||||
// rustfmt-format_doc_comments: true
|
||||
// rustfmt-format_code_in_doc_comments: true
|
||||
|
||||
/// ```rust
|
||||
/// if (true) { … }
|
||||
|
@ -1,5 +1,5 @@
|
||||
// rustfmt-normalize_comments: true
|
||||
// rustfmt-format_doc_comments: true
|
||||
// rustfmt-format_code_in_doc_comments: true
|
||||
|
||||
//! ```rust
|
||||
//! println!( "hello, world" );
|
||||
|
@ -1,5 +1,5 @@
|
||||
// rustfmt-normalize_comments: true
|
||||
// rustfmt-format_doc_comments: true
|
||||
// rustfmt-format_code_in_doc_comments: true
|
||||
|
||||
// Do not unindent macro calls in comment with unformattable syntax.
|
||||
//! ```rust
|
||||
|
@ -1,5 +1,5 @@
|
||||
// rustfmt-wrap_comments: true
|
||||
// rustfmt-format_doc_comments: true
|
||||
// rustfmt-format_code_in_doc_comments: true
|
||||
|
||||
/// Vestibulum elit nibh, rhoncus non, euismod sit amet, pretium eu, enim. Nunc commodo ultricies dui.
|
||||
///
|
||||
|
@ -1,5 +1,5 @@
|
||||
// rustfmt-normalize_comments: true
|
||||
// rustfmt-format_doc_comments: true
|
||||
// rustfmt-format_code_in_doc_comments: true
|
||||
|
||||
//! This is a list:
|
||||
//! * Outer
|
||||
|
@ -1,5 +1,5 @@
|
||||
// rustfmt-wrap_comments: true
|
||||
// rustfmt-format_doc_comments: true
|
||||
// rustfmt-format_code_in_doc_comments: true
|
||||
// rustfmt-max_width: 50
|
||||
|
||||
//! This is a list:
|
||||
|
@ -1,4 +1,4 @@
|
||||
// rustfmt-format_doc_comments: true
|
||||
// rustfmt-format_code_in_doc_comments: true
|
||||
|
||||
/// Foo
|
||||
///
|
||||
|
@ -1,4 +1,4 @@
|
||||
// rustfmt-format_doc_comments: true
|
||||
// rustfmt-format_code_in_doc_comments: true
|
||||
|
||||
/// ```rust
|
||||
/// if (true) { … }
|
||||
|
@ -1,5 +1,5 @@
|
||||
// rustfmt-normalize_comments: true
|
||||
// rustfmt-format_doc_comments: true
|
||||
// rustfmt-format_code_in_doc_comments: true
|
||||
|
||||
//! ```rust
|
||||
//! println!("hello, world");
|
||||
|
@ -1,5 +1,5 @@
|
||||
// rustfmt-normalize_comments: true
|
||||
// rustfmt-format_doc_comments: true
|
||||
// rustfmt-format_code_in_doc_comments: true
|
||||
|
||||
// Do not unindent macro calls in comment with unformattable syntax.
|
||||
//! ```rust
|
||||
|
@ -1,5 +1,5 @@
|
||||
// rustfmt-wrap_comments: true
|
||||
// rustfmt-format_doc_comments: true
|
||||
// rustfmt-format_code_in_doc_comments: true
|
||||
|
||||
/// Vestibulum elit nibh, rhoncus non, euismod sit amet, pretium eu, enim. Nunc
|
||||
/// commodo ultricies dui.
|
||||
|
@ -1,5 +1,5 @@
|
||||
// rustfmt-normalize_comments: true
|
||||
// rustfmt-format_doc_comments: true
|
||||
// rustfmt-format_code_in_doc_comments: true
|
||||
|
||||
//! This is a list:
|
||||
//! * Outer
|
||||
|
@ -1,5 +1,5 @@
|
||||
// rustfmt-wrap_comments: true
|
||||
// rustfmt-format_doc_comments: true
|
||||
// rustfmt-format_code_in_doc_comments: true
|
||||
// rustfmt-max_width: 50
|
||||
|
||||
//! This is a list:
|
||||
|
Loading…
x
Reference in New Issue
Block a user