Skip to content

Commit f217411

Browse files
committed
Fix clippy warnings for version 1.97
1 parent 298c751 commit f217411

12 files changed

Lines changed: 29 additions & 72 deletions

File tree

‎crates/app/src/host/common/colors.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,9 +201,9 @@ pub fn notification_error_color(dark_mode: bool) -> Color32 {
201201
/// Stroke used for the active log-table indicator.
202202
pub fn active_log_table_indicator(dark_mode: bool) -> Stroke {
203203
if dark_mode {
204-
Stroke::new(2.0, MAIN_ACCENT_STROKE_DARK.gamma_multiply_u8(200))
204+
Stroke::new(2.0_f32, MAIN_ACCENT_STROKE_DARK.gamma_multiply_u8(200))
205205
} else {
206-
Stroke::new(3.0, MAIN_ACCENT_STROKE_LIGHT.gamma_multiply_u8(170))
206+
Stroke::new(3.0_f32, MAIN_ACCENT_STROKE_LIGHT.gamma_multiply_u8(170))
207207
}
208208
}
209209

‎crates/app/src/host/ui/banners/update.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ pub fn render(
4444

4545
let accent_stroke = colors::main_accent_stroke(ui.visuals().dark_mode);
4646
Frame::window(ui.style())
47-
.stroke(Stroke::new(1.0, accent_stroke))
47+
.stroke(Stroke::new(1.0_f32, accent_stroke))
4848
.show(ui, |ui| {
4949
ui.set_width(card_width);
5050

‎crates/app/src/host/ui/command_palette/row.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ fn render_title(ui: &mut Ui, title: &SearchPickerText, font_size: f32) {
8282
..Default::default()
8383
};
8484
let highlight_format = TextFormat {
85-
underline: Stroke::new(1.0, color),
85+
underline: Stroke::new(1.0_f32, color),
8686
..base_format.clone()
8787
};
8888

‎crates/app/src/host/ui/notification/banner.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ impl NotificationBanner {
7777

7878
let base_level_color = entry.level.color(ui.visuals().dark_mode);
7979
let level_color = apply_alpha(base_level_color);
80-
let stroke = Stroke::new(1.0, level_color);
80+
let stroke = Stroke::new(1.0_f32, level_color);
8181
let margin = Margin::same(10);
8282
let content_width = (banner_width - 20.0).at_least(0.0);
8383
let text_color = apply_alpha(ui.visuals().text_color());

‎crates/app/src/host/ui/quick_open/row.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ fn highlighted_layout(ui: &Ui, text: &SearchPickerText, primary: bool) -> Layout
102102
..Default::default()
103103
};
104104
let highlight_format = TextFormat {
105-
underline: Stroke::new(1.25, color),
105+
underline: Stroke::new(1.25_f32, color),
106106
..base_format.clone()
107107
};
108108

‎crates/app/src/session/ui/common/log_table/table.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ pub fn render_upper_bound(ui: &mut Ui) {
264264
egui::Pos2::new(rect.max.x, rect.top() + 1.0),
265265
],
266266
Stroke::new(
267-
0.5,
267+
0.5_f32,
268268
ui.style().visuals.widgets.noninteractive.fg_stroke.color,
269269
),
270270
4.0,

‎crates/core/parsers/src/dlt/attachment.rs‎

Lines changed: 8 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -124,45 +124,11 @@ impl FtMessageParser {
124124
/// * 3 DLT_RAW(bytes)
125125
/// * 4 DLT_STRING("FLDA")
126126
fn data_message(timestamp: Option<u32>, args: &[Argument]) -> Option<FtMessage<'_>> {
127-
let id;
128-
let packet;
129-
let bytes;
130-
131-
if let Some(arg) = args.get(1) {
132-
if let Some(value) = Self::get_number(arg) {
133-
id = value;
134-
} else {
135-
return None;
136-
}
137-
} else {
138-
return None;
139-
}
140-
141-
if let Some(arg) = args.get(2) {
142-
if let Some(value) = Self::get_number(arg) {
143-
packet = value;
144-
} else {
145-
return None;
146-
}
147-
} else {
148-
return None;
149-
}
150-
151-
if let Some(arg) = args.get(3) {
152-
if let Some(value) = Self::get_bytes(arg) {
153-
bytes = value;
154-
} else {
155-
return None;
156-
}
157-
} else {
158-
return None;
159-
}
160-
161127
Some(FtMessage::Data(FileData {
162128
timestamp,
163-
id,
164-
packet,
165-
bytes,
129+
id: Self::get_number(args.get(1)?)?,
130+
packet: Self::get_number(args.get(2)?)?,
131+
bytes: Self::get_bytes(args.get(3)?)?,
166132
}))
167133
}
168134

@@ -174,19 +140,10 @@ impl FtMessageParser {
174140
/// * 1 DLT_UINT(file-id)
175141
/// * 2 DLT_STRING("FLFI")
176142
fn end_message(timestamp: Option<u32>, args: &[Argument]) -> Option<FtMessage<'_>> {
177-
let id;
178-
179-
if let Some(arg) = args.get(1) {
180-
if let Some(value) = Self::get_number(arg) {
181-
id = value;
182-
} else {
183-
return None;
184-
}
185-
} else {
186-
return None;
187-
}
188-
189-
Some(FtMessage::End(FileEnd { timestamp, id }))
143+
Some(FtMessage::End(FileEnd {
144+
timestamp,
145+
id: Self::get_number(args.get(1)?)?,
146+
}))
190147
}
191148

192149
/// Returns a string value from given argument, if any.
@@ -339,7 +296,7 @@ impl TempDir {
339296
pub fn assert_file(&self, name: &str, content: &str) {
340297
let path = self.dir.join(name);
341298
let string =
342-
std::fs::read_to_string(&path).unwrap_or_else(|_| panic!("{:?} should exist", &path));
299+
std::fs::read_to_string(&path).unwrap_or_else(|_| panic!("{:?} should exist", path));
343300
assert_eq!(string, content);
344301
}
345302
}

‎crates/core/parsers/src/dlt/mod.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ impl std::fmt::Display for RangeMessage {
4949
}
5050
impl std::fmt::Display for RawMessage {
5151
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
52-
write!(f, "[{:02X?}]", &self.content)
52+
write!(f, "[{:02X?}]", self.content)
5353
}
5454
}
5555

‎crates/core/processor/benches/mocks/mock_source.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ impl ByteSource for MockByteSource {
3535
#[inline(never)]
3636
fn inner(_phantom: &MockByteSource) -> &[u8] {
3737
black_box({
38-
const BYTES: [u8; 3] = [b'a', b's', b'a'];
38+
const BYTES: [u8; 3] = *b"asa";
3939
const REF: &[u8] = &BYTES;
4040

4141
REF

‎crates/core/processor/src/grabber/mod.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ pub(crate) fn identify_byte_range(slots: &[Slot], lines: &LineRange) -> Option<F
390390
let maybe_end_slot = identify_end_slot_simple(slots, last_line_index);
391391
trace!(
392392
"(maybe_start_slot, maybe_end_slot): ({:?}, {:?})",
393-
&maybe_start_slot, &maybe_end_slot
393+
maybe_start_slot, maybe_end_slot
394394
);
395395
match (maybe_start_slot, maybe_end_slot) {
396396
(Some((start_slot, _)), Some((end_slot, _))) => {

0 commit comments

Comments
 (0)