mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-01-03 12:00:59 +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_upper_case_globals)]
|
||||
#![allow(dead_code)]
|
||||
#![allow(clippy::unnecessary_cast)]
|
||||
|
||||
include!(concat!(env!("OUT_DIR"), "/micropython.rs"));
|
||||
|
@ -218,7 +218,7 @@ where
|
||||
_ => {
|
||||
let progress = self.progress(now);
|
||||
if let Some(done) = progress {
|
||||
self.paint_anim(done as i16);
|
||||
self.paint_anim(done);
|
||||
} else {
|
||||
self.paint_anim(0);
|
||||
}
|
||||
|
@ -175,9 +175,9 @@ impl TextLayout {
|
||||
self.layout_text(text, &mut self.initial_cursor(), &mut TextRenderer);
|
||||
}
|
||||
|
||||
pub fn layout_ops<'o>(
|
||||
pub fn layout_ops(
|
||||
mut self,
|
||||
ops: &mut dyn Iterator<Item = Op<'o>>,
|
||||
ops: &mut dyn Iterator<Item = Op<'_>>,
|
||||
cursor: &mut Point,
|
||||
sink: &mut dyn LayoutSink,
|
||||
) -> LayoutFit {
|
||||
|
@ -149,11 +149,11 @@ where
|
||||
|
||||
/// Iterate over visible layouts (bounding box, style) together
|
||||
/// 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>,
|
||||
visible: &'a [TextLayout],
|
||||
offset: PageOffset,
|
||||
func: &'b mut dyn FnMut(&TextLayout, &str),
|
||||
func: &mut dyn FnMut(&TextLayout, &str),
|
||||
) {
|
||||
let mut vis_iter = visible.iter();
|
||||
let mut chr = offset.chr;
|
||||
|
@ -321,7 +321,7 @@ pub fn loader_rust(
|
||||
icon: Option<(&[u8], Color, 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());
|
||||
display::set_window(clamped);
|
||||
|
||||
|
@ -359,9 +359,8 @@ pub(crate) fn position_buffer(
|
||||
} else {
|
||||
0
|
||||
};
|
||||
dest_buffer[((start * buffer_bpp) / 8)..((start + width) * buffer_bpp) / 8].copy_from_slice(
|
||||
&src_buffer[((x_sh * buffer_bpp) / 8) as usize..((x_sh as usize + width) * buffer_bpp) / 8],
|
||||
);
|
||||
dest_buffer[((start * buffer_bpp) / 8)..((start + 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,
|
||||
@ -1031,11 +1030,11 @@ impl Font {
|
||||
}
|
||||
|
||||
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 {
|
||||
display::text_baseline(self.into()) as i16
|
||||
display::text_baseline(self.into())
|
||||
}
|
||||
|
||||
pub fn line_height(self) -> i16 {
|
||||
|
@ -301,7 +301,7 @@ impl<'i, 'p> JDEC<'i, 'p> {
|
||||
if cls == 0 && d > 11 {
|
||||
return Err(Error::InvalidData);
|
||||
}
|
||||
self.huffdata[num][cls][i as usize] = d;
|
||||
self.huffdata[num][cls][i] = d;
|
||||
}
|
||||
if JD_FASTDECODE == 2 {
|
||||
// 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;
|
||||
while j != 0 {
|
||||
// Index of input pattern for the code
|
||||
ti = (self.huffcode[num][cls][i] << (((HUFF_BIT - 1) as u32) - b)) as u32
|
||||
& HUFF_MASK;
|
||||
ti =
|
||||
(self.huffcode[num][cls][i] << ((HUFF_BIT - 1) - b)) as u32 & HUFF_MASK;
|
||||
|
||||
if cls != 0 {
|
||||
// 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
|
||||
hc_idx = self.longofs[id][cls]; // Code word table
|
||||
hd_idx = self.longofs[id][cls]; // Data table
|
||||
bl = (HUFF_BIT + 1) as u32;
|
||||
bl = HUFF_BIT + 1;
|
||||
} else {
|
||||
// Incremental search for all codes
|
||||
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
|
||||
// filled with DC value
|
||||
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 {
|
||||
for i in 0..64 {
|
||||
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);
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
@ -473,9 +473,9 @@ impl BlurringContext {
|
||||
self.lines[self.add_idx][BLUE_IDX][i as usize] = acc_b;
|
||||
|
||||
// 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)
|
||||
.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_sub(data, ic, &mut acc_r, &mut acc_g, &mut acc_b);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user