Skip to content

Replace Manual Modulo (%) checks with .is_multiple_of() #925

Description

@showmyth

Clippy is reporting 21 instances where % should be replaced with the .is_multiple_of() method for better code clarity and idiomaticity.

List of Affected Files :

  • src/ciphers/aes.rs (lines 321, 351)
  • src/ciphers/blake2b.rs (line 58)
  • src/ciphers/sha3.rs (line 274)
  • src/data_structures/probabilistic/bloom_filter.rs (line 112)
  • src/general/permutations/heap.rs (line 26)
  • src/math/aliquot_sum.rs (line 14)
  • src/math/collatz_sequence.rs (line 9)
  • src/math/factors.rs (line 10)
  • src/math/interquartile_range.rs (lines 15, 32)
  • src/math/perfect_numbers.rs (line 5)
  • src/math/pollard_rho.rs (lines 140, 204)
  • src/math/prime_check.rs (lines 4, 10)
  • src/math/prime_factors.rs (line 8)
  • src/math/quadratic_residue.rs (line 81)
  • src/number_theory/euler_totient.rs (lines 9, 12)

Required Changes

Replace patterns like:
number % divisor == 0 OR number % divisor != 0 with number.is_multiple_of(divisor)

Clippy Warning

error: manual implementation of .is_multiple_of()
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_is_multiple_of

Activity

  1. triuyen commented on Oct 10, 2025

    @triuyen
    Contributor

    Hey @showmyth, any chance we can get this resolved? It's holding up a few pull requests.

  2. showmyth commented on Oct 10, 2025

    @showmyth
    ContributorAuthor

    pretty sure my last PR (#921) fixes it, would be grateful if you could take a look

  3. github-actions commented on Nov 11, 2025

    @github-actions

    This issue has been automatically marked as abandoned because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

  4. github-actions commented on Nov 18, 2025

    @github-actions

    Please ping one of the maintainers once you add more information and updates here. If this is not the case and you need some help, feel free to ask for help in our Gitter channel. Thank you for your contributions!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions