@@ -11,22 +11,10 @@ fn check_html_file(file: &Path) -> usize {
1111 // If a <span> contains only HTML elements and no text, it complains about it.
1212 "TRIM_EMPTY_ELEMENT" ,
1313 // FIXME: the three next warnings are about <pre> elements which are not supposed to
14- // contain HTML. The solution here would be to replace them with a <div> with
15- // ""
14+ // contain HTML. The solution here would be to replace them with a <div>
1615 "MISSING_ENDTAG_BEFORE" ,
1716 "INSERTING_TAG" ,
1817 "DISCARDING_UNEXPECTED" ,
19- // FIXME: mdbook repeats the name attribute on <input>. When the fix is merged upstream,
20- // this warning can be used again.
21- "REPEATED_ATTRIBUTE" ,
22- // FIXME: mdbook uses "align" attribute on <td>, which is not allowed.
23- "MISMATCHED_ATTRIBUTE_WARN" ,
24- // FIXME: mdbook doesn't add "alt" attribute on images.
25- "MISSING_ATTRIBUTE" ,
26- // FIXME: mdbook doesn't escape `&` (in "&String" for example).
27- "UNKNOWN_ENTITY" ,
28- // Compiler docs have some inlined <style> in the markdown.
29- "MOVED_STYLE_TO_HEAD" ,
3018 ] ;
3119 let to_mute_s = to_mute. join ( "," ) ;
3220 let mut command = Command :: new ( "tidy" ) ;
@@ -58,12 +46,21 @@ fn check_html_file(file: &Path) -> usize {
5846 }
5947}
6048
49+ const DOCS_TO_CHECK : & [ & str ] =
50+ & [ "alloc" , "core" , "proc_macro" , "implementors" , "src" , "std" , "test" ] ;
51+
6152// Returns the number of files read and the number of errors.
6253fn find_all_html_files ( dir : & Path ) -> ( usize , usize ) {
6354 let mut files_read = 0 ;
6455 let mut errors = 0 ;
6556
66- for entry in walkdir:: WalkDir :: new ( dir) {
57+ for entry in walkdir:: WalkDir :: new ( dir) . into_iter ( ) . filter_entry ( |e| {
58+ e. depth ( ) != 1
59+ || e. file_name ( )
60+ . to_str ( )
61+ . map ( |s| DOCS_TO_CHECK . into_iter ( ) . any ( |d| * d == s) )
62+ . unwrap_or ( false )
63+ } ) {
6764 let entry = entry. expect ( "failed to read file" ) ;
6865 if !entry. file_type ( ) . is_file ( ) {
6966 continue ;
0 commit comments