Skip to content

Commit 29d48aa

Browse files
committed
chore[dtype]: use NonZero fro decimal precision
Signed-off-by: Joe Isaacs <[email protected]>
1 parent 02db2a1 commit 29d48aa

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

vortex-dtype/src/decimal/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use std::num::NonZero;
1111
use num_traits::ToPrimitive;
1212
pub use precision::*;
1313
pub use types::*;
14-
use vortex_error::{VortexError, VortexExpect, VortexResult, vortex_bail, vortex_panic};
14+
use vortex_error::{VortexError, VortexExpect, VortexResult, vortex_bail, vortex_panic, vortex_err};
1515

1616
use crate::{DType, i256};
1717

@@ -36,7 +36,7 @@ impl DecimalDType {
3636
/// Returns an error if precision exceeds MAX_PRECISION or scale is outside [MIN_SCALE, MAX_SCALE].
3737
pub fn try_new(precision: u8, scale: i8) -> VortexResult<Self> {
3838
let precision = NonZero::new(precision).ok_or_else(|| {
39-
vortex_error::vortex_err!(
39+
vortex_err!(
4040
"decimal precision must be between 1 and {} (inclusive)",
4141
MAX_PRECISION
4242
)

vortex-dtype/src/decimal/precision.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use std::fmt::Display;
66
use std::marker::PhantomData;
77
use std::num::NonZero;
88

9-
use vortex_error::{VortexExpect, VortexResult, vortex_bail};
9+
use vortex_error::{VortexExpect, VortexResult, vortex_bail, vortex_err};
1010

1111
use crate::{DecimalDType, NativeDecimalType};
1212

@@ -44,7 +44,7 @@ impl<D: NativeDecimalType> PrecisionScale<D> {
4444
/// Try to create a new [`PrecisionScale`] with the given precision and scale.
4545
pub fn try_new(precision: u8, scale: i8) -> VortexResult<Self> {
4646
let precision = NonZero::new(precision).ok_or_else(|| {
47-
vortex_error::vortex_err!(
47+
vortex_err!(
4848
"precision cannot be 0, has to be between [1, {}]",
4949
D::MAX_PRECISION
5050
)

0 commit comments

Comments
 (0)