mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-01-18 11:21:11 +00:00
style(core): fix clippy lints
[no changelog]
This commit is contained in:
parent
56491a0530
commit
58be59529d
@ -1,5 +1,6 @@
|
|||||||
#![allow(non_camel_case_types)]
|
#![allow(non_camel_case_types)]
|
||||||
#![allow(non_upper_case_globals)]
|
#![allow(non_upper_case_globals)]
|
||||||
#![allow(dead_code)]
|
#![allow(dead_code)]
|
||||||
|
#![allow(clippy::unnecessary_cast)]
|
||||||
|
|
||||||
include!(concat!(env!("OUT_DIR"), "/micropython.rs"));
|
include!(concat!(env!("OUT_DIR"), "/micropython.rs"));
|
||||||
|
@ -218,7 +218,7 @@ where
|
|||||||
_ => {
|
_ => {
|
||||||
let progress = self.progress(now);
|
let progress = self.progress(now);
|
||||||
if let Some(done) = progress {
|
if let Some(done) = progress {
|
||||||
self.paint_anim(done as i16);
|
self.paint_anim(done);
|
||||||
} else {
|
} else {
|
||||||
self.paint_anim(0);
|
self.paint_anim(0);
|
||||||
}
|
}
|
||||||
|
@ -175,9 +175,9 @@ impl TextLayout {
|
|||||||
self.layout_text(text, &mut self.initial_cursor(), &mut TextRenderer);
|
self.layout_text(text, &mut self.initial_cursor(), &mut TextRenderer);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn layout_ops<'o>(
|
pub fn layout_ops(
|
||||||
mut self,
|
mut self,
|
||||||
ops: &mut dyn Iterator<Item = Op<'o>>,
|
ops: &mut dyn Iterator<Item = Op<'_>>,
|
||||||
cursor: &mut Point,
|
cursor: &mut Point,
|
||||||
sink: &mut dyn LayoutSink,
|
sink: &mut dyn LayoutSink,
|
||||||
) -> LayoutFit {
|
) -> LayoutFit {
|
||||||
|
@ -149,11 +149,11 @@ where
|
|||||||
|
|
||||||
/// Iterate over visible layouts (bounding box, style) together
|
/// Iterate over visible layouts (bounding box, style) together
|
||||||
/// with corresponding string content. Should not get monomorphized.
|
/// with corresponding string content. Should not get monomorphized.
|
||||||
fn foreach_visible<'a, 'b, S: ParagraphStrType>(
|
fn foreach_visible<'a, S: ParagraphStrType>(
|
||||||
source: &'a dyn ParagraphSource<StrType = S>,
|
source: &'a dyn ParagraphSource<StrType = S>,
|
||||||
visible: &'a [TextLayout],
|
visible: &'a [TextLayout],
|
||||||
offset: PageOffset,
|
offset: PageOffset,
|
||||||
func: &'b mut dyn FnMut(&TextLayout, &str),
|
func: &mut dyn FnMut(&TextLayout, &str),
|
||||||
) {
|
) {
|
||||||
let mut vis_iter = visible.iter();
|
let mut vis_iter = visible.iter();
|
||||||
let mut chr = offset.chr;
|
let mut chr = offset.chr;
|
||||||
|
@ -321,7 +321,7 @@ pub fn loader_rust(
|
|||||||
icon: Option<(&[u8], Color, Offset)>,
|
icon: Option<(&[u8], Color, Offset)>,
|
||||||
) {
|
) {
|
||||||
let center = screen().center() + Offset::new(0, y_offset);
|
let center = screen().center() + Offset::new(0, y_offset);
|
||||||
let r = Rect::from_center_and_size(center, Offset::uniform(LOADER_OUTER as i16 * 2));
|
let r = Rect::from_center_and_size(center, Offset::uniform(LOADER_OUTER * 2));
|
||||||
let clamped = r.clamp(constant::screen());
|
let clamped = r.clamp(constant::screen());
|
||||||
display::set_window(clamped);
|
display::set_window(clamped);
|
||||||
|
|
||||||
|
@ -359,9 +359,8 @@ pub(crate) fn position_buffer(
|
|||||||
} else {
|
} else {
|
||||||
0
|
0
|
||||||
};
|
};
|
||||||
dest_buffer[((start * buffer_bpp) / 8)..((start + width) * buffer_bpp) / 8].copy_from_slice(
|
dest_buffer[((start * buffer_bpp) / 8)..((start + width) * buffer_bpp) / 8]
|
||||||
&src_buffer[((x_sh * buffer_bpp) / 8) as usize..((x_sh as usize + width) * buffer_bpp) / 8],
|
.copy_from_slice(&src_buffer[((x_sh * buffer_bpp) / 8)..((x_sh + width) * buffer_bpp) / 8]);
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Performs decompression of one line of pixels,
|
/// Performs decompression of one line of pixels,
|
||||||
@ -1031,11 +1030,11 @@ impl Font {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn max_height(self) -> i16 {
|
pub fn max_height(self) -> i16 {
|
||||||
display::text_max_height(self.into()) as i16
|
display::text_max_height(self.into())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn baseline(self) -> i16 {
|
pub fn baseline(self) -> i16 {
|
||||||
display::text_baseline(self.into()) as i16
|
display::text_baseline(self.into())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn line_height(self) -> i16 {
|
pub fn line_height(self) -> i16 {
|
||||||
|
@ -301,7 +301,7 @@ impl<'i, 'p> JDEC<'i, 'p> {
|
|||||||
if cls == 0 && d > 11 {
|
if cls == 0 && d > 11 {
|
||||||
return Err(Error::InvalidData);
|
return Err(Error::InvalidData);
|
||||||
}
|
}
|
||||||
self.huffdata[num][cls][i as usize] = d;
|
self.huffdata[num][cls][i] = d;
|
||||||
}
|
}
|
||||||
if JD_FASTDECODE == 2 {
|
if JD_FASTDECODE == 2 {
|
||||||
// Create fast huffman decode table
|
// Create fast huffman decode table
|
||||||
@ -326,8 +326,8 @@ impl<'i, 'p> JDEC<'i, 'p> {
|
|||||||
j = self.huffbits[num][cls][b as usize] as u32;
|
j = self.huffbits[num][cls][b as usize] as u32;
|
||||||
while j != 0 {
|
while j != 0 {
|
||||||
// Index of input pattern for the code
|
// Index of input pattern for the code
|
||||||
ti = (self.huffcode[num][cls][i] << (((HUFF_BIT - 1) as u32) - b)) as u32
|
ti =
|
||||||
& HUFF_MASK;
|
(self.huffcode[num][cls][i] << ((HUFF_BIT - 1) - b)) as u32 & HUFF_MASK;
|
||||||
|
|
||||||
if cls != 0 {
|
if cls != 0 {
|
||||||
// b15..b8: code length, b7..b0: zero run and data length
|
// b15..b8: code length, b7..b0: zero run and data length
|
||||||
@ -447,7 +447,7 @@ impl<'i, 'p> JDEC<'i, 'p> {
|
|||||||
hb_idx = HUFF_BIT; // Bit distribution table
|
hb_idx = HUFF_BIT; // Bit distribution table
|
||||||
hc_idx = self.longofs[id][cls]; // Code word table
|
hc_idx = self.longofs[id][cls]; // Code word table
|
||||||
hd_idx = self.longofs[id][cls]; // Data table
|
hd_idx = self.longofs[id][cls]; // Data table
|
||||||
bl = (HUFF_BIT + 1) as u32;
|
bl = HUFF_BIT + 1;
|
||||||
} else {
|
} else {
|
||||||
// Incremental search for all codes
|
// Incremental search for all codes
|
||||||
bl = 1;
|
bl = 1;
|
||||||
@ -805,7 +805,7 @@ impl<'i, 'p> JDEC<'i, 'p> {
|
|||||||
// If no AC element or scale ratio is 1/8, IDCT can be omitted and the block is
|
// If no AC element or scale ratio is 1/8, IDCT can be omitted and the block is
|
||||||
// filled with DC value
|
// filled with DC value
|
||||||
if z == 1 || JD_USE_SCALE != 0 && self.scale == 3 {
|
if z == 1 || JD_USE_SCALE != 0 && self.scale == 3 {
|
||||||
d = (self.workbuf[0] / 256 + 128) as i32;
|
d = self.workbuf[0] / 256 + 128;
|
||||||
if JD_FASTDECODE >= 1 {
|
if JD_FASTDECODE >= 1 {
|
||||||
for i in 0..64 {
|
for i in 0..64 {
|
||||||
self.mcubuf[mcu_buf_idx + i] = d as i16;
|
self.mcubuf[mcu_buf_idx + i] = d as i16;
|
||||||
|
@ -463,7 +463,7 @@ impl BlurringContext {
|
|||||||
let data = get_data(buffer, self.line_num, mcu_height);
|
let data = get_data(buffer, self.line_num, mcu_height);
|
||||||
|
|
||||||
for i in -BLUR_RADIUS..=BLUR_RADIUS {
|
for i in -BLUR_RADIUS..=BLUR_RADIUS {
|
||||||
let ic = i.clamp(0, HOMESCREEN_IMAGE_WIDTH as i16 - 1) as usize;
|
let ic = i.clamp(0, HOMESCREEN_IMAGE_WIDTH - 1) as usize;
|
||||||
update_accs_add(data, ic, &mut acc_r, &mut acc_g, &mut acc_b);
|
update_accs_add(data, ic, &mut acc_r, &mut acc_g, &mut acc_b);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -473,9 +473,9 @@ impl BlurringContext {
|
|||||||
self.lines[self.add_idx][BLUE_IDX][i as usize] = acc_b;
|
self.lines[self.add_idx][BLUE_IDX][i as usize] = acc_b;
|
||||||
|
|
||||||
// clamping handles left and right edges
|
// clamping handles left and right edges
|
||||||
let ic = (i - BLUR_RADIUS).clamp(0, HOMESCREEN_IMAGE_WIDTH as i16 - 1) as usize;
|
let ic = (i - BLUR_RADIUS).clamp(0, HOMESCREEN_IMAGE_WIDTH - 1) as usize;
|
||||||
let ic2 = (i + BLUR_SIZE as i16 - BLUR_RADIUS)
|
let ic2 = (i + BLUR_SIZE as i16 - BLUR_RADIUS)
|
||||||
.clamp(0, HOMESCREEN_IMAGE_WIDTH as i16 - 1) as usize;
|
.clamp(0, HOMESCREEN_IMAGE_WIDTH - 1) as usize;
|
||||||
update_accs_add(data, ic2, &mut acc_r, &mut acc_g, &mut acc_b);
|
update_accs_add(data, ic2, &mut acc_r, &mut acc_g, &mut acc_b);
|
||||||
update_accs_sub(data, ic, &mut acc_r, &mut acc_g, &mut acc_b);
|
update_accs_sub(data, ic, &mut acc_r, &mut acc_g, &mut acc_b);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user