diff options
| author | varkor <github@varkor.com> | 2018-05-27 01:43:03 +0100 |
|---|---|---|
| committer | varkor <github@varkor.com> | 2018-06-20 12:21:24 +0100 |
| commit | 80b381e041d12259f24b1282e10e0a224bc6ec0e (patch) | |
| tree | 8adbe6cac76a8c202210e0cf432ef027b17b0969 /src/libsyntax_ext | |
| parent | 10229fd9d5701179e2148a1d4bbfda0062a2225f (diff) | |
| download | rust-80b381e041d12259f24b1282e10e0a224bc6ec0e.tar.gz rust-80b381e041d12259f24b1282e10e0a224bc6ec0e.zip | |
Remove all traces of lifetimes() and types() methods
Diffstat (limited to 'src/libsyntax_ext')
| -rw-r--r-- | src/libsyntax_ext/deriving/generic/mod.rs | 44 |
1 files changed, 21 insertions, 23 deletions
diff --git a/src/libsyntax_ext/deriving/generic/mod.rs b/src/libsyntax_ext/deriving/generic/mod.rs index e461c9640d1..fc244f67bb6 100644 --- a/src/libsyntax_ext/deriving/generic/mod.rs +++ b/src/libsyntax_ext/deriving/generic/mod.rs @@ -549,30 +549,28 @@ impl<'a> TraitDef<'a> { .to_generics(cx, self.span, type_ident, generics); // Create the generic parameters - params.extend(generics.params.iter().map(|param| { - match param.kind { - GenericParamKindAST::Lifetime { .. } => param.clone(), - GenericParamKindAST::Type { bounds: ref ty_bounds, .. } => { - // I don't think this can be moved out of the loop, since - // a TyParamBound requires an ast id - let mut bounds: Vec<_> = - // extra restrictions on the generics parameters to the - // type being derived upon - self.additional_bounds.iter().map(|p| { - cx.typarambound(p.to_path(cx, self.span, - type_ident, generics)) - }).collect(); - - // require the current trait - bounds.push(cx.typarambound(trait_path.clone())); - - // also add in any bounds from the declaration - for declared_bound in ty_bounds { - bounds.push((*declared_bound).clone()); - } - - cx.typaram(self.span, param.ident, vec![], bounds, None) + params.extend(generics.params.iter().map(|param| match param.kind { + GenericParamKindAST::Lifetime { .. } => param.clone(), + GenericParamKindAST::Type { bounds: ref ty_bounds, .. } => { + // I don't think this can be moved out of the loop, since + // a TyParamBound requires an ast id + let mut bounds: Vec<_> = + // extra restrictions on the generics parameters to the + // type being derived upon + self.additional_bounds.iter().map(|p| { + cx.typarambound(p.to_path(cx, self.span, + type_ident, generics)) + }).collect(); + + // require the current trait + bounds.push(cx.typarambound(trait_path.clone())); + + // also add in any bounds from the declaration + for declared_bound in ty_bounds { + bounds.push((*declared_bound).clone()); } + + cx.typaram(self.span, param.ident, vec![], bounds, None) } })); |
