diff --git a/src/lib.rs b/src/lib.rs index 3bbe6c9..2bbfa9e 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -33,6 +33,7 @@ pub use overlay::{Overlay, OverlayAt}; /// like assert!(), but causes undefined behaviour at runtime when the condition is not met. /// /// # Safety +/// /// UB if condition is false. macro_rules! assert_unchecked { ($cond:expr) => {{ diff --git a/src/overlay.rs b/src/overlay.rs index cb11d78..3dbc45e 100644 --- a/src/overlay.rs +++ b/src/overlay.rs @@ -28,8 +28,8 @@ pub trait Overlay { /// See [blit](https://en.wikipedia.org/wiki/Bit_blit) /// /// # Safety -/// UB if rgb.len() % 3 != 0 -/// UB if rgba.len() % 4 != 0 +/// - UB if rgb.len() % 3 != 0 +/// - UB if rgba.len() % 4 != 0 unsafe fn blit(rgb: &mut [u8], rgba: &[u8]) { let mut srci = 0; let mut dsti = 0; @@ -180,9 +180,9 @@ impl OverlayAt> for Image<&mut [u8], 4> { /// Overlay with => self at coordinates x, y, without blending /// /// # Safety - /// UB if x, y is out of bounds - /// UB if x + with.width() > u32::MAX - /// UB if y + with.height() > u32::MAX + /// - UB if x, y is out of bounds + /// - UB if x + with.width() > [`u32::MAX`] + /// - UB if y + with.height() > [`u32::MAX`] unsafe fn overlay_at(&mut self, with: &Image<&[u8], 4>, x: u32, y: u32) -> &mut Self { for j in 0..with.height() { for i in 0..with.width() {