Skip to content

Rustfmt-related pre-commit check fails #5180

Open
@m3m3ntO37

Description

@m3m3ntO37

I'm currently preparing a PR, and while following the contribution guide, I ran into issues with rustfmt during the pre-commit hook.

It seems like several files in the current codebase don’t actually pass the check cleanly. As a result, any PR I submit would either:

  1. include unrelated rustfmt changes alongside my intended changes, or
  2. fail the pre-commit check

For example, in vmm/src/builder.rs, here are a couple of diffs produced by rustfmt on my environment:

-    use crate::vmm_config::balloon::{BALLOON_DEV_ID, BalloonBuilder, BalloonDeviceConfig};     
+    use crate::vmm_config::balloon::{BalloonBuilder, BalloonDeviceConfig, BALLOON_DEV_ID};

[...]
-            assert!(                                                                           
-                vmm.mmio_device_manager
-                    .get_device(DeviceType::Virtio(TYPE_BLOCK), drive_id.as_str())
-                    .is_some()
-            );
+            assert!(vmm 
+                .mmio_device_manager
+                .get_device(DeviceType::Virtio(TYPE_BLOCK), drive_id.as_str())
+                .is_some());
         }

My environment is:

$ rustc --version
rustc 1.85.0 (4d91de4e4 2025-02-17)
$ rustfmt --version
rustfmt 1.8.0-stable (4d91de4e48 2025-02-17)

Could you clarify the expected approach in this situation?
Thanks.

Metadata

Metadata

Assignees

Labels

Status: WIPIndicates that an issue is currently being worked on or triaged

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions