From 629913022f4a84b5b788b85d41f98a550769a046 Mon Sep 17 00:00:00 2001 From: firestar99 Date: Mon, 5 Jan 2026 13:17:01 +0100 Subject: [PATCH] spirv-builder: check and clippy shortcuts --- crates/spirv-builder/src/lib.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/crates/spirv-builder/src/lib.rs b/crates/spirv-builder/src/lib.rs index 797bf8588d..1d38d4b5ef 100644 --- a/crates/spirv-builder/src/lib.rs +++ b/crates/spirv-builder/src/lib.rs @@ -675,6 +675,24 @@ impl SpirvBuilder { self } + /// Shortcut for `cargo check` + pub fn check(&mut self) -> Result { + self.run_cargo_cmd("check") + } + + /// Shortcut for `cargo clippy` + pub fn clippy(&mut self) -> Result { + self.run_cargo_cmd("clippy") + } + + /// Run the supplied cargo cmd, and ensure to reset the state so [`Self::build`] still works as normal + fn run_cargo_cmd(&mut self, cmd: &str) -> Result { + let old = self.cargo_cmd.replace(cmd.into()); + let result = self.build(); + self.cargo_cmd = old; + result + } + /// Builds the module. If `print_metadata` is [`MetadataPrintout::Full`], you usually don't have to inspect the path /// in the result, as the environment variable for the path to the module will already be set. pub fn build(&self) -> Result {