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 {