forked from extern/nushell
Match cleanup (#2290)
This commit is contained in:
@ -893,27 +893,25 @@ macro_rules! ranged_int {
|
||||
|
||||
impl CoerceInto<$ty> for nu_source::Tagged<BigInt> {
|
||||
fn coerce_into(self, operation: impl Into<String>) -> Result<$ty, ShellError> {
|
||||
match self.$op() {
|
||||
Some(v) => Ok(v),
|
||||
None => Err(ShellError::range_error(
|
||||
self.$op().ok_or_else(|| {
|
||||
ShellError::range_error(
|
||||
$ty::to_expected_range(),
|
||||
&self.item.spanned(self.tag.span),
|
||||
operation.into(),
|
||||
)),
|
||||
}
|
||||
)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
impl CoerceInto<$ty> for nu_source::Tagged<&BigInt> {
|
||||
fn coerce_into(self, operation: impl Into<String>) -> Result<$ty, ShellError> {
|
||||
match self.$op() {
|
||||
Some(v) => Ok(v),
|
||||
None => Err(ShellError::range_error(
|
||||
self.$op().ok_or_else(|| {
|
||||
ShellError::range_error(
|
||||
$ty::to_expected_range(),
|
||||
&self.item.spanned(self.tag.span),
|
||||
operation.into(),
|
||||
)),
|
||||
}
|
||||
)
|
||||
})
|
||||
}
|
||||
}
|
||||
};
|
||||
@ -938,27 +936,25 @@ macro_rules! ranged_decimal {
|
||||
|
||||
impl CoerceInto<$ty> for nu_source::Tagged<BigDecimal> {
|
||||
fn coerce_into(self, operation: impl Into<String>) -> Result<$ty, ShellError> {
|
||||
match self.$op() {
|
||||
Some(v) => Ok(v),
|
||||
None => Err(ShellError::range_error(
|
||||
self.$op().ok_or_else(|| {
|
||||
ShellError::range_error(
|
||||
$ty::to_expected_range(),
|
||||
&self.item.spanned(self.tag.span),
|
||||
operation.into(),
|
||||
)),
|
||||
}
|
||||
)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
impl CoerceInto<$ty> for nu_source::Tagged<&BigDecimal> {
|
||||
fn coerce_into(self, operation: impl Into<String>) -> Result<$ty, ShellError> {
|
||||
match self.$op() {
|
||||
Some(v) => Ok(v),
|
||||
None => Err(ShellError::range_error(
|
||||
self.$op().ok_or_else(|| {
|
||||
ShellError::range_error(
|
||||
$ty::to_expected_range(),
|
||||
&self.item.spanned(self.tag.span),
|
||||
operation.into(),
|
||||
)),
|
||||
}
|
||||
)
|
||||
})
|
||||
}
|
||||
}
|
||||
};
|
||||
|
Reference in New Issue
Block a user