Fix non_local_definitions lint in rustdoc

This commit is contained in:
Urgau 2024-01-27 18:26:37 +01:00
parent 7b6057dea4
commit 6320ad0b07
2 changed files with 7 additions and 5 deletions

View file

@ -1208,6 +1208,13 @@ impl Tester for Collector {
}
}
#[cfg(test)] // used in tests
impl Tester for Vec<usize> {
fn add_test(&mut self, _test: String, _config: LangString, line: usize) {
self.push(line);
}
}
struct HirCollector<'a, 'hir, 'tcx> {
sess: &'a Session,
collector: &'a mut Collector,

View file

@ -480,11 +480,6 @@ fn test_markdown_html_escape() {
#[test]
fn test_find_testable_code_line() {
fn t(input: &str, expect: &[usize]) {
impl crate::doctest::Tester for Vec<usize> {
fn add_test(&mut self, _test: String, _config: LangString, line: usize) {
self.push(line);
}
}
let mut lines = Vec::<usize>::new();
find_testable_code(input, &mut lines, ErrorCodes::No, false, None, true);
assert_eq!(lines, expect);