about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-12-28 13:53:34 +0000
committerbors <bors@rust-lang.org>2022-12-28 13:53:34 +0000
commit266eef77011234af6e612cf2bf22441112f1f90e (patch)
treeb2e1e978f585a2d5279333b0e19875502dcaec33
parentd98e714988d9beebe416c6e3808e4173d928c5ed (diff)
parentfae19a9a79ad275af9e9f2ee5ad15404a9a1bbf7 (diff)
downloadrust-266eef77011234af6e612cf2bf22441112f1f90e.tar.gz
rust-266eef77011234af6e612cf2bf22441112f1f90e.zip
Auto merge of #10119 - koka831:doc/config-default-value, r=xFrednet
fix codeblocks in the document

While I've looked into https://github.com/rust-lang/rust-clippy/issues/9990, I found broken code blocks in the document.

This patch not only improves visibility, but also fixes a potential bug. When a lint description ends with code block, the string will have three backquotes at the end.
Since the current implementation prints the default value immediately after that, the markdown renderer is unable to properly close the code block.

e.g. `arithmetic_side_effects`, we can see code block is not rendered properly, and (I think) it's bit hard to understand what ``"defaults to `[]`"`` is meant.

![2022-12-26_01-51](https://user-images.githubusercontent.com/14945055/209476342-4d0b2e18-44b6-4c74-8c3c-4f4f0904e8ca.png)

In this PR, it will be rendered as:

![image](https://user-images.githubusercontent.com/14945055/209476353-07587b86-1100-445f-946d-41f62f741e51.png)

changelog: none

r? `@xFrednet`
-rw-r--r--clippy_lints/src/utils/internal_lints/metadata_collector.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/clippy_lints/src/utils/internal_lints/metadata_collector.rs b/clippy_lints/src/utils/internal_lints/metadata_collector.rs
index 857abe77e21..929544cd69d 100644
--- a/clippy_lints/src/utils/internal_lints/metadata_collector.rs
+++ b/clippy_lints/src/utils/internal_lints/metadata_collector.rs
@@ -558,8 +558,8 @@ impl fmt::Display for ClippyConfiguration {
     fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> fmt::Result {
         writeln!(
             f,
-            "* `{}`: `{}`: {} (defaults to `{}`)",
-            self.name, self.config_type, self.doc, self.default
+            "* `{}`: `{}`(defaults to `{}`): {}",
+            self.name, self.config_type, self.default, self.doc
         )
     }
 }