Add regression test for issue 1969
This commit is contained in:
parent
b054ea4105
commit
6699b0bc40
@ -7,6 +7,7 @@
|
|||||||
#![allow(
|
#![allow(
|
||||||
unknown_lints,
|
unknown_lints,
|
||||||
mixed_script_confusables,
|
mixed_script_confusables,
|
||||||
|
clippy::ptr_arg,
|
||||||
clippy::trivially_copy_pass_by_ref
|
clippy::trivially_copy_pass_by_ref
|
||||||
)]
|
)]
|
||||||
|
|
||||||
@ -735,6 +736,12 @@ fn test_gen() {
|
|||||||
#[serde(borrow = "'a")]
|
#[serde(borrow = "'a")]
|
||||||
f: mac!(Cow<'a, str>),
|
f: mac!(Cow<'a, str>),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Serialize)]
|
||||||
|
struct Struct {
|
||||||
|
#[serde(serialize_with = "vec_first_element")]
|
||||||
|
vec: Vec<Self>,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
@ -808,3 +815,11 @@ where
|
|||||||
pub fn is_zero(n: &u8) -> bool {
|
pub fn is_zero(n: &u8) -> bool {
|
||||||
*n == 0
|
*n == 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn vec_first_element<T, S>(vec: &Vec<T>, serializer: S) -> StdResult<S::Ok, S::Error>
|
||||||
|
where
|
||||||
|
T: Serialize,
|
||||||
|
S: Serializer,
|
||||||
|
{
|
||||||
|
vec.first().serialize(serializer)
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user