Skip to content
This repository was archived by the owner on Apr 15, 2026. It is now read-only.

Commit 9fd7aef

Browse files
committed
clippy: add cargo gpu clippy
1 parent bb74342 commit 9fd7aef

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

crates/cargo-gpu/src/config.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ impl Config {
3131
) -> anyhow::Result<crate::build::Build> {
3232
let mut config = metadata.as_json(shader_crate_path)?;
3333

34-
env_args.retain(|arg| !(arg == "build" || arg == "install"));
34+
env_args.retain(|arg| !(arg == "build" || arg == "install" || arg == "clippy"));
3535
let cli_args_json = Self::cli_args_to_json(env_args)?;
3636
Self::json_merge(&mut config, cli_args_json, None)?;
3737

crates/cargo-gpu/src/lib.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,9 @@ pub enum Command {
105105
/// Compile a shader crate to SPIR-V.
106106
Build(Box<Build>),
107107

108+
/// Run clippy on a shader crate with a SPIR-V target
109+
Clippy(Box<Build>),
110+
108111
/// Show some useful values.
109112
Show(Show),
110113

@@ -140,13 +143,16 @@ impl Command {
140143
);
141144
command.install.run()?;
142145
}
143-
Self::Build(build) => {
146+
Self::Build(build) | Self::Clippy(build) => {
144147
let shader_crate_path = &build.install.shader_crate;
145148
let mut command = config::Config::clap_command_with_cargo_config(
146149
shader_crate_path,
147150
env_args,
148151
metadata_cache,
149152
)?;
153+
if matches!(&self, Self::Clippy(..)) {
154+
command.build.spirv_builder.cargo_cmd = Some("clippy".into());
155+
}
150156
log::debug!("building with final merged arguments: {command:#?}");
151157

152158
if command.build.watch {

0 commit comments

Comments
 (0)