diff options
Diffstat (limited to 'src/libsyntax_ext/deriving/generic/mod.rs')
| -rw-r--r-- | src/libsyntax_ext/deriving/generic/mod.rs | 108 |
1 files changed, 54 insertions, 54 deletions
diff --git a/src/libsyntax_ext/deriving/generic/mod.rs b/src/libsyntax_ext/deriving/generic/mod.rs index 22643db5016..0c88ae0311d 100644 --- a/src/libsyntax_ext/deriving/generic/mod.rs +++ b/src/libsyntax_ext/deriving/generic/mod.rs @@ -174,8 +174,8 @@ //! (<ident of C1>, <span of C1>, Named(vec![(<ident of x>, <span of x>)]))]) //! ``` -pub use self::StaticFields::*; -pub use self::SubstructureFields::*; +pub use StaticFields::*; +pub use SubstructureFields::*; use std::cell::RefCell; use std::iter; @@ -195,9 +195,9 @@ use syntax::symbol::{Symbol, keywords}; use syntax::parse::ParseSess; use syntax_pos::{DUMMY_SP, Span}; -use self::ty::{LifetimeBounds, Path, Ptr, PtrTy, Self_, Ty}; +use ty::{LifetimeBounds, Path, Ptr, PtrTy, Self_, Ty}; -use deriving; +use crate::deriving; pub mod ty; @@ -321,7 +321,7 @@ pub enum SubstructureFields<'a> { /// Combine the values of all the fields together. The last argument is /// all the fields of all the structures. pub type CombineSubstructureFunc<'a> = - Box<dyn FnMut(&mut ExtCtxt, Span, &Substructure) -> P<Expr> + 'a>; + Box<dyn FnMut(&mut ExtCtxt<'_>, Span, &Substructure<'_>) -> P<Expr> + 'a>; /// Deal with non-matching enum variants. The tuple is a list of /// identifiers (one for each `Self` argument, which could be any of the @@ -329,7 +329,7 @@ pub type CombineSubstructureFunc<'a> = /// holding the variant index value for each of the `Self` arguments. The /// last argument is all the non-`Self` args of the method being derived. pub type EnumNonMatchCollapsedFunc<'a> = - Box<dyn FnMut(&mut ExtCtxt, Span, (&[Ident], &[Ident]), &[P<Expr>]) -> P<Expr> + 'a>; + Box<dyn FnMut(&mut ExtCtxt<'_>, Span, (&[Ident], &[Ident]), &[P<Expr>]) -> P<Expr> + 'a>; pub fn combine_substructure<'a>(f: CombineSubstructureFunc<'a>) -> RefCell<CombineSubstructureFunc<'a>> { @@ -342,7 +342,7 @@ pub fn combine_substructure<'a>(f: CombineSubstructureFunc<'a>) fn find_type_parameters(ty: &ast::Ty, ty_param_names: &[ast::Name], span: Span, - cx: &ExtCtxt) + cx: &ExtCtxt<'_>) -> Vec<P<ast::Ty>> { use syntax::visit; @@ -386,7 +386,7 @@ fn find_type_parameters(ty: &ast::Ty, impl<'a> TraitDef<'a> { pub fn expand(self, - cx: &mut ExtCtxt, + cx: &mut ExtCtxt<'_>, mitem: &ast::MetaItem, item: &'a Annotatable, push: &mut dyn FnMut(Annotatable)) { @@ -394,7 +394,7 @@ impl<'a> TraitDef<'a> { } pub fn expand_ext(self, - cx: &mut ExtCtxt, + cx: &mut ExtCtxt<'_>, mitem: &ast::MetaItem, item: &'a Annotatable, push: &mut dyn FnMut(Annotatable), @@ -513,7 +513,7 @@ impl<'a> TraitDef<'a> { /// where B1, ..., BN are the bounds given by `bounds_paths`.'. Z is a phantom type, and /// therefore does not get bound by the derived trait. fn create_derived_impl(&self, - cx: &mut ExtCtxt, + cx: &mut ExtCtxt<'_>, type_ident: Ident, generics: &Generics, field_tys: Vec<P<ast::Ty>>, @@ -696,7 +696,7 @@ impl<'a> TraitDef<'a> { } fn expand_struct_def(&self, - cx: &mut ExtCtxt, + cx: &mut ExtCtxt<'_>, struct_def: &'a VariantData, type_ident: Ident, generics: &Generics, @@ -746,7 +746,7 @@ impl<'a> TraitDef<'a> { } fn expand_enum_def(&self, - cx: &mut ExtCtxt, + cx: &mut ExtCtxt<'_>, enum_def: &'a EnumDef, type_attrs: &[ast::Attribute], type_ident: Ident, @@ -832,12 +832,12 @@ fn find_repr_type_name(sess: &ParseSess, type_attrs: &[ast::Attribute]) -> &'sta impl<'a> MethodDef<'a> { fn call_substructure_method(&self, - cx: &mut ExtCtxt, - trait_: &TraitDef, + cx: &mut ExtCtxt<'_>, + trait_: &TraitDef<'_>, type_ident: Ident, self_args: &[P<Expr>], nonself_args: &[P<Expr>], - fields: &SubstructureFields) + fields: &SubstructureFields<'_>) -> P<Expr> { let substructure = Substructure { type_ident, @@ -847,13 +847,13 @@ impl<'a> MethodDef<'a> { fields, }; let mut f = self.combine_substructure.borrow_mut(); - let f: &mut CombineSubstructureFunc = &mut *f; + let f: &mut CombineSubstructureFunc<'_> = &mut *f; f(cx, trait_.span, &substructure) } fn get_ret_ty(&self, - cx: &mut ExtCtxt, - trait_: &TraitDef, + cx: &mut ExtCtxt<'_>, + trait_: &TraitDef<'_>, generics: &Generics, type_ident: Ident) -> P<ast::Ty> { @@ -866,8 +866,8 @@ impl<'a> MethodDef<'a> { fn split_self_nonself_args (&self, - cx: &mut ExtCtxt, - trait_: &TraitDef, + cx: &mut ExtCtxt<'_>, + trait_: &TraitDef<'_>, type_ident: Ident, generics: &Generics) -> (Option<ast::ExplicitSelf>, Vec<P<Expr>>, Vec<P<Expr>>, Vec<(Ident, P<ast::Ty>)>) { @@ -912,8 +912,8 @@ impl<'a> MethodDef<'a> { } fn create_method(&self, - cx: &mut ExtCtxt, - trait_: &TraitDef, + cx: &mut ExtCtxt<'_>, + trait_: &TraitDef<'_>, type_ident: Ident, generics: &Generics, abi: Abi, @@ -1005,7 +1005,7 @@ impl<'a> MethodDef<'a> { /// } /// ``` fn expand_struct_method_body<'b>(&self, - cx: &mut ExtCtxt, + cx: &mut ExtCtxt<'_>, trait_: &TraitDef<'b>, struct_def: &'b VariantData, type_ident: Ident, @@ -1077,8 +1077,8 @@ impl<'a> MethodDef<'a> { } fn expand_static_struct_method_body(&self, - cx: &mut ExtCtxt, - trait_: &TraitDef, + cx: &mut ExtCtxt<'_>, + trait_: &TraitDef<'_>, struct_def: &VariantData, type_ident: Ident, self_args: &[P<Expr>], @@ -1125,7 +1125,7 @@ impl<'a> MethodDef<'a> { /// as their results are unused. The point of `__self_vi` and /// `__arg_1_vi` is for `PartialOrd`; see #15503.) fn expand_enum_method_body<'b>(&self, - cx: &mut ExtCtxt, + cx: &mut ExtCtxt<'_>, trait_: &TraitDef<'b>, enum_def: &'b EnumDef, type_attrs: &[ast::Attribute], @@ -1179,7 +1179,7 @@ impl<'a> MethodDef<'a> { /// } /// ``` fn build_enum_match_tuple<'b>(&self, - cx: &mut ExtCtxt, + cx: &mut ExtCtxt<'_>, trait_: &TraitDef<'b>, enum_def: &'b EnumDef, type_attrs: &[ast::Attribute], @@ -1230,7 +1230,7 @@ impl<'a> MethodDef<'a> { .enumerate() .filter(|&(_, v)| !(self.unify_fieldless_variants && v.node.data.fields().is_empty())) .map(|(index, variant)| { - let mk_self_pat = |cx: &mut ExtCtxt, self_arg_name: &str| { + let mk_self_pat = |cx: &mut ExtCtxt<'_>, self_arg_name: &str| { let (p, idents) = trait_.create_enum_variant_pattern(cx, type_ident, variant, @@ -1296,7 +1296,7 @@ impl<'a> MethodDef<'a> { other: others, attrs, } - }).collect::<Vec<FieldInfo>>(); + }).collect::<Vec<FieldInfo<'_>>>(); // Now, for some given VariantK, we have built up // expressions for referencing every field of every @@ -1501,8 +1501,8 @@ impl<'a> MethodDef<'a> { } fn expand_static_enum_method_body(&self, - cx: &mut ExtCtxt, - trait_: &TraitDef, + cx: &mut ExtCtxt<'_>, + trait_: &TraitDef<'_>, enum_def: &EnumDef, type_ident: Ident, self_args: &[P<Expr>], @@ -1527,7 +1527,7 @@ impl<'a> MethodDef<'a> { // general helper methods. impl<'a> TraitDef<'a> { - fn summarise_struct(&self, cx: &mut ExtCtxt, struct_def: &VariantData) -> StaticFields { + fn summarise_struct(&self, cx: &mut ExtCtxt<'_>, struct_def: &VariantData) -> StaticFields { let mut named_idents = Vec::new(); let mut just_spans = Vec::new(); for field in struct_def.fields() { @@ -1553,7 +1553,7 @@ impl<'a> TraitDef<'a> { } fn create_subpatterns(&self, - cx: &mut ExtCtxt, + cx: &mut ExtCtxt<'_>, field_paths: Vec<ast::Ident>, mutbl: ast::Mutability, use_temporaries: bool) @@ -1573,7 +1573,7 @@ impl<'a> TraitDef<'a> { fn create_struct_pattern (&self, - cx: &mut ExtCtxt, + cx: &mut ExtCtxt<'_>, struct_path: ast::Path, struct_def: &'a VariantData, prefix: &str, @@ -1633,7 +1633,7 @@ impl<'a> TraitDef<'a> { fn create_enum_variant_pattern (&self, - cx: &mut ExtCtxt, + cx: &mut ExtCtxt<'_>, enum_ident: ast::Ident, variant: &'a ast::Variant, prefix: &str, @@ -1652,10 +1652,10 @@ impl<'a> TraitDef<'a> { pub fn cs_fold_fields<'a, F>(use_foldl: bool, mut f: F, base: P<Expr>, - cx: &mut ExtCtxt, + cx: &mut ExtCtxt<'_>, all_fields: &[FieldInfo<'a>]) -> P<Expr> - where F: FnMut(&mut ExtCtxt, Span, P<Expr>, P<Expr>, &[P<Expr>]) -> P<Expr> + where F: FnMut(&mut ExtCtxt<'_>, Span, P<Expr>, P<Expr>, &[P<Expr>]) -> P<Expr> { if use_foldl { all_fields.iter().fold(base, |old, field| { @@ -1668,10 +1668,10 @@ pub fn cs_fold_fields<'a, F>(use_foldl: bool, } } -pub fn cs_fold_enumnonmatch(mut enum_nonmatch_f: EnumNonMatchCollapsedFunc, - cx: &mut ExtCtxt, +pub fn cs_fold_enumnonmatch(mut enum_nonmatch_f: EnumNonMatchCollapsedFunc<'_>, + cx: &mut ExtCtxt<'_>, trait_span: Span, - substructure: &Substructure) + substructure: &Substructure<'_>) -> P<Expr> { match *substructure.fields { @@ -1685,7 +1685,7 @@ pub fn cs_fold_enumnonmatch(mut enum_nonmatch_f: EnumNonMatchCollapsedFunc, } } -pub fn cs_fold_static(cx: &mut ExtCtxt, +pub fn cs_fold_static(cx: &mut ExtCtxt<'_>, trait_span: Span) -> P<Expr> { @@ -1697,12 +1697,12 @@ pub fn cs_fold_static(cx: &mut ExtCtxt, pub fn cs_fold<F>(use_foldl: bool, f: F, base: P<Expr>, - enum_nonmatch_f: EnumNonMatchCollapsedFunc, - cx: &mut ExtCtxt, + enum_nonmatch_f: EnumNonMatchCollapsedFunc<'_>, + cx: &mut ExtCtxt<'_>, trait_span: Span, - substructure: &Substructure) + substructure: &Substructure<'_>) -> P<Expr> - where F: FnMut(&mut ExtCtxt, Span, P<Expr>, P<Expr>, &[P<Expr>]) -> P<Expr> + where F: FnMut(&mut ExtCtxt<'_>, Span, P<Expr>, P<Expr>, &[P<Expr>]) -> P<Expr> { match *substructure.fields { EnumMatching(.., ref all_fields) | @@ -1730,13 +1730,13 @@ pub fn cs_fold<F>(use_foldl: bool, pub fn cs_fold1<F, B>(use_foldl: bool, f: F, mut b: B, - enum_nonmatch_f: EnumNonMatchCollapsedFunc, - cx: &mut ExtCtxt, + enum_nonmatch_f: EnumNonMatchCollapsedFunc<'_>, + cx: &mut ExtCtxt<'_>, trait_span: Span, - substructure: &Substructure) + substructure: &Substructure<'_>) -> P<Expr> - where F: FnMut(&mut ExtCtxt, Span, P<Expr>, P<Expr>, &[P<Expr>]) -> P<Expr>, - B: FnMut(&mut ExtCtxt, Option<(Span, P<Expr>, &[P<Expr>])>) -> P<Expr> + where F: FnMut(&mut ExtCtxt<'_>, Span, P<Expr>, P<Expr>, &[P<Expr>]) -> P<Expr>, + B: FnMut(&mut ExtCtxt<'_>, Option<(Span, P<Expr>, &[P<Expr>])>) -> P<Expr> { match *substructure.fields { EnumMatching(.., ref all_fields) | @@ -1776,12 +1776,12 @@ pub fn cs_fold1<F, B>(use_foldl: bool, /// ``` #[inline] pub fn cs_same_method<F>(f: F, - mut enum_nonmatch_f: EnumNonMatchCollapsedFunc, - cx: &mut ExtCtxt, + mut enum_nonmatch_f: EnumNonMatchCollapsedFunc<'_>, + cx: &mut ExtCtxt<'_>, trait_span: Span, - substructure: &Substructure) + substructure: &Substructure<'_>) -> P<Expr> - where F: FnOnce(&mut ExtCtxt, Span, Vec<P<Expr>>) -> P<Expr> + where F: FnOnce(&mut ExtCtxt<'_>, Span, Vec<P<Expr>>) -> P<Expr> { match *substructure.fields { EnumMatching(.., ref all_fields) | |
