about summary refs log tree commit diff
path: root/src/libsyntax/ast.rs
diff options
context:
space:
mode:
authorvarkor <github@varkor.com>2018-02-13 11:32:37 +0000
committervarkor <github@varkor.com>2018-06-20 12:19:04 +0100
commit3e89753283a3d08704ab293b337d255e5d5e5210 (patch)
tree95cc12665f619cc3d4666802c6fffc3ba9ce0301 /src/libsyntax/ast.rs
parente05ad4f31a6440d78588912ef76c4ba454b1b539 (diff)
downloadrust-3e89753283a3d08704ab293b337d255e5d5e5210.tar.gz
rust-3e89753283a3d08704ab293b337d255e5d5e5210.zip
Rename PathParameter(s) to GenericArg(s)
Diffstat (limited to 'src/libsyntax/ast.rs')
-rw-r--r--src/libsyntax/ast.rs28
1 files changed, 14 insertions, 14 deletions
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<X, Y>`)
     /// but it can be empty (`Path<>`).
     /// `P` is used as a size optimization for the common case with no parameters.
-    pub parameters: Option<P<PathParameters>>,
+    pub parameters: Option<P<GenericArgs>>,
 }
 
 impl PathSegment {
@@ -151,14 +151,14 @@ impl PathSegment {
 ///
 /// E.g. `<A, B>` as in `Foo<A, B>` 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<Item = &Lifetime> {
         self.parameters.iter().filter_map(|p| {
             if let AngleBracketedParam::Lifetime(lt) = p {
                 Some(lt)
             } else {
                 None
             }
-        }).collect()
+        })
     }
 
-    pub fn types(&self) -> Vec<&P<Ty>> {
+    pub fn types(&self) -> impl DoubleEndedIterator<Item = &P<Ty>> {
         self.parameters.iter().filter_map(|p| {
             if let AngleBracketedParam::Type(ty) = p {
                 Some(ty)
             } else {
                 None
             }
-        }).collect()
+        })
     }
 }
 
-impl Into<Option<P<PathParameters>>> for AngleBracketedParameterData {
-    fn into(self) -> Option<P<PathParameters>> {
-        Some(P(PathParameters::AngleBracketed(self)))
+impl Into<Option<P<GenericArgs>>> for AngleBracketedParameterData {
+    fn into(self) -> Option<P<GenericArgs>> {
+        Some(P(GenericArgs::AngleBracketed(self)))
     }
 }
 
-impl Into<Option<P<PathParameters>>> for ParenthesizedParameterData {
-    fn into(self) -> Option<P<PathParameters>> {
-        Some(P(PathParameters::Parenthesized(self)))
+impl Into<Option<P<GenericArgs>>> for ParenthesizedParameterData {
+    fn into(self) -> Option<P<GenericArgs>> {
+        Some(P(GenericArgs::Parenthesized(self)))
     }
 }