firecracker icon indicating copy to clipboard operation
firecracker copied to clipboard

Rustfmt-related pre-commit check fails

Open m3m3ntO37 opened this issue 6 months ago • 1 comments

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.

m3m3ntO37 avatar May 01 '25 10:05 m3m3ntO37