From bb1ea49f235b73dfa3ba8f6bd9b3c4d7faab2a27 Mon Sep 17 00:00:00 2001 From: Jay Oster Date: Sun, 22 Sep 2024 15:33:00 -0700 Subject: [PATCH 1/2] Forbid unsafe code - Made possible by `wgpu` 0.19: https://github.com/gfx-rs/wgpu/blob/trunk/CHANGELOG.md#safe--unified-surface-creation - Closes #238 --- examples/minimal-winit-android/src/lib.rs | 3 +++ internals/pixels-mocks/src/lib.rs | 1 + run-wasm/src/main.rs | 3 +++ src/lib.rs | 1 + 4 files changed, 8 insertions(+) diff --git a/examples/minimal-winit-android/src/lib.rs b/examples/minimal-winit-android/src/lib.rs index 6900841f..2471f6ba 100644 --- a/examples/minimal-winit-android/src/lib.rs +++ b/examples/minimal-winit-android/src/lib.rs @@ -1,3 +1,6 @@ +#![deny(clippy::all)] +#![forbid(unsafe_code)] + #[cfg(target_os = "android")] use winit::platform::android::activity::AndroidApp; diff --git a/internals/pixels-mocks/src/lib.rs b/internals/pixels-mocks/src/lib.rs index 169893ac..9e6fd43b 100644 --- a/internals/pixels-mocks/src/lib.rs +++ b/internals/pixels-mocks/src/lib.rs @@ -1,4 +1,5 @@ #![deny(clippy::all)] +#![forbid(unsafe_code)] pub struct Window; diff --git a/run-wasm/src/main.rs b/run-wasm/src/main.rs index ecda3267..d556e8e1 100644 --- a/run-wasm/src/main.rs +++ b/run-wasm/src/main.rs @@ -1,3 +1,6 @@ +#![deny(clippy::all)] +#![forbid(unsafe_code)] + fn main() { let css = r#"body { background-color: #000; diff --git a/src/lib.rs b/src/lib.rs index e45dff28..360970ac 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -30,6 +30,7 @@ //! `WGPU_ADAPTER_NAME` takes precedence. #![deny(clippy::all)] +#![forbid(unsafe_code)] pub use crate::builder::{check_texture_size, PixelsBuilder}; pub use crate::renderers::ScalingRenderer; From ad2eb1d9f6ab4f314090e448b3cff64f583440c2 Mon Sep 17 00:00:00 2001 From: Jay Oster Date: Sun, 22 Sep 2024 15:38:12 -0700 Subject: [PATCH 2/2] Add safety dance badge --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 4e0ff7e9..d2f46674 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,6 @@ [![Crates.io](https://img.shields.io/crates/v/pixels)](https://crates.io/crates/pixels "Crates.io version") [![Documentation](https://img.shields.io/docsrs/pixels)](https://docs.rs/pixels "Documentation") +[![unsafe forbidden](https://img.shields.io/badge/unsafe-forbidden-success.svg)](https://github.com/rust-secure-code/safety-dance/) [![GitHub actions](https://img.shields.io/github/actions/workflow/status/parasyte/pixels/ci.yml?branch=main)](https://github.com/parasyte/pixels/actions "CI") [![GitHub activity](https://img.shields.io/github/last-commit/parasyte/pixels)](https://github.com/parasyte/pixels/commits "Commit activity") [![GitHub Sponsors](https://img.shields.io/github/sponsors/parasyte)](https://github.com/sponsors/parasyte "Sponsors")