about summary refs log tree commit diff
path: root/clippy_lints
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-07-31 11:11:39 +0000
committerbors <bors@rust-lang.org>2024-07-31 11:11:39 +0000
commitea06fa326d57da2ec9c018e189a31c6beb8ee4cd (patch)
treec24c71b0e3a8171c4d53aed6253d5206d6aaaf01 /clippy_lints
parentc6f45df3c173456dab6b73e3660cda1c9d3683ee (diff)
parent712e8f4f48ad64fc33bc759c82cbe0d3cacb1d0f (diff)
Auto merge of #13177 - GuillaumeGomez:fix-broken-list-lints-config, r=xFrednet
Fix broken list for lints config

Follow-up of #13166.

Finally figured out that it was a transformation and not the source that was the problem. It now looks like this:

![Screenshot from 2024-07-29 16-29-10](https://github.com/user-attachments/assets/4b89b3fe-8f85-47b8-8d9a-505badeaeac4)

r? `@xFrednet`

changelog: none
Diffstat (limited to 'clippy_lints')
-rw-r--r--clippy_lints/src/utils/internal_lints/metadata_collector.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/clippy_lints/src/utils/internal_lints/metadata_collector.rs b/clippy_lints/src/utils/internal_lints/metadata_collector.rs
index b5a772e7a81..2fc66c56036 100644
--- a/clippy_lints/src/utils/internal_lints/metadata_collector.rs
+++ b/clippy_lints/src/utils/internal_lints/metadata_collector.rs
@@ -684,6 +684,11 @@ fn cleanup_docs(docs_collection: &Vec<String>) -> String {
                     .find(|&s| !matches!(s, "" | "ignore" | "no_run" | "should_panic"))
                     // if no language is present, fill in "rust"
                     .unwrap_or("rust");
+                let len_diff = line.len() - line.trim_start().len();
+                if len_diff != 0 {
+                    // We put back the indentation.
+                    docs.push_str(&line[..len_diff]);
+                }
                 docs.push_str("```");
                 docs.push_str(lang);