Skip to content

Commit

Permalink
Don't emit an error on private doc tests when they're ignored
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeGomez committed Sep 12, 2020
1 parent 2e2e7de commit 2e7ca73
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions src/librustdoc/passes/doc_test_lints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use crate::clean;
use crate::clean::*;
use crate::core::DocContext;
use crate::fold::DocFolder;
use crate::html::markdown::{find_testable_code, ErrorCodes, LangString};
use crate::html::markdown::{find_testable_code, ErrorCodes, Ignore, LangString};
use rustc_session::lint;

pub const CHECK_PRIVATE_ITEMS_DOC_TESTS: Pass = Pass {
Expand Down Expand Up @@ -48,15 +48,11 @@ pub(crate) struct Tests {
pub(crate) found_tests: usize,
}

impl Tests {
pub(crate) fn new() -> Tests {
Tests { found_tests: 0 }
}
}

impl crate::doctest::Tester for Tests {
fn add_test(&mut self, _: String, _: LangString, _: usize) {
self.found_tests += 1;
fn add_test(&mut self, _: String, config: LangString, _: usize) {
if config.rust && config.ignore == Ignore::None {
self.found_tests += 1;
}
}
}

Expand Down Expand Up @@ -85,7 +81,7 @@ pub fn look_for_tests<'tcx>(cx: &DocContext<'tcx>, dox: &str, item: &Item) {
}
};

let mut tests = Tests::new();
let mut tests = Tests { found_tests: 0 };

find_testable_code(&dox, &mut tests, ErrorCodes::No, false, None);

Expand Down

0 comments on commit 2e7ca73

Please sign in to comment.