Skip to content

Commit

Permalink
snipe off some unsafe code
Browse files Browse the repository at this point in the history
  • Loading branch information
davidhewitt committed Feb 6, 2025
1 parent aa03bfc commit a3e3911
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions src/validators/decimal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,11 +182,7 @@ impl Validator for DecimalValidator {

if let Some(multiple_of) = &self.multiple_of {
// fraction = (decimal / multiple_of) % 1
let fraction = unsafe {
let division = decimal.div(multiple_of)?;
let one = 1u8.into_pyobject(py)?;
Bound::from_owned_ptr_or_err(py, pyo3::ffi::PyNumber_Remainder(division.as_ptr(), one.as_ptr()))?
};
let fraction = (decimal.div(multiple_of)?).rem(1)?;
let zero = 0u8.into_pyobject(py)?;
if !fraction.eq(&zero)? {
return Err(ValError::new(
Expand Down

0 comments on commit a3e3911

Please sign in to comment.