mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
use Result::or for Either::from_str
This commit is contained in:
parent
a151a6f550
commit
a4caa2bc26
@ -4573,13 +4573,9 @@ fn handle_tether(
|
|||||||
type Err = B::Err;
|
type Err = B::Err;
|
||||||
|
|
||||||
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||||
match A::from_str(s) {
|
A::from_str(s)
|
||||||
Ok(a) => Ok(Either::Left(a)),
|
.map(Either::Left)
|
||||||
Err(_) => match B::from_str(s) {
|
.or_else(|_| B::from_str(s).map(Either::Right))
|
||||||
Ok(b) => Ok(Either::Right(b)),
|
|
||||||
Err(e) => Err(e),
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if let (Some(entity_target), length) = parse_cmd_args!(args, EntityTarget, Either<f32, bool>) {
|
if let (Some(entity_target), length) = parse_cmd_args!(args, EntityTarget, Either<f32, bool>) {
|
||||||
|
Loading…
Reference in New Issue
Block a user