From 4ece25bd05503d46aef080943122e396bee5fccc Mon Sep 17 00:00:00 2001 From: YgorSouza <43298013+YgorSouza@users.noreply.github.com> Date: Wed, 22 Nov 2023 20:37:46 +0100 Subject: [PATCH] Keep unsafe code forbidden when puffin is disabled (#3603) This helps document what unsafe is being used for, and prevent other uses from going unnoticed. --- crates/egui/src/lib.rs | 3 ++- crates/egui_demo_lib/src/lib.rs | 3 ++- crates/egui_extras/src/lib.rs | 3 ++- crates/emath/src/lib.rs | 3 ++- crates/epaint/src/lib.rs | 3 ++- 5 files changed, 10 insertions(+), 5 deletions(-) diff --git a/crates/egui/src/lib.rs b/crates/egui/src/lib.rs index a008ea4cdee..377860057fc 100644 --- a/crates/egui/src/lib.rs +++ b/crates/egui/src/lib.rs @@ -336,7 +336,8 @@ #![allow(clippy::float_cmp)] #![allow(clippy::manual_range_contains)] -#![deny(unsafe_code)] +#![cfg_attr(feature = "puffin", deny(unsafe_code))] +#![cfg_attr(not(feature = "puffin"), forbid(unsafe_code))] mod animation_manager; pub mod containers; diff --git a/crates/egui_demo_lib/src/lib.rs b/crates/egui_demo_lib/src/lib.rs index 051eedb348a..f45b1f6db4b 100644 --- a/crates/egui_demo_lib/src/lib.rs +++ b/crates/egui_demo_lib/src/lib.rs @@ -10,7 +10,8 @@ #![allow(clippy::float_cmp)] #![allow(clippy::manual_range_contains)] -#![deny(unsafe_code)] +#![cfg_attr(feature = "puffin", deny(unsafe_code))] +#![cfg_attr(not(feature = "puffin"), forbid(unsafe_code))] mod color_test; mod demo; diff --git a/crates/egui_extras/src/lib.rs b/crates/egui_extras/src/lib.rs index 1189af9bd99..e899106cd45 100644 --- a/crates/egui_extras/src/lib.rs +++ b/crates/egui_extras/src/lib.rs @@ -8,7 +8,8 @@ #![allow(clippy::float_cmp)] #![allow(clippy::manual_range_contains)] -#![deny(unsafe_code)] +#![cfg_attr(feature = "puffin", deny(unsafe_code))] +#![cfg_attr(not(feature = "puffin"), forbid(unsafe_code))] #[cfg(feature = "chrono")] mod datepicker; diff --git a/crates/emath/src/lib.rs b/crates/emath/src/lib.rs index fdded0a869d..4c6947bd074 100644 --- a/crates/emath/src/lib.rs +++ b/crates/emath/src/lib.rs @@ -20,7 +20,8 @@ //! #![allow(clippy::float_cmp)] -#![deny(unsafe_code)] +#![cfg_attr(feature = "puffin", deny(unsafe_code))] +#![cfg_attr(not(feature = "puffin"), forbid(unsafe_code))] use std::ops::{Add, Div, Mul, RangeInclusive, Sub}; diff --git a/crates/epaint/src/lib.rs b/crates/epaint/src/lib.rs index 058bcda4f28..18193dba132 100644 --- a/crates/epaint/src/lib.rs +++ b/crates/epaint/src/lib.rs @@ -22,7 +22,8 @@ #![allow(clippy::float_cmp)] #![allow(clippy::manual_range_contains)] -#![deny(unsafe_code)] +#![cfg_attr(feature = "puffin", deny(unsafe_code))] +#![cfg_attr(not(feature = "puffin"), forbid(unsafe_code))] mod bezier; pub mod image;