1
Fork 0

Rename HeaderLine to DirectiveLine

This commit is contained in:
Zalathar 2024-10-12 16:37:27 +11:00
parent 6b9676b454
commit 4d59c33780

View file

@ -57,7 +57,7 @@ impl EarlyProps {
&mut poisoned, &mut poisoned,
testfile, testfile,
rdr, rdr,
&mut |HeaderLine { directive: ln, .. }| { &mut |DirectiveLine { directive: ln, .. }| {
parse_and_update_aux(config, ln, &mut props.aux); parse_and_update_aux(config, ln, &mut props.aux);
config.parse_and_update_revisions(ln, &mut props.revisions); config.parse_and_update_revisions(ln, &mut props.revisions);
}, },
@ -344,7 +344,7 @@ impl TestProps {
&mut poisoned, &mut poisoned,
testfile, testfile,
file, file,
&mut |HeaderLine { header_revision, directive: ln, .. }| { &mut |DirectiveLine { header_revision, directive: ln, .. }| {
if header_revision.is_some() && header_revision != test_revision { if header_revision.is_some() && header_revision != test_revision {
return; return;
} }
@ -680,7 +680,7 @@ impl TestProps {
/// Extract an `(Option<line_revision>, directive)` directive from a line if comment is present. /// Extract an `(Option<line_revision>, directive)` directive from a line if comment is present.
/// ///
/// See [`HeaderLine`] for a diagram. /// See [`DirectiveLine`] for a diagram.
pub fn line_directive<'line>( pub fn line_directive<'line>(
comment: &str, comment: &str,
original_line: &'line str, original_line: &'line str,
@ -745,7 +745,7 @@ const KNOWN_JSONDOCCK_DIRECTIVE_NAMES: &[&str] =
/// ^^^^^^^^^^^^^^^^^ directive /// ^^^^^^^^^^^^^^^^^ directive
/// ^^^^^^^^^^^^^^^^^^^^^^^^^^^ original_line /// ^^^^^^^^^^^^^^^^^^^^^^^^^^^ original_line
/// ``` /// ```
struct HeaderLine<'ln> { struct DirectiveLine<'ln> {
line_number: usize, line_number: usize,
/// Raw line from the test file, including comment prefix and any revision. /// Raw line from the test file, including comment prefix and any revision.
original_line: &'ln str, original_line: &'ln str,
@ -803,7 +803,7 @@ fn iter_header(
poisoned: &mut bool, poisoned: &mut bool,
testfile: &Path, testfile: &Path,
rdr: impl Read, rdr: impl Read,
it: &mut dyn FnMut(HeaderLine<'_>), it: &mut dyn FnMut(DirectiveLine<'_>),
) { ) {
if testfile.is_dir() { if testfile.is_dir() {
return; return;
@ -824,7 +824,12 @@ fn iter_header(
]; ];
// Process the extra implied directives, with a dummy line number of 0. // Process the extra implied directives, with a dummy line number of 0.
for directive in extra_directives { for directive in extra_directives {
it(HeaderLine { line_number: 0, original_line: "", header_revision: None, directive }); it(DirectiveLine {
line_number: 0,
original_line: "",
header_revision: None,
directive,
});
} }
} }
@ -897,7 +902,7 @@ fn iter_header(
} }
} }
it(HeaderLine { it(DirectiveLine {
line_number, line_number,
original_line, original_line,
header_revision, header_revision,
@ -1292,7 +1297,7 @@ pub fn make_test_description<R: Read>(
&mut local_poisoned, &mut local_poisoned,
path, path,
src, src,
&mut |HeaderLine { header_revision, original_line, directive: ln, line_number }| { &mut |DirectiveLine { header_revision, original_line, directive: ln, line_number }| {
if header_revision.is_some() && header_revision != test_revision { if header_revision.is_some() && header_revision != test_revision {
return; return;
} }