Skip to content

Commit a3e3911

Browse files
committed
snipe off some unsafe code
1 parent aa03bfc commit a3e3911

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

src/validators/decimal.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -182,11 +182,7 @@ impl Validator for DecimalValidator {
182182

183183
if let Some(multiple_of) = &self.multiple_of {
184184
// fraction = (decimal / multiple_of) % 1
185-
let fraction = unsafe {
186-
let division = decimal.div(multiple_of)?;
187-
let one = 1u8.into_pyobject(py)?;
188-
Bound::from_owned_ptr_or_err(py, pyo3::ffi::PyNumber_Remainder(division.as_ptr(), one.as_ptr()))?
189-
};
185+
let fraction = (decimal.div(multiple_of)?).rem(1)?;
190186
let zero = 0u8.into_pyobject(py)?;
191187
if !fraction.eq(&zero)? {
192188
return Err(ValError::new(

0 commit comments

Comments
 (0)