File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -102,8 +102,9 @@ pub fn sanitize_explanation(raw_docs: &str) -> String {
102102 // Remove tags and hidden code:
103103 let mut explanation = String :: with_capacity ( 128 ) ;
104104 let mut in_code = false ;
105- for line in raw_docs. lines ( ) . map ( str:: trim) {
106- if let Some ( lang) = line. strip_prefix ( "```" ) {
105+ for line in raw_docs. lines ( ) {
106+ let trimmed_line = line. trim ( ) ;
107+ if let Some ( lang) = trimmed_line. strip_prefix ( "```" ) {
107108 let tag = lang. split_once ( ',' ) . map_or ( lang, |( left, _) | left) ;
108109 if !in_code && matches ! ( tag, "" | "rust" | "ignore" | "should_panic" | "no_run" | "compile_fail" ) {
109110 explanation += "```rust\n " ;
@@ -112,7 +113,7 @@ pub fn sanitize_explanation(raw_docs: &str) -> String {
112113 explanation. push ( '\n' ) ;
113114 }
114115 in_code = !in_code;
115- } else if !( in_code && line . starts_with ( "# " ) ) {
116+ } else if !( in_code && trimmed_line . starts_with ( "# " ) ) {
116117 explanation += line;
117118 explanation. push ( '\n' ) ;
118119 }
You can’t perform that action at this time.
0 commit comments