diff options
| author | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2016-02-11 23:33:09 +0300 |
|---|---|---|
| committer | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2016-02-11 23:33:09 +0300 |
| commit | 77cc5764b9d8b53e01788886d3b3882dffc0001e (patch) | |
| tree | abbe5a51d013a64fb25383641311689011b7d03f /src/libsyntax/ptr.rs | |
| parent | aa1dc0975a43e224386ec0ed1bb7ae09cfd0dd7e (diff) | |
| download | rust-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.rs | 4 |
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 |
