From 2cb242c3b16a19928a9bec2b02d09eb982299b27 Mon Sep 17 00:00:00 2001 From: Access Date: Thu, 28 Mar 2024 16:25:16 +0800 Subject: [PATCH] chore: make clippy happy (#111) --- libwayshot/src/image_util.rs | 4 ++-- libwayshot/src/lib.rs | 2 +- wayshot/build.rs | 2 ++ wayshot/src/wayshot.rs | 1 - 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/libwayshot/src/image_util.rs b/libwayshot/src/image_util.rs index e06af24d..fbb7068f 100644 --- a/libwayshot/src/image_util.rs +++ b/libwayshot/src/image_util.rs @@ -1,4 +1,4 @@ -use image::{DynamicImage, GenericImageView}; +use image::DynamicImage; use wayland_client::protocol::wl_output::Transform; use crate::region::Size; @@ -12,7 +12,7 @@ pub(crate) fn rotate_image_buffer( ) -> DynamicImage { // TODO Better document whether width and height are before or after the transform. // Perhaps this should be part of a cleanup of the FrameCopy struct. - let (logical_width, logical_height) = match transform { + let (logical_width, _logical_height) = match transform { Transform::_90 | Transform::_270 | Transform::Flipped90 | Transform::Flipped270 => { (logical_size.height, logical_size.width) } diff --git a/libwayshot/src/lib.rs b/libwayshot/src/lib.rs index 3cd7d280..4e8bc98b 100644 --- a/libwayshot/src/lib.rs +++ b/libwayshot/src/lib.rs @@ -52,7 +52,7 @@ use crate::{ convert::create_converter, dispatch::{CaptureFrameState, FrameState, OutputCaptureState, WayshotState}, output::OutputInfo, - region::{LogicalRegion, Region, Size}, + region::{LogicalRegion, Size}, screencopy::{create_shm_fd, FrameCopy, FrameFormat}, }; diff --git a/wayshot/build.rs b/wayshot/build.rs index 37104611..9c7c82e8 100644 --- a/wayshot/build.rs +++ b/wayshot/build.rs @@ -26,6 +26,7 @@ fn main() -> Result<()> { let output = OpenOptions::new() .write(true) .create(true) + .truncate(true) .open(Path::new(&man_page.1))?; _ = Command::new("scdoc") .stdin(Stdio::from(File::open(man_page.0)?)) @@ -41,6 +42,7 @@ fn main() -> Result<()> { let output = OpenOptions::new() .write(true) .create(true) + .truncate(true) .open(Path::new(&scdoc_output.1))?; let mut encoder = GzEncoder::new(output, Compression::default()); copy(&mut input, &mut encoder)?; diff --git a/wayshot/src/wayshot.rs b/wayshot/src/wayshot.rs index b8a9420b..2d25e098 100644 --- a/wayshot/src/wayshot.rs +++ b/wayshot/src/wayshot.rs @@ -1,5 +1,4 @@ use std::{ - fs::File, io::{stdout, BufWriter, Cursor, Write}, process::Command, };