Skip to content

Commit

Permalink
style: lint
Browse files Browse the repository at this point in the history
  • Loading branch information
goweiwen committed May 12, 2024
1 parent fa73cf6 commit a53fab9
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 28 deletions.
2 changes: 1 addition & 1 deletion allium-launcher/src/view/entry_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ where
let styles = self.res.get::<Stylesheet>();
let locale = self.res.get::<Locale>();

let mut entries = vec![
let mut entries = [
MenuEntry::Launch(None),
MenuEntry::Reset,
MenuEntry::RemoveFromRecents,
Expand Down
7 changes: 4 additions & 3 deletions allium-launcher/src/view/settings/language.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,10 @@ impl View for Language {
while let Some(command) = bubble.pop_front() {
if let Command::ValueChanged(i, val) = command {
match i {
0 => {
self.settings.lang = self.langs[val.as_int().unwrap() as usize].clone()
}
0 => self
.settings
.lang
.clone_from(&self.langs[val.as_int().unwrap() as usize]),
_ => unreachable!("Invalid index"),
}

Expand Down
18 changes: 10 additions & 8 deletions allium-launcher/src/view/settings/theme.rs
Original file line number Diff line number Diff line change
Expand Up @@ -351,15 +351,17 @@ impl View for Theme {
);
}
1 => self.stylesheet.toggle_battery_percentage(),
2 => {
self.stylesheet.ui_font.path =
self.fonts[val.as_int().unwrap() as usize].clone()
}
2 => self
.stylesheet
.ui_font
.path
.clone_from(&self.fonts[val.as_int().unwrap() as usize]),
3 => self.stylesheet.ui_font.size = val.as_int().unwrap() as u32,
4 => {
self.stylesheet.guide_font.path =
self.fonts[val.as_int().unwrap() as usize].clone()
}
4 => self
.stylesheet
.guide_font
.path
.clone_from(&self.fonts[val.as_int().unwrap() as usize]),
5 => self.stylesheet.guide_font.size = val.as_int().unwrap() as u32,
6 => self.stylesheet.tab_font_size = val.as_int().unwrap() as f32 / 100.0,
7 => {
Expand Down
2 changes: 1 addition & 1 deletion common/src/display/color.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ impl Color {

#[inline]
pub fn with_a(&self, a: u8) -> Self {
Self((a as u32) << 0 | self.0 & 0xFFFFFF00)
Self((a as u32) | self.0 & 0xFFFFFF00)
}

pub fn char(&self, i: usize) -> String {
Expand Down
2 changes: 1 addition & 1 deletion common/src/view/scroll_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ impl ScrollList {
return;
}

self.items[index] = item.clone();
self.items[index].clone_from(&item);
self.children[index - self.top].set_text(item);
self.dirty = true;
}
Expand Down
4 changes: 1 addition & 3 deletions common/src/view/settings_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ use std::collections::VecDeque;
use anyhow::Result;
use async_trait::async_trait;
use embedded_graphics::prelude::Size;
use embedded_graphics::primitives::{
CornerRadii, Primitive, PrimitiveStyle, Rectangle, RoundedRectangle,
};
use embedded_graphics::primitives::{Primitive, PrimitiveStyle, Rectangle, RoundedRectangle};
use embedded_graphics::Drawable;
use tokio::sync::mpsc::Sender;

Expand Down
11 changes: 0 additions & 11 deletions common/src/wifi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -448,14 +448,3 @@ pub fn ip_address() -> Option<String> {
#[cfg(not(any(feature = "miyoo", feature = "simulator")))]
return None;
}

struct ByteBuf<'a>(&'a [u8]);

impl<'a> std::fmt::LowerHex for ByteBuf<'a> {
fn fmt(&self, fmtr: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
for byte in self.0 {
fmtr.write_fmt(format_args!("{:02x}", byte))?;
}
Ok(())
}
}

0 comments on commit a53fab9

Please sign in to comment.