Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions crates/spirv-builder/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -675,6 +675,24 @@ impl SpirvBuilder {
self
}

/// Shortcut for `cargo check`
pub fn check(&mut self) -> Result<CompileResult, SpirvBuilderError> {
self.run_cargo_cmd("check")
}

/// Shortcut for `cargo clippy`
pub fn clippy(&mut self) -> Result<CompileResult, SpirvBuilderError> {
Comment on lines +679 to +684
Copy link
Member Author

@Firestar99 Firestar99 Jan 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not a huge fan how these are &mut self but build() is only &self. But I also don't want to clone the entire SpirvBuilder just to change that one property, though it probably wouldn't matter performance-wise. Suggestions?

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<CompileResult, SpirvBuilderError> {
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<CompileResult, SpirvBuilderError> {
Expand Down