aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/either.rs
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2019-07-19 16:22:00 +0100
committerAleksey Kladov <[email protected]>2019-07-19 16:22:00 +0100
commit5c594bcb48f01bdcf3068f72cefffda337a03533 (patch)
treebf584b2bf88a35ebe9e5c91392fecb23b4935c97 /crates/ra_hir/src/either.rs
parent8718a47088585bdb411f37d1b7cd1244d7528eaa (diff)
cleanup casts
Diffstat (limited to 'crates/ra_hir/src/either.rs')
-rw-r--r--crates/ra_hir/src/either.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/crates/ra_hir/src/either.rs b/crates/ra_hir/src/either.rs
index 71c53ebc0..439e6ec87 100644
--- a/crates/ra_hir/src/either.rs
+++ b/crates/ra_hir/src/either.rs
@@ -25,6 +25,12 @@ impl<A, B> Either<A, B> {
25 Either::B(b) => Either::B(f2(b)), 25 Either::B(b) => Either::B(f2(b)),
26 } 26 }
27 } 27 }
28 pub fn map_a<U, F>(self, f: F) -> Either<U, B>
29 where
30 F: FnOnce(A) -> U,
31 {
32 self.map(f, |it| it)
33 }
28 pub fn a(self) -> Option<A> { 34 pub fn a(self) -> Option<A> {
29 match self { 35 match self {
30 Either::A(it) => Some(it), 36 Either::A(it) => Some(it),