paupino / rust-decimal

Decimal number implementation written in pure Rust suitable for financial and fixed-precision calculations.
https://docs.rs/rust_decimal/
MIT License
972 stars 177 forks source link

support bytemuck #635

Open dovahcrow opened 7 months ago

dovahcrow commented 7 months ago

One drawback for this PR is that it lowers the unsafe_code lint from forbid to deny because bytemuck requires unsafe.

robjtede commented 7 months ago

Would #[cfg_attr(not(feature = "bytemuck), forbid(unsafe))] work?

dovahcrow commented 7 months ago

Would #[cfg_attr(not(feature = "bytemuck), forbid(unsafe))] work?

Yeah this should work. But is it too verbose because you also need #[cfg_attr(feature = "bytemuck), deny(unsafe)]? I just feel deny is sufficient since it behaviours same as forbid but allows overridden.

robjtede commented 7 months ago

Signalling forbid is important for consumers who run cargo-geiger and have no need of the bytemuck integration.

dovahcrow commented 7 months ago

@robjtede done. I still leave deny/allow there since unsafe code is still not recommended.