From cee56a440db154e8c6eb84c6d707f44277e04bbe Mon Sep 17 00:00:00 2001 From: JamBalaya56562 Date: Sun, 23 Aug 2026 16:55:08 +0900 Subject: [PATCH] fix(test): compile the platform-conditional fixtures warning-free on windows MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Two warnings only a Windows compiler can see, both created by `#[cfg]`: - `conformance/tests/derive_settings.rs` imports `WarningKind` at the top of the file, and the only test that uses it is `#[cfg(unix)]` — it builds a non-UTF-8 path with `OsStr::from_bytes`. Everywhere else the import is unused. It moves inside, beside the `OsStrExt` import already there. - `usage-rs/tests/facade.rs` has an `enum Shell` whose `PowerShell` variant is `#[cfg(windows)]`. With that variant a name ends with the enum's own and `clippy::enum_variant_names` fires; without it nothing does. Allowed with a reason rather than renamed: `PowerShell` is what the shell is called, and a spelling chosen to satisfy the lint would be one no user types. `mise r lint:clippy` passes `--all-targets` and denies warnings, so on Windows these are a build failure rather than noise. Found by running clippy on windows-latest in a fork, ahead of adding that job upstream. Co-Authored-By: Claude Opus 5 --- conformance/tests/derive_settings.rs | 3 ++- usage-rs/tests/facade.rs | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/conformance/tests/derive_settings.rs b/conformance/tests/derive_settings.rs index b668570ac..27d493dbc 100644 --- a/conformance/tests/derive_settings.rs +++ b/conformance/tests/derive_settings.rs @@ -12,7 +12,7 @@ use std::ffi::OsStr; use std::path::PathBuf; -use usage_config::{resolve, Const, Layers, PropMeta, Registry, Ty, Value, WarningKind}; +use usage_config::{resolve, Const, Layers, PropMeta, Registry, Ty, Value}; use usage_derive::Cli; /// A tool with settings @@ -177,6 +177,7 @@ fn a_value_that_is_not_text_is_reported_rather_than_rendered() { // still held the real bytes, and the command line's answer is the one that outranks every file // on the machine. use std::os::unix::ffi::OsStrExt; + use usage_config::WarningKind; let bytes = OsStr::from_bytes(b"/etc/co\xffnfig"); let argv = [OsStr::new("--config"), bytes]; diff --git a/usage-rs/tests/facade.rs b/usage-rs/tests/facade.rs index 7c4766065..dda2351e7 100644 --- a/usage-rs/tests/facade.rs +++ b/usage-rs/tests/facade.rs @@ -1332,6 +1332,11 @@ struct StrictFlatten { #[derive(ValueEnum)] #[usage(ignore_case)] +// `PowerShell` ends with the enum name, which `clippy::enum_variant_names` reads as a prefix +// worth hoisting. It is the shell's actual name, and the lint only fires on Windows, where the +// variant exists at all — a rename to satisfy it would leave the enum spelling something no +// user types. +#[allow(clippy::enum_variant_names)] enum Shell { #[usage( aliases(["bourne-again", "bash-shell"]),