Skip to content

Commit

Permalink
Auto merge of rust-lang#13571 - Alexendoo:website-code-indent, r=Centri3
Browse files Browse the repository at this point in the history
Fix indentation of website code snippets

Fixes rust-lang#13568

Follow up to rust-lang#13359, I didn't catch that it swapped the `strip_prefix` out for a `trim` but they aren't interchangeable here

changelog: none
  • Loading branch information
bors committed Oct 26, 2024
2 parents 9cf416d + 2666ed6 commit 3caff99
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion clippy_config/src/conf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,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") {
Expand Down

0 comments on commit 3caff99

Please sign in to comment.