diff options
| author | Alex Macleod <alex@macleod.io> | 2024-10-20 19:02:40 +0000 |
|---|---|---|
| committer | Alex Macleod <alex@macleod.io> | 2024-10-20 19:02:40 +0000 |
| commit | 2666ed6c5bb1ba672ed1132737cf8e0870e2e9e9 (patch) | |
| tree | 92bf6b4e545693f100148ce023893f0d7a349a29 | |
| parent | 5678531c6d30fd50aeda2e6c652818c667fa5bd6 (diff) | |
| download | rust-2666ed6c5bb1ba672ed1132737cf8e0870e2e9e9.tar.gz rust-2666ed6c5bb1ba672ed1132737cf8e0870e2e9e9.zip | |
Fix indentation of website code snippets
| -rw-r--r-- | clippy_config/src/conf.rs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/clippy_config/src/conf.rs b/clippy_config/src/conf.rs index 4757c0b1339..64032ccdad2 100644 --- a/clippy_config/src/conf.rs +++ b/clippy_config/src/conf.rs @@ -102,7 +102,9 @@ pub fn sanitize_explanation(raw_docs: &str) -> String { // Remove tags and hidden code: let mut explanation = String::with_capacity(128); let mut in_code = false; - for line in raw_docs.lines().map(str::trim) { + for line in raw_docs.lines() { + let line = line.strip_prefix(' ').unwrap_or(line); + if let Some(lang) = line.strip_prefix("```") { let tag = lang.split_once(',').map_or(lang, |(left, _)| left); if !in_code && matches!(tag, "" | "rust" | "ignore" | "should_panic" | "no_run" | "compile_fail") { |
