Skip to content

Commit ff8a63e

Browse files
authored
fix: nightly CI failures + workaround RUSTFLAGS cargo-make leak (#49)
## Changes ### 1. Fix nightly clippy + rustfmt failures Edits to pass new nightly `clippy::unnecessary_trailing_comma` [lint](https://rust-lang.github.io/rust-clippy/master/index.html?search=clippy%3A%3Aunnecessary_trailing_comma#unnecessary_trailing_comma) and nightly rustfmt import reordering. - Remove 4 unnecessary trailing commas in `format!`/`println!` macros (`general/echo/kmdf/exe/src/main.rs`) - Reorder underscore-prefixed imports to match nightly rustfmt sorting (`device.rs`, `queue.rs`, `driver.rs`) **Failed CI run:** https://github.com/microsoft/Windows-rust-driver-samples/actions/runs/22519532366 ### 2. Workaround RUSTFLAGS leaking into cargo-make/cargo-wdk builds Unset `RUSTFLAGS` for `cargo make`, `cargo wdk install`, and `cargo wdk build` steps in `build.yaml`. This prevents `-D warnings` from leaking into `rust-script` compilation of `wdk-build` (which is treated as a path dependency via symlink, bypassing cargo's `--cap-lints allow`). Temporary workaround until microsoft/windows-drivers-rs#629 is merged and a new `wdk-build` is published.
1 parent 0e5d77c commit ff8a63e

5 files changed

Lines changed: 19 additions & 13 deletions

File tree

.github/workflows/build.yaml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,13 @@ jobs:
107107
tool: cargo-make
108108

109109
- name: Build and Package Sample Drivers
110-
run: cargo make default +${{ matrix.rust_toolchain }} --locked --profile ${{ matrix.cargo_profile }} --target ${{ matrix.target_triple.name }}
110+
# Unset RUSTFLAGS for cargo-make to work around RUSTFLAGS leaking into
111+
# rust-script compilation of wdk-build (path dep via symlink defeats
112+
# --cap-lints). Upstream fix: microsoft/windows-drivers-rs#629
113+
run: |
114+
$env:RUSTFLAGS = $null
115+
cargo make default +${{ matrix.rust_toolchain }} --locked --profile ${{ matrix.cargo_profile }} --target ${{ matrix.target_triple.name }}
116+
shell: pwsh
111117

112118
# Steps to use cargo-wdk to build and package drivers
113119
- name: Install cargo-wdk binary

general/echo/kmdf/driver/DriverSync/src/device.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
use wdk::{nt_success, paged_code, println};
55
use wdk_sys::{
66
call_unsafe_wdf_function_binding,
7+
_WDF_EXECUTION_LEVEL,
8+
_WDF_SYNCHRONIZATION_SCOPE,
79
NTSTATUS,
810
STATUS_SUCCESS,
911
WDFDEVICE,
@@ -13,8 +15,6 @@ use wdk_sys::{
1315
WDF_NO_HANDLE,
1416
WDF_OBJECT_ATTRIBUTES,
1517
WDF_PNPPOWER_EVENT_CALLBACKS,
16-
_WDF_EXECUTION_LEVEL,
17-
_WDF_SYNCHRONIZATION_SCOPE,
1818
};
1919

2020
use crate::{

general/echo/kmdf/driver/DriverSync/src/queue.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ use wdk::{nt_success, paged_code, println, wdf};
77
use wdk_sys::{
88
call_unsafe_wdf_function_binding,
99
ntddk::{ExAllocatePool2, ExFreePool},
10+
_WDF_EXECUTION_LEVEL,
11+
_WDF_IO_QUEUE_DISPATCH_TYPE,
12+
_WDF_SYNCHRONIZATION_SCOPE,
13+
_WDF_TRI_STATE,
1014
NTSTATUS,
1115
POOL_FLAG_NON_PAGED,
1216
SIZE_T,
@@ -25,10 +29,6 @@ use wdk_sys::{
2529
WDF_NO_HANDLE,
2630
WDF_OBJECT_ATTRIBUTES,
2731
WDF_TIMER_CONFIG,
28-
_WDF_EXECUTION_LEVEL,
29-
_WDF_IO_QUEUE_DISPATCH_TYPE,
30-
_WDF_SYNCHRONIZATION_SCOPE,
31-
_WDF_TRI_STATE,
3232
};
3333

3434
use crate::{

general/echo/kmdf/exe/src/main.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ fn async_io_work(io_type: u32) -> Result<(), Box<dyn Error>> {
413413
// - Memory safety: Returns u32 value (no pointer dereferences)
414414
let error = unsafe { GetLastError() };
415415
if error != ERROR_IO_PENDING {
416-
return Err(format!("{i}th Read failed {error}",).into());
416+
return Err(format!("{i}th Read failed {error}").into());
417417
}
418418
}
419419
} else {
@@ -488,7 +488,7 @@ fn async_io_work(io_type: u32) -> Result<(), Box<dyn Error>> {
488488
}
489489

490490
if io_type == READER_TYPE {
491-
println!("Number of bytes read by request number {i} is {number_of_bytes_transferred}",);
491+
println!("Number of bytes read by request number {i} is {number_of_bytes_transferred}");
492492

493493
if globals.limited_loops {
494494
remaining_requests_to_receive -= 1;
@@ -539,7 +539,7 @@ fn async_io_work(io_type: u32) -> Result<(), Box<dyn Error>> {
539539
}
540540
} else {
541541
println!(
542-
"Number of bytes written by request number {i} is {number_of_bytes_transferred}",
542+
"Number of bytes written by request number {i} is {number_of_bytes_transferred}"
543543
);
544544

545545
if globals.limited_loops {
@@ -636,7 +636,7 @@ fn get_device_path(interface_guid: &Uuid) -> Result<(), Box<dyn Error>> {
636636

637637
if config_ret != DeviceAndDriverInstallation::CR_SUCCESS {
638638
return Err(
639-
format!("Error 0x{config_ret:08X} retrieving device interface list size.",).into(),
639+
format!("Error 0x{config_ret:08X} retrieving device interface list size.").into(),
640640
);
641641
}
642642

tools/dv/kmdf/fail_driver_pool_leak/src/driver.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ use wdk::{nt_success, paged_code, println};
55
use wdk_sys::{
66
call_unsafe_wdf_function_binding,
77
ntddk::ExAllocatePool2,
8+
_WDF_EXECUTION_LEVEL,
9+
_WDF_SYNCHRONIZATION_SCOPE,
810
DRIVER_OBJECT,
911
NTSTATUS,
1012
PCUNICODE_STRING,
@@ -19,8 +21,6 @@ use wdk_sys::{
1921
WDF_NO_HANDLE,
2022
WDF_NO_OBJECT_ATTRIBUTES,
2123
WDF_OBJECT_ATTRIBUTES,
22-
_WDF_EXECUTION_LEVEL,
23-
_WDF_SYNCHRONIZATION_SCOPE,
2424
};
2525

2626
use crate::{GLOBAL_BUFFER, GUID_DEVINTERFACE};

0 commit comments

Comments
 (0)