]> git.lizzy.rs Git - rust.git/commitdiff
Change config option from format_doc_comments to format_code_in_doc_comments.
authorxiongmao86 <xiongmao86dev@sina.com>
Mon, 6 May 2019 11:45:34 +0000 (19:45 +0800)
committerxiongmao86 <xiongmao86dev@sina.com>
Mon, 6 May 2019 11:45:34 +0000 (19:45 +0800)
17 files changed:
Configurations.md
src/comment.rs
src/config/mod.rs
tests/source/doc-comment-with-example.rs
tests/source/invalid-rust-code-in-doc-comment.rs
tests/source/issue-2520.rs
tests/source/issue-2523.rs
tests/source/issue-3055/original.rs
tests/source/itemized-blocks/no_wrap.rs
tests/source/itemized-blocks/wrap.rs
tests/target/doc-comment-with-example.rs
tests/target/invalid-rust-code-in-doc-comment.rs
tests/target/issue-2520.rs
tests/target/issue-2523.rs
tests/target/issue-3055/original.rs
tests/target/itemized-blocks/no_wrap.rs
tests/target/itemized-blocks/wrap.rs

index 7557b3637f13e8dffba6bbcd645f9409405ed0c1..dc91a3d255a7b8899322f40e82534f806b07d500 100644 (file)
@@ -1978,9 +1978,9 @@ fn main() {
 }
 ```
 
-## `format_doc_comments`
+## `format_code_in_doc_comments`
 
-Format doc comments.
+Format code snippet included in doc comments.
 
 - **Default value**: `false`
 - **Possible values**: `true`, `false`
index b8dcae2352103021fc0c569bae55f055e9871398..0a3062583c58a9cffef9d439ced48503ee62ad6b 100644 (file)
@@ -353,7 +353,7 @@ fn consume_same_line_comments(
             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 @@ fn handle_line(
                     _ => {
                         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)
                             {
index c0221e93e0259b5ca383a4df3ce63e50ba3a09fd..f04074e4f3284a12229eddba15a41e907d186587 100644 (file)
@@ -37,7 +37,7 @@
 
     // 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";
index 58d98acfa2556ea40a0dd115db04206ee6cde36a..e74ceefd195888fb0c7cebd8185d90bab051d329 100644 (file)
@@ -1,4 +1,4 @@
-// rustfmt-format_doc_comments: true
+// rustfmt-format_code_in_doc_comments: true
 
 /// Foo
 ///
index 6d33dcfce552920041d76dc92366605d898f7bac..835b0261b760b0ae8175c3d8481a0d251fb7cb3a 100644 (file)
@@ -1,4 +1,4 @@
-// rustfmt-format_doc_comments: true
+// rustfmt-format_code_in_doc_comments: true
 
 /// ```rust
 /// if (true) { … }
index 9ea522c4fe4e4d26a3a76054b51231d23976bda4..5a23f10430d1a6bdc935efbc794ed5bb2e92b4fd 100644 (file)
@@ -1,5 +1,5 @@
 // rustfmt-normalize_comments: true
-// rustfmt-format_doc_comments: true
+// rustfmt-format_code_in_doc_comments: true
 
 //! ```rust
 //! println!( "hello, world" );
index 71aed6ac5351e1ca7f329a98239db611cff408a3..491d5c38fc22a62dfeccf35f29d07746d01453d1 100644 (file)
@@ -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
index eaf00afa3d3879ce585e7325258ee8feff8079e5..ad505547ac022d62916614e422f6da118ba3a9d4 100644 (file)
@@ -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.
 ///
index a0c546ad18e146379cd3c4d0b9cba3667eeddfe5..a7b6a10a01050987eadd3f675862142afe2bf267 100644 (file)
@@ -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
index 14fc8daa2e9d374b16e0f9e2e01a43c12f7c50be..955cc698b79f29d444c9adbc8ae16b506211fd10 100644 (file)
@@ -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:
index bec931d13c7879f59386001135b84aa0565cb091..c5a4e779ea224c9b2e9932100f8d1d0713356a19 100644 (file)
@@ -1,4 +1,4 @@
-// rustfmt-format_doc_comments: true
+// rustfmt-format_code_in_doc_comments: true
 
 /// Foo
 ///
index 2593410a418922f9fc91dca88fc35cb0929f7b16..f8479d4e34514b1fb34895b31d487077fcff1764 100644 (file)
@@ -1,4 +1,4 @@
-// rustfmt-format_doc_comments: true
+// rustfmt-format_code_in_doc_comments: true
 
 /// ```rust
 /// if (true) { … }
index 7d22b2b665a70a2ef49410ac4931ba99b11f2b6b..7c134d3972ba7a928b788033fd98ce54810881b1 100644 (file)
@@ -1,5 +1,5 @@
 // rustfmt-normalize_comments: true
-// rustfmt-format_doc_comments: true
+// rustfmt-format_code_in_doc_comments: true
 
 //! ```rust
 //! println!("hello, world");
index c0118e53780392c3db67d086789a3477a9f11cd1..612f93249acf5728ba665f9aee401d328e380858 100644 (file)
@@ -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
index 1fb35d506820cdd5c2dbda67d04277c7327ccd7a..de27ccfb344e5c796231cd287b378be19ef4e80a 100644 (file)
@@ -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.
index a1f9c39a1150bbe0d18bf034121b29f8c1ef99d1..de885638272638d14ca369456a69b153d0c9a70b 100644 (file)
@@ -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
index 967a38b91ae8a9a0a222d8f074f62caa2aab36cf..a4907303c9e1bf159e507ff6c80af3bacd51877a 100644 (file)
@@ -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: