INNER CODE UNIT · Rust
duplicate_test_definition
stjude-rust-labs/sprocket · crates/sprocket-test-types/src/lib.rs:44
fn duplicate_test_definition(first: &Spanned<Value>, duplicate: &Spanned<Value>) -> Diagnostic {
let Value::String(name) = &first.0.value else {
unreachable!("should be validated beforehand")
};
Diagnostic::error(format!("the name `{name}` is defined multiple times"))
.with_label(
"first definition here",
convert_yaml_span(first.0.defined.span()),
)
.with_label(
format!("`{name}` redefined here",),
convert_yaml_span(duplicate.0.defined.span()),
)
}
/// The parser expected a YAML mapping.
fn expected_mapping(field: &Spanned<String>) -> Diagnostic {
Diagnostic::error(format!(