Swoorup / wgsl-bindgen

Generate typesafe Rust bindings for wgsl shaders in wgpu
https://crates.io/crates/wgsl_bindgen
MIT License
33 stars 6 forks source link

Bind group entries refactor #23

Closed Swoorup closed 3 months ago

Swoorup commented 3 months ago

Bindgroups

gooroo-dev[bot] commented 3 months ago

Please double-check what I found in the pull request:

🐞Mistake 🤪Typo 🚨Security 🚀Performance 💪Best Practices 📖Readability ❓Others
0 0 0 0 0 1 0

Summary of Proposed Changes

Identified Issues

ID Type Details Severity Confidence
1 📖Readability The pub use self::bind_groups::*; statement is repeated multiple times and may be redundant. 🟡Low 🟡Low

Issue 1: Repeated pub use self::bind_groups::*; Statement

The pub use self::bind_groups::*; statement is repeated in multiple places, which can be redundant and affect readability.

File Path: example/src/shader_bindings.rs, wgsl_bindgen/src/generate/bind_group/mod.rs, wgsl_bindgen/tests/output/bindgen_bevy.expected.rs, wgsl_bindgen/tests/output/bindgen_main.expected.rs, wgsl_bindgen/tests/output/bindgen_minimal.expected.rs, wgsl_bindgen/tests/output/bindgen_padding.expected.rs

Lines of Code:

+    pub use self::bind_groups::*;

Suggested Fix: Remove the redundant pub use self::bind_groups::*; statements from the files where they are not necessary.

Code:

diff --git a/example/src/shader_bindings.rs b/example/src/shader_bindings.rs
index a33bdb8..new_index 100644
--- a/example/src/shader_bindings.rs
+++ b/example/src/shader_bindings.rs
@@ -892,7 +892,6 @@ pub mod testbed {
             }
         }
     }
-    pub use self::bind_groups::*;
     pub fn set_bind_groups<'a>(
         pass: &mut wgpu::ComputePass<'a>,
         bind_group0: &'a bind_groups::WgpuBindGroup0,
@@ -1439,7 +1438,6 @@ pub mod triangle {
             }
         }
     }
-    pub use self::bind_groups::*;
     pub fn set_bind_groups<'a>(
         pass: &mut wgpu::RenderPass<'a>,
         bind_group0: &'a bind_groups::WgpuBindGroup0,

Explanation: The pub use self::bind_groups::*; statement is used to re-export the contents of the bind_groups module. However, if this statement is repeated in multiple places, it can be redundant and affect readability. Removing the redundant statements will improve the overall readability of the code.

General Review of Code Quality and Style

Overall, the code quality and style are good. The refactoring improves the structure and readability of the bind group entry creation process. However, the repeated pub use self::bind_groups::*; statements should be addressed to further enhance readability.

Summon me to re-review when updated! Yours, Gooroo.dev React or reply to let me know your thoughts!