Skip to content

Commit

Permalink
⚠️(icu_lib): fix warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
W-Mai committed Mar 5, 2024
1 parent d39b88b commit 81ebf99
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 14 deletions.
4 changes: 1 addition & 3 deletions icu_lib/src/endecoder/lvgl_v9/lvgl.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
use crate::endecoder::lvgl_v9::color_converter::{rgba8888_from, rgba8888_to};
use crate::endecoder::lvgl_v9::{
ColorFormat, Flags, ImageDescriptor, ImageHeader, LVGLVersion, LVGL,
};
use crate::endecoder::lvgl_v9::{Flags, ImageDescriptor, ImageHeader, LVGLVersion, LVGL};
use crate::endecoder::{EnDecoder, ImageInfo};
use crate::midata::MiData;
use crate::EncoderParams;
Expand Down
20 changes: 9 additions & 11 deletions icu_lib/src/endecoder/lvgl_v9/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use modular_bitfield::prelude::*;
use std::io::{Bytes, Cursor, Read, Write};
use std::io::{Cursor, Write};

mod color_converter;
mod lvgl;
Expand All @@ -8,7 +8,7 @@ mod lvgl;
#[bits = 8]
#[derive(Debug, Copy, Clone, PartialEq, Default)]
#[repr(u8)]
pub(crate) enum LVGLVersion {
pub enum LVGLVersion {
#[default]
Unknown,

Expand Down Expand Up @@ -90,10 +90,12 @@ pub struct ImageHeaderV8 {
#[repr(C, packed)]
pub struct ImageHeaderV9 {
// Magic number. Must be LV_IMAGE_HEADER_MAGIC
magic: u8,
#[allow(unused)]
magic: B8,
// Color format: See `lv_color_format_t`
cf: ColorFormat,
// Image flags, see `lv_image_flags_t`
#[allow(unused)]
flags: Flags,

// Width of the image in pixels
Expand Down Expand Up @@ -126,7 +128,7 @@ impl ImageHeader {
version = LVGLVersion::V8;
}

let header = match version {
match version {
LVGLVersion::V8 => {
let header = ImageHeaderV8::from_bytes([data[0], data[1], data[2], data[3]]);
log::trace!("Decoded image header: {:#?}", header);
Expand All @@ -152,9 +154,7 @@ impl ImageHeader {
}
}
_ => ImageHeader::Unknown,
};

header
}
}

pub fn into_bytes(&self) -> Vec<u8> {
Expand Down Expand Up @@ -223,7 +223,7 @@ impl ImageHeader {
h: u16,
stride: u16,
) -> Self {
let header = match version {
match version {
LVGLVersion::V8 => {
ImageHeader::V8(ImageHeaderV8::new().with_cf(cf).with_w(w).with_h(h))
}
Expand All @@ -237,9 +237,7 @@ impl ImageHeader {
.with_stride(stride),
),
LVGLVersion::Unknown => ImageHeader::Unknown,
};

header
}
}

pub fn encode(&self) -> Vec<u8> {
Expand Down

0 comments on commit 81ebf99

Please sign in to comment.