From 2da0e35b0af0162a6592ac3cb7987bd7762370a0 Mon Sep 17 00:00:00 2001 From: Colin Rofls Date: Thu, 6 May 2021 16:26:20 -0400 Subject: [PATCH] Fix some new clippy lints --- piet-direct2d/src/lib.rs | 5 +---- piet/src/image.rs | 2 +- piet/src/samples/mod.rs | 2 +- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/piet-direct2d/src/lib.rs b/piet-direct2d/src/lib.rs index fa601533..80316914 100644 --- a/piet-direct2d/src/lib.rs +++ b/piet-direct2d/src/lib.rs @@ -619,10 +619,7 @@ fn draw_image<'a>( InterpolationMode::NearestNeighbor => D2D1_BITMAP_INTERPOLATION_MODE_NEAREST_NEIGHBOR, InterpolationMode::Bilinear => D2D1_BITMAP_INTERPOLATION_MODE_LINEAR, }; - let src_rect = match src_rect { - Some(src_rect) => Some(rect_to_rectf(src_rect)), - None => None, - }; + let src_rect = src_rect.map(rect_to_rectf); rt.draw_bitmap( &image, &rect_to_rectf(dst_rect), diff --git a/piet/src/image.rs b/piet/src/image.rs index 14225c4e..c7ee734b 100644 --- a/piet/src/image.rs +++ b/piet/src/image.rs @@ -72,9 +72,9 @@ impl ImageBuf { assert_eq!(pixels.len(), width * height * format.bytes_per_pixel()); ImageBuf { pixels, - format, width, height, + format, } } diff --git a/piet/src/samples/mod.rs b/piet/src/samples/mod.rs index 23160d1d..c48a0d7d 100644 --- a/piet/src/samples/mod.rs +++ b/piet/src/samples/mod.rs @@ -153,7 +153,7 @@ pub fn samples_main( impl SamplePicture { fn new(size: Size, draw_f: fn(&mut T) -> Result<(), Error>) -> Self { - SamplePicture { size, draw_f } + SamplePicture { draw_f, size } } /// The size of the context expected by this sample, in pixels.