@@ -11,22 +11,10 @@ fn check_html_file(file: &Path) -> usize {
11
11
// If a <span> contains only HTML elements and no text, it complains about it.
12
12
"TRIM_EMPTY_ELEMENT" ,
13
13
// 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>
16
15
"MISSING_ENDTAG_BEFORE" ,
17
16
"INSERTING_TAG" ,
18
17
"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" ,
30
18
] ;
31
19
let to_mute_s = to_mute. join ( "," ) ;
32
20
let mut command = Command :: new ( "tidy" ) ;
@@ -58,12 +46,21 @@ fn check_html_file(file: &Path) -> usize {
58
46
}
59
47
}
60
48
49
+ const DOCS_TO_CHECK : & [ & str ] =
50
+ & [ "alloc" , "core" , "proc_macro" , "implementors" , "src" , "std" , "test" ] ;
51
+
61
52
// Returns the number of files read and the number of errors.
62
53
fn find_all_html_files ( dir : & Path ) -> ( usize , usize ) {
63
54
let mut files_read = 0 ;
64
55
let mut errors = 0 ;
65
56
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
+ } ) {
67
64
let entry = entry. expect ( "failed to read file" ) ;
68
65
if !entry. file_type ( ) . is_file ( ) {
69
66
continue ;
0 commit comments