@@ -19,6 +19,13 @@ impl Lint {
1919 fn doc_contains ( & self , text : & str ) -> bool {
2020 self . doc . iter ( ) . any ( |line| line. contains ( text) )
2121 }
22+
23+ fn is_ignored ( & self ) -> bool {
24+ self . doc
25+ . iter ( )
26+ . filter ( |line| line. starts_with ( "```rust" ) )
27+ . all ( |line| line. contains ( ",ignore" ) )
28+ }
2229}
2330
2431#[ derive( Clone , Copy , PartialEq ) ]
@@ -208,13 +215,8 @@ fn generate_output_example(
208215 // try to avoid adding to this list.
209216 if matches ! (
210217 lint. name. as_str( ) ,
211- "unused_features"
212- | "unstable_features"
213- | "incomplete_include"
214- | "unused_crate_dependencies"
215- | "exported_private_dependencies"
216- | "proc_macro_derive_resolution_fallback"
217- | "macro_use_extern_crate"
218+ "unused_features" // broken lint
219+ | "unstable_features" // deprecated
218220 ) {
219221 return Ok ( ( ) ) ;
220222 }
@@ -223,13 +225,22 @@ fn generate_output_example(
223225 return Ok ( ( ) ) ;
224226 }
225227 check_style ( lint) ?;
226- replace_produces ( lint, rustc_path, verbose) ?;
228+ // Unfortunately some lints have extra requirements that this simple test
229+ // setup can't handle (like extern crates). An alternative is to use a
230+ // separate test suite, and use an include mechanism such as mdbook's
231+ // `{{#rustdoc_include}}`.
232+ if !lint. is_ignored ( ) {
233+ replace_produces ( lint, rustc_path, verbose) ?;
234+ }
227235 Ok ( ( ) )
228236}
229237
230238/// Checks the doc style of the lint.
231239fn check_style ( lint : & Lint ) -> Result < ( ) , Box < dyn Error > > {
232- for expected in & [ "### Example" , "### Explanation" , "{{produces}}" ] {
240+ for & expected in & [ "### Example" , "### Explanation" , "{{produces}}" ] {
241+ if expected == "{{produces}}" && lint. is_ignored ( ) {
242+ continue ;
243+ }
233244 if !lint. doc_contains ( expected) {
234245 return Err ( format ! ( "lint docs should contain the line `{}`" , expected) . into ( ) ) ;
235246 }
0 commit comments