diff --git a/src/affine.rs b/src/affine.rs index 15e25f6..f7bfadd 100644 --- a/src/affine.rs +++ b/src/affine.rs @@ -1,5 +1,5 @@ //! Manages the affine image transformations. -use std::ops::{Deref, DerefMut}; +use std::ops::DerefMut; use crate::{cloner::ImageCloner, Image}; @@ -45,7 +45,7 @@ impl ImageCloner<'_, CHANNELS> { } } -impl + DerefMut> Image { +impl> Image { /// Flip an image vertically. pub fn flip_v(&mut self) { for y in 0..self.height() / 2 { @@ -131,7 +131,7 @@ impl ImageCloner<'_, CHANNELS> { } } -impl + DerefMut> Image { +impl> Image { /// Rotate an image 180 degrees clockwise. pub fn rot_180(&mut self) { self.flatten_mut().reverse(); @@ -166,7 +166,7 @@ impl + DerefMut> I /// # Safety /// /// UB if supplied image rectangular -unsafe fn transpose + DerefMut>( +unsafe fn transpose>( img: &mut Image, ) { debug_assert_eq!(img.width(), img.height()); @@ -184,10 +184,7 @@ unsafe fn transpose + DerefMut + DerefMut, ->( +unsafe fn transpose_non_power_of_two>( img: &mut Image, ) { debug_assert_eq!(img.width(), img.height()); @@ -208,10 +205,7 @@ const TILE: usize = 4; /// # Safety /// /// be careful -unsafe fn transpose_tile< - const CHANNELS: usize, - T: Deref + DerefMut, ->( +unsafe fn transpose_tile>( img: &mut Image, row: usize, col: usize, @@ -247,10 +241,7 @@ unsafe fn transpose_tile< /// # Safety /// /// be careful -unsafe fn transpose_diag< - const CHANNELS: usize, - T: Deref + DerefMut, ->( +unsafe fn transpose_diag>( img: &mut Image, pos: usize, size: usize, diff --git a/src/drawing/box.rs b/src/drawing/box.rs index 4893bae..ff85f0f 100644 --- a/src/drawing/box.rs +++ b/src/drawing/box.rs @@ -1,9 +1,9 @@ //! `Box` -use std::ops::{Deref, DerefMut, Range}; +use std::ops::{DerefMut, Range}; use crate::Image; -impl + DerefMut, const CHANNELS: usize> Image { +impl, const CHANNELS: usize> Image { /// Draw a bordered box /// ``` /// # use fimg::Image; diff --git a/src/drawing/line.rs b/src/drawing/line.rs index 195d312..fd2b33d 100644 --- a/src/drawing/line.rs +++ b/src/drawing/line.rs @@ -1,10 +1,7 @@ //! adds a `line` function to Image #![allow(clippy::missing_docs_in_private_items)] use crate::Image; -use std::{ - iter::Iterator, - ops::{Deref, DerefMut}, -}; +use std::{iter::Iterator, ops::DerefMut}; /// taken from [bresenham-rs](https://github.com/mbr/bresenham-rs) pub struct Bresenham { @@ -130,7 +127,7 @@ impl Iterator for Bresenham { } } -impl + DerefMut, const CHANNELS: usize> Image { +impl, const CHANNELS: usize> Image { /// Draw a line from point a to point b. /// /// Points not in bounds will not be included. diff --git a/src/drawing/poly.rs b/src/drawing/poly.rs index aa86168..0799457 100644 --- a/src/drawing/poly.rs +++ b/src/drawing/poly.rs @@ -1,12 +1,12 @@ //! draw polygons use std::{ cmp::{max, min}, - ops::{Deref, DerefMut}, + ops::DerefMut, }; use crate::Image; -impl + DerefMut, const CHANNELS: usize> Image { +impl, const CHANNELS: usize> Image { /// Draws a filled polygon from a slice of points. Please close your poly. (first == last) /// /// Borrowed from [imageproc](https://docs.rs/imageproc/latest/src/imageproc/drawing/polygon.rs.html#31), modified for less allocations. diff --git a/src/drawing/tri.rs b/src/drawing/tri.rs index c4d2d6c..e141f94 100644 --- a/src/drawing/tri.rs +++ b/src/drawing/tri.rs @@ -1,9 +1,9 @@ //! trongle drawing -use std::ops::{Deref, DerefMut}; +use std::ops::DerefMut; use crate::Image; -impl + DerefMut, const CHANNELS: usize> Image { +impl, const CHANNELS: usize> Image { /// Draw a (filled) triangle /// ``` /// # use fimg::*; diff --git a/src/overlay.rs b/src/overlay.rs index 4165399..06b6c79 100644 --- a/src/overlay.rs +++ b/src/overlay.rs @@ -100,9 +100,7 @@ unsafe fn blit(rgb: &mut [u8], rgba: &[u8]) { } } -impl + DerefMut, U: Deref> - Overlay> for Image -{ +impl, U: Deref> Overlay> for Image { #[inline] unsafe fn overlay(&mut self, with: &Image) -> &mut Self { debug_assert!(self.width() == with.width()); @@ -129,9 +127,7 @@ impl ClonerOverlay<4, 4> for ImageCloner<'_, 4> { } } -impl + DerefMut, U: Deref> - OverlayAt> for Image -{ +impl, U: Deref> OverlayAt> for Image { #[inline] unsafe fn overlay_at(&mut self, with: &Image, x: u32, y: u32) -> &mut Self { // SAFETY: caller upholds this @@ -167,9 +163,7 @@ impl ClonerOverlayAt<4, 3> for ImageCloner<'_, 3> { } } -impl + DerefMut, U: Deref> - OverlayAt> for Image -{ +impl, U: Deref> OverlayAt> for Image { /// Overlay a RGB image(with) => self at coordinates x, y. /// As this is a `RGBxRGB` operation, blending is unnecessary, /// and this is simply a copy. @@ -208,9 +202,7 @@ impl + DerefMut, U: Deref> } } -impl + DerefMut, U: Deref> - Overlay> for Image -{ +impl, U: Deref> Overlay> for Image { #[inline] unsafe fn overlay(&mut self, with: &Image) -> &mut Self { debug_assert!(self.width() == with.width()); @@ -244,9 +236,7 @@ impl ClonerOverlay<4, 3> for ImageCloner<'_, 3> { } } -impl + DerefMut, U: Deref> - OverlayAt> for Image -{ +impl, U: Deref> OverlayAt> for Image { #[inline] /// Overlay with => self at coordinates x, y, without blending ///