fix clippy warnings
This commit is contained in:
parent
37950d6e2e
commit
ade4ae5a2d
5 changed files with 20 additions and 23 deletions
|
@ -303,21 +303,21 @@ impl Rusty for LvArg {
|
|||
#[derive(Clone)]
|
||||
pub struct LvType {
|
||||
literal_name: String,
|
||||
r_type: Option<Box<syn::Type>>,
|
||||
_r_type: Option<Box<syn::Type>>,
|
||||
}
|
||||
|
||||
impl LvType {
|
||||
pub fn new(literal_name: String) -> Self {
|
||||
Self {
|
||||
literal_name,
|
||||
r_type: None,
|
||||
_r_type: None,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn from(r_type: Box<syn::Type>) -> Self {
|
||||
Self {
|
||||
literal_name: r_type.to_token_stream().to_string(),
|
||||
r_type: Some(r_type),
|
||||
_r_type: Some(r_type),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -206,9 +206,9 @@ pub enum Part {
|
|||
All,
|
||||
}
|
||||
|
||||
impl Into<u8> for Part {
|
||||
fn into(self) -> u8 {
|
||||
match self {
|
||||
impl From<Part> 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,
|
||||
}
|
||||
|
|
|
@ -56,9 +56,9 @@ bitflags! {
|
|||
}
|
||||
}
|
||||
|
||||
impl Into<u8> for Opacity {
|
||||
fn into(self) -> u8 {
|
||||
self.bits as u8
|
||||
impl From<Opacity> for u8 {
|
||||
fn from(self_: Opacity) -> u8 {
|
||||
self_.bits as u8
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -203,9 +203,9 @@ pub enum Align {
|
|||
OutRightBottom,
|
||||
}
|
||||
|
||||
impl Into<u8> for Align {
|
||||
fn into(self) -> u8 {
|
||||
let native = match self {
|
||||
impl From<Align> 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,
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue