From 3e89753283a3d08704ab293b337d255e5d5e5210 Mon Sep 17 00:00:00 2001 From: varkor Date: Tue, 13 Feb 2018 11:32:37 +0000 Subject: Rename PathParameter(s) to GenericArg(s) --- src/libsyntax/ast.rs | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'src/libsyntax/ast.rs') diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index 9a05c5c063a..7bcaf9bbd52 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -12,7 +12,7 @@ pub use self::TyParamBound::*; pub use self::UnsafeSource::*; -pub use self::PathParameters::*; +pub use self::GenericArgs::*; pub use symbol::{Ident, Symbol as Name}; pub use util::ThinVec; pub use util::parser::ExprPrecedence; @@ -135,7 +135,7 @@ pub struct PathSegment { /// `Some` means that parameter list is supplied (`Path`) /// but it can be empty (`Path<>`). /// `P` is used as a size optimization for the common case with no parameters. - pub parameters: Option>, + pub parameters: Option>, } impl PathSegment { @@ -151,14 +151,14 @@ impl PathSegment { /// /// E.g. `` as in `Foo` or `(A, B)` as in `Foo(A, B)` #[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] -pub enum PathParameters { +pub enum GenericArgs { /// The `<'a, A,B,C>` in `foo::bar::baz::<'a, A,B,C>` AngleBracketed(AngleBracketedParameterData), /// The `(A,B)` and `C` in `Foo(A,B) -> C` Parenthesized(ParenthesizedParameterData), } -impl PathParameters { +impl GenericArgs { pub fn span(&self) -> Span { match *self { AngleBracketed(ref data) => data.span, @@ -187,36 +187,36 @@ pub struct AngleBracketedParameterData { } impl AngleBracketedParameterData { - pub fn lifetimes(&self) -> Vec<&Lifetime> { + pub fn lifetimes(&self) -> impl DoubleEndedIterator { self.parameters.iter().filter_map(|p| { if let AngleBracketedParam::Lifetime(lt) = p { Some(lt) } else { None } - }).collect() + }) } - pub fn types(&self) -> Vec<&P> { + pub fn types(&self) -> impl DoubleEndedIterator> { self.parameters.iter().filter_map(|p| { if let AngleBracketedParam::Type(ty) = p { Some(ty) } else { None } - }).collect() + }) } } -impl Into>> for AngleBracketedParameterData { - fn into(self) -> Option> { - Some(P(PathParameters::AngleBracketed(self))) +impl Into>> for AngleBracketedParameterData { + fn into(self) -> Option> { + Some(P(GenericArgs::AngleBracketed(self))) } } -impl Into>> for ParenthesizedParameterData { - fn into(self) -> Option> { - Some(P(PathParameters::Parenthesized(self))) +impl Into>> for ParenthesizedParameterData { + fn into(self) -> Option> { + Some(P(GenericArgs::Parenthesized(self))) } } -- cgit 1.4.1-3-g733a5