Use is_multiple_of instead of % == 0 (#3244)

I was reading the changelog of 1.87 and noticed that it's stable now.
Realised that I saw a todo in the code :)

https://releases.rs/docs/1.87.0/
This commit is contained in:
Ivan Gulakov 2025-05-17 00:13:31 +02:00 committed by GitHub
parent bb24fb555b
commit 4763ada075
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -724,8 +724,7 @@ impl IntelPTBuilder {
/// Set the size of the perf aux buffer (actual PT traces buffer)
pub fn perf_aux_buffer_size(mut self, perf_aux_buffer_size: usize) -> Result<Self, Error> {
// todo:replace with is_multiple_of once stable
if perf_aux_buffer_size % PAGE_SIZE != 0 {
if !perf_aux_buffer_size.is_multiple_of(PAGE_SIZE) {
return Err(Error::illegal_argument(
"IntelPT perf_aux_buffer must be page aligned",
));