Repository: bitshifter/glam-rs
Pull request #302 (2022-06-22 13:37:54)

ci: Run clippy against `--all-targets` and fix fallout in tests/benches
This is going to conflict with another PR but it depends on which one makes it in first :)



Patch:
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 043f7b8..9542a9e 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -20,7 +20,7 @@ jobs:
       # run clippy to verify we have no warnings
       - run: cargo fetch
       - name: cargo clippy
-        run: cargo clippy --workspace --all-features -- -D warnings
+        run: cargo clippy --workspace --all-targets --all-features -- -D warnings
 
       - name: codegen
         run: cargo run
diff --git a/benches/vec3.rs b/benches/vec3.rs
index a8d8b6a..78d5d63 100644
--- a/benches/vec3.rs
+++ b/benches/vec3.rs
@@ -19,7 +19,7 @@ bench_binop!(
 #[inline]
 fn vec3_to_rgb_op(v: Vec3) -> u32 {
     let (red, green, blue) = (v.min(Vec3::ONE).max(Vec3::ZERO) * 255.0).into();
-    ((red as u32) << 16 | (green as u32) << 8 | (blue as u32)).into()
+    (red as u32) << 16 | (green as u32) << 8 | (blue as u32)
 }
 
 #[inline]
diff --git a/codegen/Cargo.toml b/codegen/Cargo.toml
index 08fa86a..51df774 100644
--- a/codegen/Cargo.toml
+++ b/codegen/Cargo.toml
@@ -6,7 +6,7 @@ edition = "2021"
 # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
 
 [dependencies]
-anyhow = { version = "1", default-features = false }
+anyhow = { version = "1" }
 clap = { version = "3", default-features = false, features = ["cargo", "std"] }
 git2 = { version = "0.14", default-features = false }
 globset = { version = "0.4", default-features = false }
diff --git a/codegen/src/main.rs b/codegen/src/main.rs
index 1cde7e7..bc88942 100644
--- a/codegen/src/main.rs
+++ b/codegen/src/main.rs
@@ -517,6 +517,9 @@ fn build_output_pairs() -> HashMap<&'static str, tera::Context> {
 }
 
 fn main() -> anyhow::Result<()> {
+    // Change into `./codegen` dir for convenience to the user
+    std::env::set_current_dir(env!("CARGO_MANIFEST_DIR"))?;
+
     let matches = command!()
         .arg(arg!([GLOB]))
         .arg(arg!(-f - -force))


Test patch:
diff --git a/build_and_test_features.sh b/build_and_test_features.sh
index 8270574..47d82a5 100755
--- a/build_and_test_features.sh
+++ b/build_and_test_features.sh
@@ -26,4 +26,4 @@ done
 
 RUSTFLAGS='-C target-feature=+fma' cargo check
 
-cargo check -p glam-no_std
+cargo check -p glam-no_std
\ No newline at end of file
diff --git a/tests/quat.rs b/tests/quat.rs
index 67a3384..a213f8c 100644
--- a/tests/quat.rs
+++ b/tests/quat.rs
@@ -1,3 +1,5 @@
+#![allow(clippy::excessive_precision)]
+
 #[macro_use]
 mod support;
 
diff --git a/tests/vec2.rs b/tests/vec2.rs
index 47f4c10..16bfdc8 100644
--- a/tests/vec2.rs
+++ b/tests/vec2.rs
@@ -1,3 +1,5 @@
+#![allow(clippy::excessive_precision)]
+
 #[macro_use]
 mod support;
 
diff --git a/tests/vec3.rs b/tests/vec3.rs
index c0f990c..6c38e8b 100644
--- a/tests/vec3.rs
+++ b/tests/vec3.rs
@@ -1,3 +1,5 @@
+#![allow(clippy::excessive_precision)]
+
 #[macro_use]
 mod support;
 
diff --git a/tests/vec4.rs b/tests/vec4.rs
index 3c1d7f5..d375d08 100644
--- a/tests/vec4.rs
+++ b/tests/vec4.rs
@@ -1,3 +1,5 @@
+#![allow(clippy::excessive_precision)]
+
 #[macro_use]
 mod support;