From d6c8b6b0221304ec103daf19e0cd2b047e19c980 Mon Sep 17 00:00:00 2001 From: Graham Esau Date: Fri, 30 Aug 2024 11:12:23 +0100 Subject: [PATCH] Fix ui tests in nightly --- .vscode/settings.json | 3 ++- schemars/tests/ui/repr_non_unit_variant.stderr | 2 +- schemars_derive/src/schema_exprs.rs | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index cee136f..d1f8d25 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,4 +1,5 @@ { "rust-analyzer.check.command": "clippy", - "rust-analyzer.cargo.features": "all" + "rust-analyzer.cargo.features": "all", + "rust-analyzer.testExplorer": true } diff --git a/schemars/tests/ui/repr_non_unit_variant.stderr b/schemars/tests/ui/repr_non_unit_variant.stderr index eb34039..68afabf 100644 --- a/schemars/tests/ui/repr_non_unit_variant.stderr +++ b/schemars/tests/ui/repr_non_unit_variant.stderr @@ -2,4 +2,4 @@ error: JsonSchema_repr: must be a unit variant --> $DIR/repr_non_unit_variant.rs:7:5 | 7 | EmptyTuple(), - | ^^^^^^^^^^ + | ^^^^^^^^^^^^ diff --git a/schemars_derive/src/schema_exprs.rs b/schemars_derive/src/schema_exprs.rs index 5fa8e67..976bbe0 100644 --- a/schemars_derive/src/schema_exprs.rs +++ b/schemars_derive/src/schema_exprs.rs @@ -81,8 +81,8 @@ pub fn expr_for_repr(cont: &Container) -> Result { if let Some(non_unit_error) = variants.iter().find_map(|v| match v.style { Style::Unit => None, - _ => Some(syn::Error::new( - v.original.span(), + _ => Some(syn::Error::new_spanned( + v.original, "JsonSchema_repr: must be a unit variant", )), }) {