From c474298e4bae35665b009525234070f124f8562d Mon Sep 17 00:00:00 2001 From: ComplexSpaces Date: Thu, 13 Feb 2025 14:04:33 -0600 Subject: [PATCH] Remove unneeded Result from image_from_pixels --- src/platform/osx.rs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/platform/osx.rs b/src/platform/osx.rs index c4c7c0d..93731fa 100644 --- a/src/platform/osx.rs +++ b/src/platform/osx.rs @@ -30,7 +30,7 @@ fn image_from_pixels( pixels: Vec, width: usize, height: usize, -) -> Result, Box> { +) -> Retained { use objc2::AllocAnyThread; use objc2_app_kit::NSImage; use objc2_core_foundation::CGFloat; @@ -84,9 +84,7 @@ fn image_from_pixels( .unwrap(); let size = NSSize { width: width as CGFloat, height: height as CGFloat }; - let image = unsafe { NSImage::initWithCGImage_size(NSImage::alloc(), &cg_image, size) }; - - Ok(image) + unsafe { NSImage::initWithCGImage_size(NSImage::alloc(), &cg_image, size) } } pub(crate) struct Clipboard { @@ -305,8 +303,7 @@ impl<'clipboard> Set<'clipboard> { #[cfg(feature = "image-data")] pub(crate) fn image(self, data: ImageData) -> Result<(), Error> { let pixels = data.bytes.into(); - let image = image_from_pixels(pixels, data.width, data.height) - .map_err(|_| Error::ConversionFailure)?; + let image = image_from_pixels(pixels, data.width, data.height); self.clipboard.clear();