about summary refs log tree commit diff
path: root/src/libsyntax/ptr.rs
diff options
context:
space:
mode:
authorVadim Petrochenkov <vadim.petrochenkov@gmail.com>2016-02-11 23:33:09 +0300
committerVadim Petrochenkov <vadim.petrochenkov@gmail.com>2016-02-11 23:33:09 +0300
commit77cc5764b9d8b53e01788886d3b3882dffc0001e (patch)
treeabbe5a51d013a64fb25383641311689011b7d03f /src/libsyntax/ptr.rs
parentaa1dc0975a43e224386ec0ed1bb7ae09cfd0dd7e (diff)
downloadrust-77cc5764b9d8b53e01788886d3b3882dffc0001e.tar.gz
rust-77cc5764b9d8b53e01788886d3b3882dffc0001e.zip
Remove some unnecessary indirection from AST structures
Diffstat (limited to 'src/libsyntax/ptr.rs')
-rw-r--r--src/libsyntax/ptr.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/libsyntax/ptr.rs b/src/libsyntax/ptr.rs
index 6190cf73464..27f5700cad5 100644
--- a/src/libsyntax/ptr.rs
+++ b/src/libsyntax/ptr.rs
@@ -65,6 +65,10 @@ impl<T: 'static> P<T> {
     {
         f(*self.ptr)
     }
+    /// Equivalent to and_then(|x| x)
+    pub fn unwrap(self) -> T {
+        *self.ptr
+    }
 
     /// Transform the inner value, consuming `self` and producing a new `P<T>`.
     pub fn map<F>(mut self, f: F) -> P<T> where