This commit is contained in:
Boshen 2024-06-21 12:42:24 +08:00
parent 47f08e0e10
commit 9668d4dcde
No known key found for this signature in database
GPG Key ID: 9C7A8C8AB22BEBD1
1 changed files with 12 additions and 12 deletions

View File

@ -215,18 +215,6 @@ mod tests {
}
}
#[derive(Error, Debug)]
#[error("outer")]
struct Outer {
pub(crate) errors: Vec<Inner>,
}
impl Diagnostic for Outer {
fn related<'a>(&'a self) -> Option<Box<dyn Iterator<Item = &'a dyn Diagnostic> + 'a>> {
Some(Box::new(self.errors.iter().map(|e| e as _)))
}
}
#[test]
fn no_override() {
let inner_source = "hello world";
@ -254,6 +242,18 @@ mod tests {
#[test]
#[cfg(feature = "fancy")]
fn two_source_codes() {
#[derive(Error, Debug)]
#[error("outer")]
struct Outer {
pub(crate) errors: Vec<Inner>,
}
impl Diagnostic for Outer {
fn related<'a>(&'a self) -> Option<Box<dyn Iterator<Item = &'a dyn Diagnostic> + 'a>> {
Some(Box::new(self.errors.iter().map(|e| e as _)))
}
}
let inner_source = "hello world";
let outer_source = "abc";