From 5b5f1bed5e8da9d799e5910793477ba0360d5135 Mon Sep 17 00:00:00 2001 From: Silas Bartha Date: Thu, 13 Jun 2024 20:37:10 -0400 Subject: Removed unnecessary into calls in LSB codec --- Cargo.toml | 2 +- src/lossless/lsb.rs | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 2dc41f2..fda57ee 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "occule" -version = "0.2.0" +version = "0.2.1" edition = "2021" [features] diff --git a/src/lossless/lsb.rs b/src/lossless/lsb.rs index f8f1113..2ce1456 100644 --- a/src/lossless/lsb.rs +++ b/src/lossless/lsb.rs @@ -14,9 +14,9 @@ pub struct LsbCodec; impl Codec for LsbCodec { fn encode(&self, carrier: &[u8], payload: &[u8]) -> Result, CodecError> { - let image_format = image::guess_format(carrier.into()).unwrap(); - let mut image: DynamicImage = image::load_from_memory(carrier.into()).unwrap(); - let payload: &[u8] = payload.into(); + let image_format = image::guess_format(carrier).unwrap(); + let mut image: DynamicImage = image::load_from_memory(carrier).unwrap(); + let payload: &[u8] = payload; if image.pixels().count() < payload.len() { return Err(CodecError::DataInvalid("Payload Too Big for Carrier".into())); @@ -55,8 +55,8 @@ impl Codec for LsbCodec { fn decode(&self, carrier: &[u8]) -> Result<(Vec, Vec), CodecError> { - let image_format = image::guess_format(carrier.into()).unwrap(); - let mut image: DynamicImage = image::load_from_memory(carrier.into()).unwrap(); + let image_format = image::guess_format(carrier).unwrap(); + let mut image: DynamicImage = image::load_from_memory(carrier).unwrap(); let mut payload: Vec = Vec::new(); match image { -- cgit v1.2.3