Skip to content

Commit

Permalink
Fix non_local_definitions lint in rustdoc
Browse files Browse the repository at this point in the history
  • Loading branch information
Urgau committed Feb 17, 2024
1 parent 7b6057d commit 6320ad0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
7 changes: 7 additions & 0 deletions src/librustdoc/doctest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
5 changes: 0 additions & 5 deletions src/librustdoc/html/markdown/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 6320ad0

Please sign in to comment.