[ty_test] Change match_line to take slice of CheckOutput

Update match_line signature to accept &[CheckOutput] instead of
&LineCheckOutputs for consistency with the previous API that took
&[Diagnostic].

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Douglas Creager 2025-10-08 14:47:45 -04:00
parent b683da8cde
commit adf58b6c19
1 changed files with 4 additions and 4 deletions

View File

@ -12,7 +12,7 @@ use ruff_db::source::{SourceText, line_index, source_text};
use ruff_source_file::{LineIndex, OneIndexed}; use ruff_source_file::{LineIndex, OneIndexed};
use crate::assertion::{InlineFileAssertions, ParsedAssertion, UnparsedAssertion}; use crate::assertion::{InlineFileAssertions, ParsedAssertion, UnparsedAssertion};
use crate::check_output::{CheckOutput, LineCheckOutputs, SortedCheckOutputs}; use crate::check_output::{CheckOutput, SortedCheckOutputs};
use crate::hover::HoverOutput; use crate::hover::HoverOutput;
use crate::db::Db; use crate::db::Db;
@ -81,7 +81,7 @@ pub(super) fn match_file(
// matches and error on any that don't match, then advance both // matches and error on any that don't match, then advance both
// iterators. // iterators.
matcher matcher
.match_line(outputs, assertions) .match_line(outputs.outputs, assertions)
.unwrap_or_else(|messages| { .unwrap_or_else(|messages| {
failures.push(assertions.line_number, messages); failures.push(assertions.line_number, messages);
}); });
@ -267,14 +267,14 @@ impl Matcher {
/// assertions. /// assertions.
fn match_line<'a, 'b>( fn match_line<'a, 'b>(
&self, &self,
outputs: &LineCheckOutputs<'a>, outputs: &'a [CheckOutput],
assertions: &'a [UnparsedAssertion<'b>], assertions: &'a [UnparsedAssertion<'b>],
) -> Result<(), Vec<String>> ) -> Result<(), Vec<String>>
where where
'b: 'a, 'b: 'a,
{ {
let mut failures = vec![]; let mut failures = vec![];
let mut unmatched: Vec<&CheckOutput> = outputs.outputs.iter().collect(); let mut unmatched: Vec<&CheckOutput> = outputs.iter().collect();
for assertion in assertions { for assertion in assertions {
match assertion.parse(&self.line_index, &self.source) { match assertion.parse(&self.line_index, &self.source) {
Ok(assertion) => { Ok(assertion) => {