repo: Fix lints for Rust 1.90#2020
Merged
smalis-msft merged 1 commit intomicrosoft:mainfrom Sep 18, 2025
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR addresses new Rust 1.90 lints by replacing manual modular arithmetic with the is_multiple_of helper method and removing unnecessary parentheses. The changes are primarily automatic lint fixes with one manual addition of #[allow(dead_code)] for a protocol definitions file.
- Replaces
x % y != 0with!x.is_multiple_of(y)andx % y == 0withx.is_multiple_of(y)throughout the codebase - Removes redundant parentheses around expressions and type annotations
- Adds
#[allow(dead_code)]to a protocol file where not all definitions are currently used
Reviewed Changes
Copilot reviewed 57 out of 57 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| vmm_core/virt_kvm/src/arch/aarch64/mod.rs | Replace modular arithmetic with is_multiple_of for GIC alignment checks |
| vmm_core/src/synic.rs | Remove unnecessary parentheses from boxed trait object return types |
| vm/x86/x86emu/src/emulator.rs | Replace modular arithmetic with is_multiple_of for alignment validation |
| vm/x86/tdcall/src/lib.rs | Replace modular arithmetic with is_multiple_of for large page alignment |
| vm/vmgs/vmgstool/src/main.rs | Replace modular arithmetic with is_multiple_of for sector size validation |
| vm/vmgs/vmgs_lib/src/lib.rs | Replace modular arithmetic with is_multiple_of for file size validation |
| vm/vmgs/vmgs_format/src/lib.rs | Replace modular arithmetic with is_multiple_of in const assertions |
| vm/vmcore/memory_range/src/lib.rs | Replace modular arithmetic with is_multiple_of for page alignment |
| vm/vmcore/guestmem/src/lib.rs | Replace modular arithmetic with is_multiple_of and remove redundant parentheses |
| vm/page_pool_alloc/src/lib.rs | Replace modular arithmetic with is_multiple_of for page size validation |
| vm/loader/src/paravisor.rs | Replace modular arithmetic with is_multiple_of for memory alignment checks |
| vm/loader/src/linux.rs | Replace modular arithmetic with is_multiple_of for address alignment |
| vm/loader/page_table/src/x64.rs | Replace modular arithmetic with is_multiple_of for page table alignment |
| vm/loader/igvmfilegen/src/file_loader.rs | Replace modular arithmetic with is_multiple_of for relocation validation |
| vm/hv1/hv1_hypercall/src/tests.rs | Replace modular arithmetic with is_multiple_of in test assertions |
| vm/hv1/hv1_hypercall/src/support.rs | Replace modular arithmetic with is_multiple_of for buffer alignment |
| vm/devices/vmbus/vmbus_server/src/tests.rs | Remove unnecessary parentheses from boxed trait object return types |
| vm/devices/vmbus/vmbus_ring/src/lib.rs | Replace modular arithmetic with is_multiple_of for alignment checks |
| vm/devices/vmbus/vmbus_channel/src/gpadl_ring.rs | Replace modular arithmetic with is_multiple_of for page size validation |
| vm/devices/vmbus/vmbfs/src/protocol.rs | Add #[allow(dead_code)] for unused protocol definitions |
| vm/devices/virtio/virtiofs/src/section.rs | Replace modular arithmetic with is_multiple_of for page size validation |
| vm/devices/virtio/virtio_p9/src/lib.rs | Replace modular arithmetic with is_multiple_of for alignment assertions |
| vm/devices/user_driver/src/vfio.rs | Replace modular arithmetic with is_multiple_of for memory alignment |
| vm/devices/user_driver/src/lockmem.rs | Replace modular arithmetic with is_multiple_of for page size validation |
| vm/devices/storage/nvme_test/src/workers.rs | Replace modular arithmetic with is_multiple_of in const assertion |
| vm/devices/storage/nvme_resources/src/fault.rs | Remove redundant parentheses from comparison expressions |
| vm/devices/storage/nvme/src/workers.rs | Replace modular arithmetic with is_multiple_of in const assertion |
| vm/devices/storage/disklayer_ram/src/lib.rs | Replace modular arithmetic with is_multiple_of for sector size validation |
| vm/devices/storage/disk_striped/src/lib.rs | Replace modular arithmetic with is_multiple_of for chunk size validation |
| vm/devices/storage/disk_get_vmgs/src/lib.rs | Replace modular arithmetic with is_multiple_of for sector count validation |
| vm/devices/storage/disk_backend/src/sync_wrapper.rs | Replace modular arithmetic with is_multiple_of for buffer size checks |
| vm/devices/pci/pci_core/src/cfg_space_emu.rs | Replace modular arithmetic with is_multiple_of for offset alignment |
| vm/devices/net/netvsp/src/lib.rs | Remove redundant parentheses and simplify filter expression |
| vm/devices/net/net_mana/src/lib.rs | Replace modular arithmetic with is_multiple_of in test assertion |
| vm/devices/net/mana_driver/src/queues.rs | Replace modular arithmetic with is_multiple_of for WQE alignment |
| vm/devices/net/gdma/src/queues.rs | Replace modular arithmetic with is_multiple_of for alignment check |
| vm/devices/net/gdma/src/dma.rs | Replace modular arithmetic with is_multiple_of for DMA region alignment |
| vm/devices/hyperv_ic/src/kvp.rs | Replace modular arithmetic with is_multiple_of for string length validation |
| vm/devices/firmware/uefi_nvram_specvars/src/signature_list.rs | Replace modular arithmetic with is_multiple_of for signature size validation |
| vm/devices/chipset/src/dma.rs | Replace modular arithmetic with is_multiple_of for register access |
| vm/acpi/src/builder.rs | Replace modular arithmetic with is_multiple_of for table length alignment |
| support/ucs2/src/lib.rs | Replace modular arithmetic with is_multiple_of for UCS-2 buffer validation |
| support/sparse_mmap/src/windows.rs | Replace modular arithmetic with is_multiple_of for page alignment |
| support/sparse_mmap/src/unix.rs | Replace modular arithmetic with is_multiple_of for page alignment |
| support/sparse_mmap/fuzz/fuzz_sparse_mmap.rs | Replace modular arithmetic with is_multiple_of for page block validation |
| support/pal/src/unix/process/linux.rs | Replace modular arithmetic with is_multiple_of for stack size validation |
| support/pal/src/unix/affinity.rs | Replace modular arithmetic with is_multiple_of for hex string validation |
| support/fdt/src/parser.rs | Replace modular arithmetic with is_multiple_of for buffer alignment |
| openvmm/hvlite_core/src/worker/vm_loaders/igvm.rs | Replace modular arithmetic with is_multiple_of for memory range validation |
| openhcl/underhill_mem/src/mapping.rs | Replace modular arithmetic with is_multiple_of for bitmap alignment |
| openhcl/sidecar_client/src/lib.rs | Replace modular arithmetic with is_multiple_of in const assertion |
| openhcl/openhcl_boot/src/hypercall.rs | Replace modular arithmetic with is_multiple_of for page alignment |
| openhcl/openhcl_boot/src/arch/x86_64/snp.rs | Replace modular arithmetic with is_multiple_of for page alignment |
| openhcl/openhcl_boot/src/arch/x86_64/memory.rs | Replace modular arithmetic with is_multiple_of for large page alignment |
| openhcl/openhcl_boot/src/arch/x86_64/address_space.rs | Replace modular arithmetic with is_multiple_of for virtual address alignment |
| openhcl/hcl/src/vmsa.rs | Replace modular arithmetic with is_multiple_of for register offset alignment |
| openhcl/hcl/src/ioctl.rs | Replace modular arithmetic with is_multiple_of for variable input validation |
benhillis
approved these changes
Sep 18, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The vast majority of these are a new lint that replaces manual modular arithmetic with the is_multiple_of helper, which were all just applied automatically. There were also a few cases of extra unneeded parentheses, and one new allow(dead_code) in a protocol definitions file since not all of it is used today.