Skip to content

Commit 399f986

Browse files
committed
Rustfmt either_or_both
1 parent 1e614ad commit 399f986

File tree

1 file changed

+15
-10
lines changed

1 file changed

+15
-10
lines changed

src/either_or_both.rs

+15-10
Original file line numberDiff line numberDiff line change
@@ -26,49 +26,49 @@ impl<A, B> EitherOrBoth<A, B> {
2626

2727
/// If Left, return true otherwise, return false.
2828
/// Exclusive version of [`has_left`].
29-
pub fn is_just_left(&self) -> bool {
29+
pub fn is_just_left(&self) -> bool {
3030
match *self {
3131
Left(_) => true,
32-
_ => false
32+
_ => false,
3333
}
3434
}
3535

3636
/// If Right, return true otherwise, return false.
3737
/// Exclusive version of [`has_right`].
38-
pub fn is_just_right(&self) -> bool {
38+
pub fn is_just_right(&self) -> bool {
3939
match *self {
4040
Right(_) => true,
41-
_ => false
41+
_ => false,
4242
}
4343
}
4444

4545
/// If Right, return true otherwise, return false.
4646
/// Equivalent to `self.as_ref().both().is_some()`.
47-
pub fn is_just_both(&self) -> bool {
47+
pub fn is_just_both(&self) -> bool {
4848
self.as_ref().both().is_some()
4949
}
5050

5151
/// If `Left`, or `Both`, return `Some` with the left value, otherwise, return `None`.
5252
pub fn left(self) -> Option<A> {
5353
match self {
5454
Left(left) | Both(left, _) => Some(left),
55-
_ => None
55+
_ => None,
5656
}
5757
}
5858

5959
/// If `Right`, or `Both`, return `Some` with the right value, otherwise, return `None`.
6060
pub fn right(self) -> Option<B> {
6161
match self {
6262
Right(right) | Both(_, right) => Some(right),
63-
_ => None
63+
_ => None,
6464
}
6565
}
6666

6767
/// If Both, return `Some` tuple containing left and right.
6868
pub fn both(self) -> Option<(A, B)> {
6969
match self {
7070
Both(a, b) => Some((a, b)),
71-
_ => None
71+
_ => None,
7272
}
7373
}
7474

@@ -93,7 +93,10 @@ impl<A, B> EitherOrBoth<A, B> {
9393
/// Convert `EitherOrBoth<A, B>` to `EitherOrBoth<B, A>`.
9494
pub fn flip(self) -> EitherOrBoth<B, A> {
9595
match self {
96-
Left(a) => Right(a), Right(b) => Left(b), Both(a, b) => Both(b, a), }
96+
Left(a) => Right(a),
97+
Right(b) => Left(b),
98+
Both(a, b) => Both(b, a),
99+
}
97100
}
98101

99102
/// Apply the function `f` on the value `a` in `Left(a)` or `Both(a, b)` variants. If it is
@@ -104,7 +107,9 @@ impl<A, B> EitherOrBoth<A, B> {
104107
{
105108
match self {
106109
Both(a, b) => Both(f(a), b),
107-
Left(a) => Left(f(a)), Right(b) => Right(b), }
110+
Left(a) => Left(f(a)),
111+
Right(b) => Right(b),
112+
}
108113
}
109114

110115
/// Apply the function `f` on the value `b` in `Right(b)` or `Both(a, b)` variants.

0 commit comments

Comments
 (0)