Un-wrap error message strings for better grepping
This commit is contained in:
parent
b86a46c83c
commit
7ab12597bb
@ -335,8 +335,7 @@ impl Container {
|
||||
Err(()) => cx.error_spanned_by(
|
||||
s,
|
||||
format!(
|
||||
"unknown rename rule for #[serde(rename_all \
|
||||
= {:?})]",
|
||||
"unknown rename rule for #[serde(rename_all = {:?})]",
|
||||
s.value(),
|
||||
),
|
||||
),
|
||||
@ -355,8 +354,7 @@ impl Container {
|
||||
Err(()) => cx.error_spanned_by(
|
||||
ser,
|
||||
format!(
|
||||
"unknown rename rule for #[serde(rename_all \
|
||||
= {:?})]",
|
||||
"unknown rename rule for #[serde(rename_all = {:?})]",
|
||||
ser.value(),
|
||||
),
|
||||
),
|
||||
@ -368,8 +366,7 @@ impl Container {
|
||||
Err(()) => cx.error_spanned_by(
|
||||
de,
|
||||
format!(
|
||||
"unknown rename rule for #[serde(rename_all \
|
||||
= {:?})]",
|
||||
"unknown rename rule for #[serde(rename_all = {:?})]",
|
||||
de.value(),
|
||||
),
|
||||
),
|
||||
@ -396,22 +393,19 @@ impl Container {
|
||||
}
|
||||
syn::Fields::Unnamed(_) | syn::Fields::Unit => cx.error_spanned_by(
|
||||
fields,
|
||||
"#[serde(default)] can only be used on structs \
|
||||
with named fields",
|
||||
"#[serde(default)] can only be used on structs with named fields",
|
||||
),
|
||||
},
|
||||
syn::Data::Enum(syn::DataEnum { ref enum_token, .. }) => cx
|
||||
.error_spanned_by(
|
||||
enum_token,
|
||||
"#[serde(default)] can only be used on structs \
|
||||
with named fields",
|
||||
"#[serde(default)] can only be used on structs with named fields",
|
||||
),
|
||||
syn::Data::Union(syn::DataUnion {
|
||||
ref union_token, ..
|
||||
}) => cx.error_spanned_by(
|
||||
union_token,
|
||||
"#[serde(default)] can only be used on structs \
|
||||
with named fields",
|
||||
"#[serde(default)] can only be used on structs with named fields",
|
||||
),
|
||||
},
|
||||
|
||||
@ -427,23 +421,20 @@ impl Container {
|
||||
syn::Fields::Unnamed(_) | syn::Fields::Unit => cx
|
||||
.error_spanned_by(
|
||||
fields,
|
||||
"#[serde(default = \"...\")] can only be used \
|
||||
on structs with named fields",
|
||||
"#[serde(default = \"...\")] can only be used on structs with named fields",
|
||||
),
|
||||
}
|
||||
}
|
||||
syn::Data::Enum(syn::DataEnum { ref enum_token, .. }) => cx
|
||||
.error_spanned_by(
|
||||
enum_token,
|
||||
"#[serde(default = \"...\")] can only be used \
|
||||
on structs with named fields",
|
||||
"#[serde(default = \"...\")] can only be used on structs with named fields",
|
||||
),
|
||||
syn::Data::Union(syn::DataUnion {
|
||||
ref union_token, ..
|
||||
}) => cx.error_spanned_by(
|
||||
union_token,
|
||||
"#[serde(default = \"...\")] can only be used \
|
||||
on structs with named fields",
|
||||
"#[serde(default = \"...\")] can only be used on structs with named fields",
|
||||
),
|
||||
}
|
||||
}
|
||||
@ -504,8 +495,7 @@ impl Container {
|
||||
syn::Fields::Unnamed(_) | syn::Fields::Unit => {
|
||||
cx.error_spanned_by(
|
||||
fields,
|
||||
"#[serde(tag = \"...\")] can only be used on enums \
|
||||
and structs with named fields",
|
||||
"#[serde(tag = \"...\")] can only be used on enums and structs with named fields",
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -515,8 +505,7 @@ impl Container {
|
||||
}) => {
|
||||
cx.error_spanned_by(
|
||||
union_token,
|
||||
"#[serde(tag = \"...\")] can only be used on enums \
|
||||
and structs with named fields",
|
||||
"#[serde(tag = \"...\")] can only be used on enums and structs with named fields",
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -734,8 +723,7 @@ fn decide_tag(
|
||||
if fields.unnamed.len() != 1 {
|
||||
cx.error_spanned_by(
|
||||
variant,
|
||||
"#[serde(tag = \"...\")] cannot be used with tuple \
|
||||
variants",
|
||||
"#[serde(tag = \"...\")] cannot be used with tuple variants",
|
||||
);
|
||||
break;
|
||||
}
|
||||
@ -947,8 +935,7 @@ impl Variant {
|
||||
Err(()) => cx.error_spanned_by(
|
||||
s,
|
||||
format!(
|
||||
"unknown rename rule for #[serde(rename_all \
|
||||
= {:?})]",
|
||||
"unknown rename rule for #[serde(rename_all = {:?})]",
|
||||
s.value()
|
||||
),
|
||||
),
|
||||
@ -967,8 +954,7 @@ impl Variant {
|
||||
Err(()) => cx.error_spanned_by(
|
||||
ser,
|
||||
format!(
|
||||
"unknown rename rule for #[serde(rename_all \
|
||||
= {:?})]",
|
||||
"unknown rename rule for #[serde(rename_all = {:?})]",
|
||||
ser.value(),
|
||||
),
|
||||
),
|
||||
@ -980,8 +966,7 @@ impl Variant {
|
||||
Err(()) => cx.error_spanned_by(
|
||||
de,
|
||||
format!(
|
||||
"unknown rename rule for #[serde(rename_all \
|
||||
= {:?})]",
|
||||
"unknown rename rule for #[serde(rename_all = {:?})]",
|
||||
de.value(),
|
||||
),
|
||||
),
|
||||
@ -1587,8 +1572,7 @@ where
|
||||
cx.error_spanned_by(
|
||||
meta,
|
||||
format!(
|
||||
"malformed {0} attribute, expected `{0}(serialize = ..., \
|
||||
deserialize = ...)`",
|
||||
"malformed {0} attribute, expected `{0}(serialize = ..., deserialize = ...)`",
|
||||
attr_name
|
||||
),
|
||||
);
|
||||
|
@ -32,8 +32,7 @@ fn check_getter(cx: &Ctxt, cont: &Container) {
|
||||
if cont.data.has_getter() && cont.attrs.remote().is_none() {
|
||||
cx.error_spanned_by(
|
||||
cont.original,
|
||||
"#[serde(getter = \"...\")] can only be used in structs \
|
||||
that have #[serde(remote = \"...\")]",
|
||||
"#[serde(getter = \"...\")] can only be used in structs that have #[serde(remote = \"...\")]",
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -183,8 +182,7 @@ fn check_variant_skip_attrs(cx: &Ctxt, cont: &Container) {
|
||||
cx.error_spanned_by(
|
||||
variant.original,
|
||||
format!(
|
||||
"variant `{}` cannot have both #[serde(serialize_with)] and \
|
||||
#[serde(skip_serializing)]",
|
||||
"variant `{}` cannot have both #[serde(serialize_with)] and #[serde(skip_serializing)]",
|
||||
variant.ident
|
||||
),
|
||||
);
|
||||
@ -197,8 +195,7 @@ fn check_variant_skip_attrs(cx: &Ctxt, cont: &Container) {
|
||||
cx.error_spanned_by(
|
||||
variant.original,
|
||||
format!(
|
||||
"variant `{}` cannot have both #[serde(serialize_with)] and \
|
||||
a field {} marked with #[serde(skip_serializing)]",
|
||||
"variant `{}` cannot have both #[serde(serialize_with)] and a field {} marked with #[serde(skip_serializing)]",
|
||||
variant.ident, member
|
||||
),
|
||||
);
|
||||
@ -208,8 +205,7 @@ fn check_variant_skip_attrs(cx: &Ctxt, cont: &Container) {
|
||||
cx.error_spanned_by(
|
||||
variant.original,
|
||||
format!(
|
||||
"variant `{}` cannot have both #[serde(serialize_with)] and \
|
||||
a field {} marked with #[serde(skip_serializing_if)]",
|
||||
"variant `{}` cannot have both #[serde(serialize_with)] and a field {} marked with #[serde(skip_serializing_if)]",
|
||||
variant.ident, member
|
||||
),
|
||||
);
|
||||
@ -222,8 +218,7 @@ fn check_variant_skip_attrs(cx: &Ctxt, cont: &Container) {
|
||||
cx.error_spanned_by(
|
||||
variant.original,
|
||||
format!(
|
||||
"variant `{}` cannot have both #[serde(deserialize_with)] and \
|
||||
#[serde(skip_deserializing)]",
|
||||
"variant `{}` cannot have both #[serde(deserialize_with)] and #[serde(skip_deserializing)]",
|
||||
variant.ident
|
||||
),
|
||||
);
|
||||
@ -236,8 +231,7 @@ fn check_variant_skip_attrs(cx: &Ctxt, cont: &Container) {
|
||||
cx.error_spanned_by(
|
||||
variant.original,
|
||||
format!(
|
||||
"variant `{}` cannot have both #[serde(deserialize_with)] \
|
||||
and a field {} marked with #[serde(skip_deserializing)]",
|
||||
"variant `{}` cannot have both #[serde(deserialize_with)] and a field {} marked with #[serde(skip_deserializing)]",
|
||||
variant.ident, member
|
||||
),
|
||||
);
|
||||
|
Loading…
x
Reference in New Issue
Block a user