diff --git a/lvgl-codegen/src/lib.rs b/lvgl-codegen/src/lib.rs index 9fb182f..ac234ed 100644 --- a/lvgl-codegen/src/lib.rs +++ b/lvgl-codegen/src/lib.rs @@ -303,21 +303,21 @@ impl Rusty for LvArg { #[derive(Clone)] pub struct LvType { literal_name: String, - r_type: Option>, + _r_type: Option>, } impl LvType { pub fn new(literal_name: String) -> Self { Self { literal_name, - r_type: None, + _r_type: None, } } pub fn from(r_type: Box) -> Self { Self { literal_name: r_type.to_token_stream().to_string(), - r_type: Some(r_type), + _r_type: Some(r_type), } } diff --git a/lvgl/src/lv_core/obj.rs b/lvgl/src/lv_core/obj.rs index 0085850..e498725 100644 --- a/lvgl/src/lv_core/obj.rs +++ b/lvgl/src/lv_core/obj.rs @@ -206,9 +206,9 @@ pub enum Part { All, } -impl Into for Part { - fn into(self) -> u8 { - match self { +impl From for u8 { + fn from(self_: Part) -> u8 { + match self_ { Part::Main => lvgl_sys::LV_OBJ_PART_MAIN as u8, Part::All => lvgl_sys::LV_OBJ_PART_ALL as u8, } diff --git a/lvgl/src/lv_core/style.rs b/lvgl/src/lv_core/style.rs index 8219034..579f794 100644 --- a/lvgl/src/lv_core/style.rs +++ b/lvgl/src/lv_core/style.rs @@ -56,9 +56,9 @@ bitflags! { } } -impl Into for Opacity { - fn into(self) -> u8 { - self.bits as u8 +impl From for u8 { + fn from(self_: Opacity) -> u8 { + self_.bits as u8 } } diff --git a/lvgl/src/support.rs b/lvgl/src/support.rs index c71e77b..229ee69 100644 --- a/lvgl/src/support.rs +++ b/lvgl/src/support.rs @@ -203,9 +203,9 @@ pub enum Align { OutRightBottom, } -impl Into for Align { - fn into(self) -> u8 { - let native = match self { +impl From for u8 { + fn from(self_: Align) -> u8 { + let native = match self_ { Align::Center => lvgl_sys::LV_ALIGN_CENTER, Align::InTopLeft => lvgl_sys::LV_ALIGN_IN_TOP_LEFT, Align::InTopMid => lvgl_sys::LV_ALIGN_IN_TOP_MID, diff --git a/lvgl/src/ui.rs b/lvgl/src/ui.rs index b6190ed..9bd908c 100644 --- a/lvgl/src/ui.rs +++ b/lvgl/src/ui.rs @@ -187,17 +187,14 @@ where // We use iterators here to ensure that the Rust compiler can apply all possible // optimizations at compile time. - let pixels = ys - .enumerate() - .map(|(iy, y)| { - xs.clone().map(move |(ix, x)| { - let color_len = x_len * iy + ix; - let lv_color = unsafe { *color_p.add(color_len) }; - let raw_color = Color::from_raw(lv_color); - drawable::Pixel(Point::new(x as i32, y as i32), raw_color.into()) - }) + let pixels = ys.enumerate().flat_map(|(iy, y)| { + xs.clone().map(move |(ix, x)| { + let color_len = x_len * iy + ix; + let lv_color = unsafe { *color_p.add(color_len) }; + let raw_color = Color::from_raw(lv_color); + drawable::Pixel(Point::new(x as i32, y as i32), raw_color.into()) }) - .flatten(); + }); - Ok(display.draw_iter(pixels)?) + display.draw_iter(pixels) }