INNER CODE UNIT · Rust

unknown_field

stjude-rust-labs/sprocket · crates/sprocket-test-types/src/lib.rs:39

fn unknown_field(span: serde_saphyr::Span, field: &str) -> Diagnostic {
    Diagnostic::warning(format!("unknown field `{field}`")).with_highlight(convert_yaml_span(span))
}

/// A target has multiple test definitions with the same name.
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()),
        )

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…