Skip to content

Commit

Permalink
Fix clippy lints
Browse files Browse the repository at this point in the history
  • Loading branch information
akubera committed Oct 28, 2024
1 parent 1e96272 commit e3ffe6a
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/arithmetic/cbrt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ pub(crate) fn impl_cbrt_uint_scale(
let required_precision = 3 * required_precision;

// number of extra zeros to add to end of integer_digits
let mut exp_shift = required_precision.saturating_sub(integer_digit_count as u64);
let mut exp_shift = required_precision.saturating_sub(integer_digit_count);

// effective scale after multiplying by 10^exp_shift
// (we've added that many trailing zeros after)
Expand All @@ -65,7 +65,7 @@ pub(crate) fn impl_cbrt_uint_scale(

let result_digits = integer_digits.nth_root(3);
let result_digits_count = count_decimal_digits_uint(&result_digits);
debug_assert!(result_digits_count >= precision.get() + 1);
debug_assert!(result_digits_count > precision.get());

let digits_to_trim = result_digits_count - precision.get();
debug_assert_ne!(digits_to_trim, 0);
Expand Down
2 changes: 1 addition & 1 deletion src/impl_fmt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ fn format_ascii_digits_no_integer(
let sig_digit_count = digits_ascii_be.len();

// index where to store significant digits
let sig_digit_idx = dest_len - trailing_zeros as usize - sig_digit_count as usize;
let sig_digit_idx = dest_len - trailing_zeros as usize - sig_digit_count;

// fill output with zeros
digits_ascii_be.resize(dest_len, b'0');
Expand Down
1 change: 1 addition & 0 deletions src/impl_ops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@ macro_rules! impl_div_for_primitive {
type Output = BigDecimal;

#[cfg(rustc_1_70)] // Option::is_some_and
#[allow(clippy::incompatible_msrv)]
fn div(self, denom: $t) -> BigDecimal {
if denom.is_one() {
self
Expand Down
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,7 @@ impl BigDecimal {

/// Return this BigDecimal with the given precision, rounding if needed
#[cfg(rustc_1_46)] // Option::zip
#[allow(clippy::incompatible_msrv)]
pub fn with_precision_round(&self, prec: stdlib::num::NonZeroU64, round: RoundingMode) -> BigDecimal {
let digit_count = self.digits();
let new_prec = prec.get().to_i64();
Expand Down

0 comments on commit e3ffe6a

Please sign in to comment.