Skip to content

Commit

Permalink
clippy fix again
Browse files Browse the repository at this point in the history
  • Loading branch information
cospectrum committed Oct 19, 2024
1 parent e981cd3 commit 3dff775
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 17 deletions.
4 changes: 2 additions & 2 deletions src/binary_descriptors/brief.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ fn local_pixel_average(integral_image: &Image<Luma<u32>>, x: u32, y: u32, radius
if radius == 0 {
return 0;
}
let y_min = if y < radius { 0 } else { y - radius };
let x_min = if x < radius { 0 } else { x - radius };
let y_min = y.saturating_sub(radius);
let x_min = x.saturating_sub(radius);
let y_max = u32::min(y + radius + 1, integral_image.height() - 1);
let x_max = u32::min(x + radius + 1, integral_image.width() - 1);

Expand Down
4 changes: 2 additions & 2 deletions src/corners.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,8 @@ fn intensity_centroid(image: &GrayImage, x: u32, y: u32, radius: u32) -> f32 {
let mut x_centroid: i32 = 0;

let (width, height) = image.dimensions();
let x_min = if x < radius { 0 } else { x - radius };
let y_min = if y < radius { 0 } else { y - radius };
let x_min = x.saturating_sub(radius);
let y_min = y.saturating_sub(radius);
let y_max = u32::min(y + radius + 1, height);
let x_max = u32::min(x + radius + 1, width);

Expand Down
6 changes: 3 additions & 3 deletions src/distance_transform.rs
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ struct Row<'a> {
row: u32,
}

impl<'a> Sink for Row<'a> {
impl Sink for Row<'_> {
fn put(&mut self, idx: usize, value: f64) {
unsafe {
self.image
Expand All @@ -303,7 +303,7 @@ struct ColumnMut<'a> {
column: u32,
}

impl<'a> Sink for ColumnMut<'a> {
impl Sink for ColumnMut<'_> {
fn put(&mut self, idx: usize, value: f64) {
unsafe {
self.image
Expand Down Expand Up @@ -338,7 +338,7 @@ struct Column<'a> {
column: u32,
}

impl<'a> Source for Column<'a> {
impl Source for Column<'_> {
fn get(&self, idx: usize) -> f64 {
let pixel = unsafe { self.image.unsafe_get_pixel(self.column, idx as u32)[0] as f64 };
if pixel > 0f64 {
Expand Down
6 changes: 3 additions & 3 deletions src/drawing/line.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ pub struct BresenhamLinePixelIter<'a, P: Pixel> {
image: &'a Image<P>,
}

impl<'a, P: Pixel> BresenhamLinePixelIter<'a, P> {
impl<P: Pixel> BresenhamLinePixelIter<'_, P> {
/// Creates a [`BresenhamLinePixelIter`] which will iterate over
/// the image pixels with coordinates between `start` and `end`.
pub fn new(
Expand Down Expand Up @@ -125,7 +125,7 @@ pub struct BresenhamLinePixelIterMut<'a, P: Pixel> {
image: &'a mut Image<P>,
}

impl<'a, P: Pixel> BresenhamLinePixelIterMut<'a, P> {
impl<P: Pixel> BresenhamLinePixelIterMut<'_, P> {
/// Creates a [`BresenhamLinePixelIterMut`] which will iterate over
/// the image pixels with coordinates between `start` and `end`.
pub fn new(
Expand Down Expand Up @@ -302,7 +302,7 @@ where
blend: B,
}

impl<'a, I, T, B> Plotter<'a, I, T, B>
impl<I, T, B> Plotter<'_, I, T, B>
where
I: GenericImage,

Expand Down
4 changes: 2 additions & 2 deletions src/geometric_transformations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ impl Mul<Projection> for Projection {
}
}

impl<'a, 'b> Mul<&'b Projection> for &'a Projection {
impl Mul<&Projection> for &Projection {
type Output = Projection;

fn mul(self, rhs: &Projection) -> Projection {
Expand All @@ -264,7 +264,7 @@ impl Mul<(f32, f32)> for Projection {
}
}

impl<'a, 'b> Mul<&'b (f32, f32)> for &'a Projection {
impl Mul<&(f32, f32)> for &Projection {
type Output = (f32, f32);

fn mul(self, rhs: &(f32, f32)) -> (f32, f32) {
Expand Down
6 changes: 3 additions & 3 deletions src/suppress.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@ where
}
}

let x0 = if radius >= best_x { 0 } else { best_x - radius };
let x0 = best_x.saturating_sub(radius);
let x1 = x;
let x2 = cmp::min(width, x + radius + 1);
let x3 = cmp::min(width, best_x + radius + 1);

let y0 = if radius >= best_y { 0 } else { best_y - radius };
let y0 = best_y.saturating_sub(radius);
let y1 = y;
let y2 = cmp::min(height, y + radius + 1);
let y3 = cmp::min(height, best_y + radius + 1);
Expand Down Expand Up @@ -131,7 +131,7 @@ where
let cs = t.score();

let mut is_max = true;
let row_lower = if radius > cy { 0 } else { cy - radius };
let row_lower = cy.saturating_sub(radius);
let row_upper = if cy + radius + 1 > height {
height
} else {
Expand Down
4 changes: 2 additions & 2 deletions src/template_matching.rs
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ impl<'a> ImageTemplate<'a> {
}
}
}
impl<'a> OutputDims for ImageTemplate<'a> {
impl OutputDims for ImageTemplate<'_> {
fn output_dims(&self) -> (u32, u32) {
let width = self.image.width() - self.template.width() + 1;
let height = self.image.height() - self.template.height() + 1;
Expand Down Expand Up @@ -470,7 +470,7 @@ impl<'a> ImageTemplateMask<'a> {
}
}
}
impl<'a> OutputDims for ImageTemplateMask<'a> {
impl OutputDims for ImageTemplateMask<'_> {
fn output_dims(&self) -> (u32, u32) {
self.inner.output_dims()
}
Expand Down

0 comments on commit 3dff775

Please sign in to comment.