Even more absolute paths
This commit is contained in:
parent
b7ca574bb3
commit
a55d812441
@ -9,6 +9,7 @@ use collections::borrow::Cow;
|
||||
pub use core::default::Default;
|
||||
pub use core::fmt;
|
||||
pub use core::marker::PhantomData;
|
||||
pub use core::option::Option::{self, None, Some};
|
||||
pub use core::result::Result::{self, Ok, Err};
|
||||
|
||||
#[cfg(any(feature = "collections", feature = "std"))]
|
||||
|
@ -79,7 +79,7 @@ extern crate core as actual_core;
|
||||
#[cfg(feature = "std")]
|
||||
mod core {
|
||||
pub use std::{ops, hash, fmt, cmp, marker, mem, i8, i16, i32, i64, u8, u16, u32, u64, isize,
|
||||
usize, f32, f64, char, str, num, slice, iter, cell, default, result};
|
||||
usize, f32, f64, char, str, num, slice, iter, cell, default, result, option};
|
||||
#[cfg(feature = "unstable")]
|
||||
pub use actual_core::nonzero;
|
||||
}
|
||||
|
@ -209,7 +209,7 @@ fn deserialize_unit_struct(
|
||||
type Value = #type_ident;
|
||||
|
||||
fn expecting(&self, formatter: &mut _serde::export::fmt::Formatter) -> _serde::export::fmt::Result {
|
||||
formatter.write_str(#expecting)
|
||||
_serde::export::fmt::Formatter::write_str(formatter, #expecting)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
@ -278,10 +278,10 @@ fn deserialize_tuple(
|
||||
quote!(_serde::de::VariantVisitor::visit_tuple(visitor, #nfields, #visitor_expr))
|
||||
} else if nfields == 1 {
|
||||
let type_name = item_attrs.name().deserialize_name();
|
||||
quote!(deserializer.deserialize_newtype_struct(#type_name, #visitor_expr))
|
||||
quote!(_serde::Deserializer::deserialize_newtype_struct(deserializer, #type_name, #visitor_expr))
|
||||
} else {
|
||||
let type_name = item_attrs.name().deserialize_name();
|
||||
quote!(deserializer.deserialize_tuple_struct(#type_name, #nfields, #visitor_expr))
|
||||
quote!(_serde::Deserializer::deserialize_tuple_struct(deserializer, #type_name, #nfields, #visitor_expr))
|
||||
};
|
||||
|
||||
let all_skipped = fields.iter().all(|field| field.attrs.skip_deserializing());
|
||||
@ -298,7 +298,7 @@ fn deserialize_tuple(
|
||||
type Value = #ty;
|
||||
|
||||
fn expecting(&self, formatter: &mut _serde::export::fmt::Formatter) -> _serde::export::fmt::Result {
|
||||
formatter.write_str(#expecting)
|
||||
_serde::export::fmt::Formatter::write_str(formatter, #expecting)
|
||||
}
|
||||
|
||||
#visit_newtype_struct
|
||||
@ -341,7 +341,7 @@ fn deserialize_seq(
|
||||
let visit = match field.attrs.deserialize_with() {
|
||||
None => {
|
||||
let field_ty = &field.ty;
|
||||
quote!(try!(visitor.visit::<#field_ty>()))
|
||||
quote!(try!(_serde::de::SeqVisitor::visit::<#field_ty>(&mut visitor)))
|
||||
}
|
||||
Some(path) => {
|
||||
let (wrapper, wrapper_impl, wrapper_ty) = wrap_deserialize_with(
|
||||
@ -349,7 +349,8 @@ fn deserialize_seq(
|
||||
quote!({
|
||||
#wrapper
|
||||
#wrapper_impl
|
||||
try!(visitor.visit::<#wrapper_ty>()).map(|wrap| wrap.value)
|
||||
try!(_serde::de::SeqVisitor::visit::<#wrapper_ty>(&mut visitor))
|
||||
.map(|wrap| wrap.value)
|
||||
})
|
||||
}
|
||||
};
|
||||
@ -461,7 +462,7 @@ fn deserialize_struct(
|
||||
} else {
|
||||
let type_name = item_attrs.name().deserialize_name();
|
||||
quote! {
|
||||
deserializer.deserialize_struct(#type_name, FIELDS, #visitor_expr)
|
||||
_serde::Deserializer::deserialize_struct(deserializer, #type_name, FIELDS, #visitor_expr)
|
||||
}
|
||||
};
|
||||
|
||||
@ -481,7 +482,7 @@ fn deserialize_struct(
|
||||
type Value = #ty;
|
||||
|
||||
fn expecting(&self, formatter: &mut _serde::export::fmt::Formatter) -> _serde::export::fmt::Result {
|
||||
formatter.write_str(#expecting)
|
||||
_serde::export::fmt::Formatter::write_str(formatter, #expecting)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
@ -563,13 +564,14 @@ fn deserialize_item_enum(
|
||||
// all variants have `#[serde(skip_deserializing)]`.
|
||||
quote! {
|
||||
// FIXME: Once we drop support for Rust 1.15:
|
||||
// let _serde::export::Err(err) = visitor.visit_variant::<__Field>();
|
||||
// let _serde::export::Err(err) = _serde::de::EnumVisitor::visit_variant::<__Field>(visitor);
|
||||
// _serde::export::Err(err)
|
||||
visitor.visit_variant::<__Field>().map(|(impossible, _)| match impossible {})
|
||||
_serde::de::EnumVisitor::visit_variant::<__Field>(visitor)
|
||||
.map(|(impossible, _)| match impossible {})
|
||||
}
|
||||
} else {
|
||||
quote! {
|
||||
match try!(visitor.visit_variant()) {
|
||||
match try!(_serde::de::EnumVisitor::visit_variant(visitor)) {
|
||||
#(#variant_arms)*
|
||||
}
|
||||
}
|
||||
@ -586,7 +588,7 @@ fn deserialize_item_enum(
|
||||
type Value = #ty;
|
||||
|
||||
fn expecting(&self, formatter: &mut _serde::export::fmt::Formatter) -> _serde::export::fmt::Result {
|
||||
formatter.write_str(#expecting)
|
||||
_serde::export::fmt::Formatter::write_str(formatter, #expecting)
|
||||
}
|
||||
|
||||
fn visit_enum<__V>(self, visitor: __V) -> _serde::export::Result<#ty, __V::Error>
|
||||
@ -598,7 +600,7 @@ fn deserialize_item_enum(
|
||||
|
||||
#variants_stmt
|
||||
|
||||
deserializer.deserialize_enum(#type_name, VARIANTS, #visitor_expr)
|
||||
_serde::Deserializer::deserialize_enum(deserializer, #type_name, VARIANTS, #visitor_expr)
|
||||
})
|
||||
}
|
||||
|
||||
@ -755,7 +757,7 @@ fn deserialize_field_visitor(
|
||||
type Value = __Field;
|
||||
|
||||
fn expecting(&self, formatter: &mut _serde::export::fmt::Formatter) -> _serde::export::fmt::Result {
|
||||
formatter.write_str("field name")
|
||||
_serde::export::fmt::Formatter::write_str(formatter, "field name")
|
||||
}
|
||||
|
||||
#visit_index
|
||||
@ -786,7 +788,7 @@ fn deserialize_field_visitor(
|
||||
}
|
||||
}
|
||||
|
||||
deserializer.deserialize_struct_field(__FieldVisitor)
|
||||
_serde::Deserializer::deserialize_struct_field(deserializer, __FieldVisitor)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -848,7 +850,7 @@ fn deserialize_map(
|
||||
.map(|&(field, ref name)| {
|
||||
let field_ty = &field.ty;
|
||||
quote! {
|
||||
let mut #name: Option<#field_ty> = None;
|
||||
let mut #name: _serde::export::Option<#field_ty> = _serde::export::None;
|
||||
}
|
||||
});
|
||||
|
||||
@ -862,7 +864,7 @@ fn deserialize_map(
|
||||
None => {
|
||||
let field_ty = &field.ty;
|
||||
quote! {
|
||||
try!(visitor.visit_value::<#field_ty>())
|
||||
try!(_serde::de::MapVisitor::visit_value::<#field_ty>(&mut visitor))
|
||||
}
|
||||
}
|
||||
Some(path) => {
|
||||
@ -871,16 +873,16 @@ fn deserialize_map(
|
||||
quote!({
|
||||
#wrapper
|
||||
#wrapper_impl
|
||||
try!(visitor.visit_value::<#wrapper_ty>()).value
|
||||
try!(_serde::de::MapVisitor::visit_value::<#wrapper_ty>(&mut visitor)).value
|
||||
})
|
||||
}
|
||||
};
|
||||
quote! {
|
||||
__Field::#name => {
|
||||
if #name.is_some() {
|
||||
if _serde::export::Option::is_some(&#name) {
|
||||
return _serde::export::Err(<__V::Error as _serde::de::Error>::duplicate_field(#deser_name));
|
||||
}
|
||||
#name = Some(#visit);
|
||||
#name = _serde::export::Some(#visit);
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -890,7 +892,7 @@ fn deserialize_map(
|
||||
None
|
||||
} else {
|
||||
Some(quote! {
|
||||
_ => { let _ = try!(visitor.visit_value::<_serde::de::impls::IgnoredAny>()); }
|
||||
_ => { let _ = try!(_serde::de::MapVisitor::visit_value::<_serde::de::impls::IgnoredAny>(&mut visitor)); }
|
||||
})
|
||||
};
|
||||
|
||||
@ -898,12 +900,13 @@ fn deserialize_map(
|
||||
let match_keys = if item_attrs.deny_unknown_fields() && all_skipped {
|
||||
quote! {
|
||||
// FIXME: Once we drop support for Rust 1.15:
|
||||
// let None::<__Field> = try!(visitor.visit_key());
|
||||
try!(visitor.visit_key::<__Field>()).map(|impossible| match impossible {});
|
||||
// let _serde::export::None::<__Field> = try!(_serde::de::MapVisitor::visit_key(&mut visitor));
|
||||
try!(_serde::de::MapVisitor::visit_key::<__Field>(&mut visitor))
|
||||
.map(|impossible| match impossible {});
|
||||
}
|
||||
} else {
|
||||
quote! {
|
||||
while let Some(key) = try!(visitor.visit_key::<__Field>()) {
|
||||
while let _serde::export::Some(key) = try!(_serde::de::MapVisitor::visit_key::<__Field>(&mut visitor)) {
|
||||
match key {
|
||||
#(#value_arms)*
|
||||
#ignored_arm
|
||||
@ -919,8 +922,8 @@ fn deserialize_map(
|
||||
|
||||
quote! {
|
||||
let #name = match #name {
|
||||
Some(#name) => #name,
|
||||
None => #missing_expr
|
||||
_serde::export::Some(#name) => #name,
|
||||
_serde::export::None => #missing_expr
|
||||
};
|
||||
}
|
||||
});
|
||||
|
@ -125,7 +125,7 @@ fn serialize_unit_struct(item_attrs: &attr::Item) -> Tokens {
|
||||
let type_name = item_attrs.name().serialize_name();
|
||||
|
||||
quote! {
|
||||
_serializer.serialize_unit_struct(#type_name)
|
||||
_serde::Serializer::serialize_unit_struct(_serializer, #type_name)
|
||||
}
|
||||
}
|
||||
|
||||
@ -144,7 +144,7 @@ fn serialize_newtype_struct(
|
||||
}
|
||||
|
||||
quote! {
|
||||
_serializer.serialize_newtype_struct(#type_name, #field_expr)
|
||||
_serde::Serializer::serialize_newtype_struct(_serializer, #type_name, #field_expr)
|
||||
}
|
||||
}
|
||||
|
||||
@ -167,7 +167,7 @@ fn serialize_tuple_struct(
|
||||
let let_mut = mut_if(len > 0);
|
||||
|
||||
quote! {
|
||||
let #let_mut __serde_state = try!(_serializer.serialize_tuple_struct(#type_name, #len));
|
||||
let #let_mut __serde_state = try!(_serde::Serializer::serialize_tuple_struct(_serializer, #type_name, #len));
|
||||
#(#serialize_stmts)*
|
||||
_serde::ser::SerializeTupleStruct::end(__serde_state)
|
||||
}
|
||||
@ -208,7 +208,7 @@ fn serialize_struct(
|
||||
.fold(quote!(0), |sum, expr| quote!(#sum + #expr));
|
||||
|
||||
quote! {
|
||||
let #let_mut __serde_state = try!(_serializer.serialize_struct(#type_name, #len));
|
||||
let #let_mut __serde_state = try!(_serde::Serializer::serialize_struct(_serializer, #type_name, #len));
|
||||
#(#serialize_fields)*
|
||||
_serde::ser::SerializeStruct::end(__serde_state)
|
||||
}
|
||||
@ -380,7 +380,8 @@ fn serialize_tuple_variant(
|
||||
let let_mut = mut_if(len > 0);
|
||||
|
||||
quote! {
|
||||
let #let_mut __serde_state = try!(_serializer.serialize_tuple_variant(
|
||||
let #let_mut __serde_state = try!(_serde::Serializer::serialize_tuple_variant(
|
||||
_serializer,
|
||||
#type_name,
|
||||
#variant_index,
|
||||
#variant_name,
|
||||
@ -426,7 +427,8 @@ fn serialize_struct_variant(
|
||||
.fold(quote!(0), |sum, expr| quote!(#sum + #expr));
|
||||
|
||||
quote! {
|
||||
let #let_mut __serde_state = try!(_serializer.serialize_struct_variant(
|
||||
let #let_mut __serde_state = try!(_serde::Serializer::serialize_struct_variant(
|
||||
_serializer,
|
||||
#item_name,
|
||||
#variant_index,
|
||||
#variant_name,
|
||||
@ -537,7 +539,7 @@ fn wrap_serialize_with(
|
||||
quote!({
|
||||
struct __SerializeWith #wrapper_generics #where_clause {
|
||||
value: &'__a #field_ty,
|
||||
phantom: ::std::marker::PhantomData<#item_ty>,
|
||||
phantom: _serde::export::PhantomData<#item_ty>,
|
||||
}
|
||||
|
||||
impl #wrapper_generics _serde::Serialize for #wrapper_ty #where_clause {
|
||||
@ -550,7 +552,7 @@ fn wrap_serialize_with(
|
||||
|
||||
&__SerializeWith {
|
||||
value: #value,
|
||||
phantom: ::std::marker::PhantomData::<#item_ty>,
|
||||
phantom: _serde::export::PhantomData::<#item_ty>,
|
||||
}
|
||||
})
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user