diff options
| author | bors <bors@rust-lang.org> | 2024-07-31 11:11:39 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2024-07-31 11:11:39 +0000 |
| commit | ea06fa326d57da2ec9c018e189a31c6beb8ee4cd (patch) | |
| tree | c24c71b0e3a8171c4d53aed6253d5206d6aaaf01 | |
| parent | c6f45df3c173456dab6b73e3660cda1c9d3683ee (diff) | |
| parent | 712e8f4f48ad64fc33bc759c82cbe0d3cacb1d0f (diff) | |
| download | rust-ea06fa326d57da2ec9c018e189a31c6beb8ee4cd.tar.gz rust-ea06fa326d57da2ec9c018e189a31c6beb8ee4cd.zip | |
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:  r? `@xFrednet` changelog: none
| -rw-r--r-- | clippy_config/src/metadata.rs | 2 | ||||
| -rw-r--r-- | clippy_lints/src/utils/internal_lints/metadata_collector.rs | 5 |
2 files changed, 6 insertions, 1 deletions
diff --git a/clippy_config/src/metadata.rs b/clippy_config/src/metadata.rs index 9261fca8870..7cbd92a9b71 100644 --- a/clippy_config/src/metadata.rs +++ b/clippy_config/src/metadata.rs @@ -14,7 +14,7 @@ impl fmt::Display for ClippyConfiguration { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "- `{}`: {}", self.name, self.doc)?; if !self.default.is_empty() { - write!(f, "\n\n(default: `{}`)", self.default)?; + write!(f, "\n\n (default: `{}`)", self.default)?; } Ok(()) } 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); |
