Remove unnecessary Deserializer lifetime

This commit is contained in:
Dirkjan Ochtman 2022-11-26 14:56:33 -08:00
parent 508d29ccaa
commit c24d2cdaac
3 changed files with 14 additions and 14 deletions

View File

@ -56,7 +56,7 @@ fn deserialize_scalar_enum(
quote!( quote!(
impl #impl_generics FromXml<'xml> for #ident #ty_generics #where_clause { impl #impl_generics FromXml<'xml> for #ident #ty_generics #where_clause {
fn deserialize<'cx>( fn deserialize<'cx>(
deserializer: &'cx mut ::instant_xml::Deserializer<'cx, 'xml>, deserializer: &mut ::instant_xml::Deserializer<'cx, 'xml>,
into: &mut Option<Self>, into: &mut Option<Self>,
) -> Result<(), ::instant_xml::Error> { ) -> Result<(), ::instant_xml::Error> {
use ::instant_xml::Error; use ::instant_xml::Error;
@ -138,7 +138,7 @@ fn deserialize_wrapped_enum(
quote!( quote!(
impl #xml_impl_generics FromXml<'xml> for #ident #ty_generics #where_clause { impl #xml_impl_generics FromXml<'xml> for #ident #ty_generics #where_clause {
fn deserialize<'cx>( fn deserialize<'cx>(
deserializer: &'cx mut ::instant_xml::Deserializer<'cx, 'xml>, deserializer: &mut ::instant_xml::Deserializer<'cx, 'xml>,
into: &mut Option<Self>, into: &mut Option<Self>,
) -> Result<(), ::instant_xml::Error> { ) -> Result<(), ::instant_xml::Error> {
use ::instant_xml::de::Node; use ::instant_xml::de::Node;
@ -245,7 +245,7 @@ fn deserialize_struct(
quote!( quote!(
impl #xml_impl_generics FromXml<'xml> for #ident #ty_generics #where_clause { impl #xml_impl_generics FromXml<'xml> for #ident #ty_generics #where_clause {
fn deserialize<'cx>( fn deserialize<'cx>(
deserializer: &'cx mut ::instant_xml::Deserializer<'cx, 'xml>, deserializer: &mut ::instant_xml::Deserializer<'cx, 'xml>,
into: &mut Option<Self>, into: &mut Option<Self>,
) -> Result<(), ::instant_xml::Error> { ) -> Result<(), ::instant_xml::Error> {
use ::instant_xml::de::Node; use ::instant_xml::de::Node;
@ -414,7 +414,7 @@ fn deserialize_tuple_struct(
quote!( quote!(
impl #xml_impl_generics FromXml<'xml> for #ident #ty_generics #where_clause { impl #xml_impl_generics FromXml<'xml> for #ident #ty_generics #where_clause {
fn deserialize<'cx>( fn deserialize<'cx>(
deserializer: &'cx mut ::instant_xml::Deserializer<'cx, 'xml>, deserializer: &mut ::instant_xml::Deserializer<'cx, 'xml>,
into: &mut Option<Self>, into: &mut Option<Self>,
) -> Result<(), ::instant_xml::Error> { ) -> Result<(), ::instant_xml::Error> {
use ::instant_xml::de::Node; use ::instant_xml::de::Node;
@ -488,7 +488,7 @@ fn deserialize_unit_struct(input: &syn::DeriveInput, meta: &ContainerMeta) -> To
quote!( quote!(
impl #xml_impl_generics FromXml<'xml> for #ident #ty_generics #where_clause { impl #xml_impl_generics FromXml<'xml> for #ident #ty_generics #where_clause {
fn deserialize<'cx>( fn deserialize<'cx>(
deserializer: &'cx mut ::instant_xml::Deserializer<'cx, 'xml>, deserializer: &mut ::instant_xml::Deserializer<'cx, 'xml>,
into: &mut Option<Self>, into: &mut Option<Self>,
) -> Result<(), ::instant_xml::Error> { ) -> Result<(), ::instant_xml::Error> {
deserializer.ignore()?; deserializer.ignore()?;

View File

@ -34,7 +34,7 @@ impl<'xml, T: FromStr> FromXml<'xml> for FromXmlStr<T> {
impl<'xml> FromXml<'xml> for bool { impl<'xml> FromXml<'xml> for bool {
fn deserialize<'cx>( fn deserialize<'cx>(
deserializer: &'cx mut Deserializer<'cx, 'xml>, deserializer: &mut Deserializer<'cx, 'xml>,
into: &mut Option<Self>, into: &mut Option<Self>,
) -> Result<(), Error> { ) -> Result<(), Error> {
if into.is_some() { if into.is_some() {
@ -107,7 +107,7 @@ macro_rules! from_xml_for_number {
($typ:ty) => { ($typ:ty) => {
impl<'xml> FromXml<'xml> for $typ { impl<'xml> FromXml<'xml> for $typ {
fn deserialize<'cx>( fn deserialize<'cx>(
deserializer: &'cx mut Deserializer<'cx, 'xml>, deserializer: &mut Deserializer<'cx, 'xml>,
into: &mut Option<Self>, into: &mut Option<Self>,
) -> Result<(), Error> { ) -> Result<(), Error> {
if into.is_some() { if into.is_some() {
@ -145,7 +145,7 @@ from_xml_for_number!(f64);
impl<'xml> FromXml<'xml> for char { impl<'xml> FromXml<'xml> for char {
fn deserialize<'cx>( fn deserialize<'cx>(
deserializer: &'cx mut Deserializer<'cx, 'xml>, deserializer: &mut Deserializer<'cx, 'xml>,
into: &mut Option<Self>, into: &mut Option<Self>,
) -> Result<(), Error> { ) -> Result<(), Error> {
if into.is_some() { if into.is_some() {
@ -168,7 +168,7 @@ impl<'xml> FromXml<'xml> for char {
impl<'xml> FromXml<'xml> for String { impl<'xml> FromXml<'xml> for String {
fn deserialize<'cx>( fn deserialize<'cx>(
deserializer: &'cx mut Deserializer<'cx, 'xml>, deserializer: &mut Deserializer<'cx, 'xml>,
into: &mut Option<Self>, into: &mut Option<Self>,
) -> Result<(), Error> { ) -> Result<(), Error> {
if into.is_some() { if into.is_some() {
@ -191,7 +191,7 @@ impl<'xml> FromXml<'xml> for String {
impl<'xml> FromXml<'xml> for &'xml str { impl<'xml> FromXml<'xml> for &'xml str {
fn deserialize<'cx>( fn deserialize<'cx>(
deserializer: &'cx mut Deserializer<'cx, 'xml>, deserializer: &mut Deserializer<'cx, 'xml>,
into: &mut Option<Self>, into: &mut Option<Self>,
) -> Result<(), Error> { ) -> Result<(), Error> {
if into.is_some() { if into.is_some() {
@ -234,7 +234,7 @@ impl<'xml> FromXml<'xml> for Cow<'xml, str> {
impl<'xml, T: FromXml<'xml>> FromXml<'xml> for Option<T> { impl<'xml, T: FromXml<'xml>> FromXml<'xml> for Option<T> {
fn deserialize<'cx>( fn deserialize<'cx>(
deserializer: &'cx mut Deserializer<'cx, 'xml>, deserializer: &mut Deserializer<'cx, 'xml>,
into: &mut Option<Self>, into: &mut Option<Self>,
) -> Result<(), Error> { ) -> Result<(), Error> {
if into.is_some() { if into.is_some() {
@ -436,7 +436,7 @@ fn decode(input: &str) -> Cow<'_, str> {
impl<'xml, T: FromXml<'xml>> FromXml<'xml> for Vec<T> { impl<'xml, T: FromXml<'xml>> FromXml<'xml> for Vec<T> {
fn deserialize<'cx>( fn deserialize<'cx>(
deserializer: &'cx mut Deserializer<'cx, 'xml>, deserializer: &mut Deserializer<'cx, 'xml>,
into: &mut Option<Self>, into: &mut Option<Self>,
) -> Result<(), Error> { ) -> Result<(), Error> {
let mut value = None; let mut value = None;
@ -503,7 +503,7 @@ impl ToXml for DateTime<Utc> {
#[cfg(feature = "chrono")] #[cfg(feature = "chrono")]
impl<'xml> FromXml<'xml> for DateTime<Utc> { impl<'xml> FromXml<'xml> for DateTime<Utc> {
fn deserialize<'cx>( fn deserialize<'cx>(
deserializer: &'cx mut Deserializer<'cx, 'xml>, deserializer: &mut Deserializer<'cx, 'xml>,
into: &mut Option<Self>, into: &mut Option<Self>,
) -> Result<(), Error> { ) -> Result<(), Error> {
if into.is_some() { if into.is_some() {

View File

@ -37,7 +37,7 @@ impl<'a, T: ToXml + ?Sized> ToXml for &'a T {
pub trait FromXml<'xml>: Sized { pub trait FromXml<'xml>: Sized {
fn deserialize<'cx>( fn deserialize<'cx>(
deserializer: &'cx mut Deserializer<'cx, 'xml>, deserializer: &mut Deserializer<'cx, 'xml>,
into: &mut Option<Self>, into: &mut Option<Self>,
) -> Result<(), Error>; ) -> Result<(), Error>;