Skip to content

Commit eff9ade

Browse files
committed
fix(client): resolve clippy warnings for v0.6.0 release
1 parent 432a4ef commit eff9ade

11 files changed

Lines changed: 87 additions & 117 deletions

File tree

crates/prism-client/src/renderer/text_renderer.rs

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,7 @@ impl TextPipeline {
3535
// Load Material Symbols icon font — once, persistent in font database.
3636
let icon_font_data =
3737
include_bytes!("../../assets/fonts/MaterialSymbolsOutlined.ttf").to_vec();
38-
font_system
39-
.db_mut()
40-
.load_font_data(icon_font_data);
38+
font_system.db_mut().load_font_data(icon_font_data);
4139

4240
let swash_cache = SwashCache::new();
4341
let gpu_cache = Cache::new(device);
@@ -101,7 +99,11 @@ impl TextPipeline {
10199
Family::SansSerif
102100
};
103101

104-
let weight = if run.bold { Weight::BOLD } else { Weight::NORMAL };
102+
let weight = if run.bold {
103+
Weight::BOLD
104+
} else {
105+
Weight::NORMAL
106+
};
105107

106108
buf.set_text(
107109
&mut self.font_system,
@@ -183,11 +185,7 @@ impl TextPipeline {
183185
) -> f32 {
184186
let metrics = Metrics::new(font_size, font_size * 1.2);
185187
let mut buffer = Buffer::new(font_system, metrics);
186-
let weight = if bold {
187-
Weight::BOLD
188-
} else {
189-
Weight::NORMAL
190-
};
188+
let weight = if bold { Weight::BOLD } else { Weight::NORMAL };
191189
let attrs = Attrs::new().family(Family::SansSerif).weight(weight);
192190
buffer.set_text(font_system, text, attrs, Shaping::Advanced);
193191
buffer.shape_until_scroll(font_system, false);

crates/prism-client/src/ui/launcher/card_grid.rs

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
use super::server_card::{CardFilter, ServerCard};
55
use crate::config::servers::SavedServer;
66
use crate::ui::theme;
7-
use crate::ui::widgets::icon::{Icon, ICON_ADD, ICON_FILTER, ICON_SORT};
7+
use crate::ui::widgets::icon::{ICON_ADD, ICON_FILTER, ICON_SORT, Icon};
88
use crate::ui::widgets::{
99
EventResponse, GlassQuad, MouseButton, PaintContext, Rect, Size, TextRun, UiAction, UiEvent,
1010
Widget,
@@ -187,9 +187,10 @@ impl CardGrid {
187187
for card in &self.cards {
188188
for tag in card.tags() {
189189
if seen_tags.insert(tag.clone()) {
190-
let w = theme::text_width(&tag, 11.0) + 28.0;
190+
let w = theme::text_width(tag, 11.0) + 28.0;
191191
let rect = Rect::new(x, y, w, FILTER_H);
192-
self.filter_chip_rects.push((CardFilter::Tag(tag.to_string()), rect));
192+
self.filter_chip_rects
193+
.push((CardFilter::Tag(tag.to_string()), rect));
193194
x += w + FILTER_GAP;
194195
}
195196
}
@@ -531,7 +532,8 @@ impl Widget for CardGrid {
531532
if self.max_scroll > 0.0 {
532533
let track_h = self.rect.h - self.toolbar_height();
533534
let thumb_h = (track_h * track_h / (track_h + self.max_scroll)).max(24.0);
534-
let thumb_y = self.rect.y + self.toolbar_height()
535+
let thumb_y = self.rect.y
536+
+ self.toolbar_height()
535537
+ (track_h - thumb_h) * (self.scroll_y / self.max_scroll);
536538
let track_x = self.rect.x + self.rect.w - 4.0;
537539
ctx.push_glass_quad(GlassQuad {
@@ -545,30 +547,29 @@ impl Widget for CardGrid {
545547

546548
fn handle_event(&mut self, event: &UiEvent) -> EventResponse {
547549
// Scroll handling
548-
if let UiEvent::Scroll { dy, .. } = event {
549-
if self.max_scroll > 0.0 {
550-
self.scroll_y = (self.scroll_y - dy).clamp(0.0, self.max_scroll);
551-
return EventResponse::Consumed;
552-
}
550+
if let UiEvent::Scroll { dy, .. } = event
551+
&& self.max_scroll > 0.0
552+
{
553+
self.scroll_y = (self.scroll_y - dy).clamp(0.0, self.max_scroll);
554+
return EventResponse::Consumed;
553555
}
554556

555557
// FAB click
556-
if self.show_filters {
557-
if let UiEvent::MouseDown {
558+
if self.show_filters
559+
&& let UiEvent::MouseDown {
558560
x,
559561
y,
560562
button: MouseButton::Left,
561563
} = event
562-
{
563-
let fab_rect = Rect::new(
564-
self.rect.x + self.rect.w - FAB_SIZE - FAB_PAD,
565-
self.rect.y + self.rect.h - FAB_SIZE - FAB_PAD,
566-
FAB_SIZE,
567-
FAB_SIZE,
568-
);
569-
if fab_rect.contains(*x, *y) {
570-
return EventResponse::Action(UiAction::AddServer);
571-
}
564+
{
565+
let fab_rect = Rect::new(
566+
self.rect.x + self.rect.w - FAB_SIZE - FAB_PAD,
567+
self.rect.y + self.rect.h - FAB_SIZE - FAB_PAD,
568+
FAB_SIZE,
569+
FAB_SIZE,
570+
);
571+
if fab_rect.contains(*x, *y) {
572+
return EventResponse::Action(UiAction::AddServer);
572573
}
573574
}
574575

crates/prism-client/src/ui/launcher/nav.rs

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
use super::{LauncherTab, SettingsSection};
55
use crate::ui::theme;
66
use crate::ui::widgets::icon::{
7-
Icon, ICON_DEVICES, ICON_HOME, ICON_KEYBOARD, ICON_MENU, ICON_SETTINGS, ICON_SHIELD,
8-
ICON_SPEAKER, ICON_STREAMING, ICON_TUNE,
7+
ICON_DEVICES, ICON_HOME, ICON_KEYBOARD, ICON_MENU, ICON_SETTINGS, ICON_SHIELD, ICON_SPEAKER,
8+
ICON_STREAMING, ICON_TUNE, Icon,
99
};
1010
use crate::ui::widgets::{
1111
EventResponse, GlassQuad, MouseButton, PaintContext, Rect, Size, TextRun, UiAction, UiEvent,
@@ -81,9 +81,8 @@ impl Widget for LauncherNav {
8181
// When Settings is active, compute sub-nav items after the primary ones
8282
self.sub_nav_items.clear();
8383
if self.active_tab == LauncherTab::Settings {
84-
let main_nav_bottom_y = self.rect.y
85-
+ 94.0
86-
+ LauncherTab::PRIMARY.len() as f32 * (ITEM_H + ITEM_GAP);
84+
let main_nav_bottom_y =
85+
self.rect.y + 94.0 + LauncherTab::PRIMARY.len() as f32 * (ITEM_H + ITEM_GAP);
8786
let sub_header_y = main_nav_bottom_y + 16.0;
8887
for (i, section) in SettingsSection::ALL.iter().enumerate() {
8988
let item_y = sub_header_y + 24.0 + i as f32 * (ITEM_H + 4.0);
@@ -137,11 +136,7 @@ impl Widget for LauncherNav {
137136
theme::PRIMARY_BLUE,
138137
);
139138
} else if hovered {
140-
ctx.push_glass_quad(theme::launcher_nav_item_surface(
141-
*rect,
142-
false,
143-
true,
144-
));
139+
ctx.push_glass_quad(theme::launcher_nav_item_surface(*rect, false, true));
145140
}
146141

147142
let icon_codepoint = match tab {
@@ -258,7 +253,10 @@ impl Widget for LauncherNav {
258253
Icon::new(ICON_SETTINGS)
259254
.with_size(20.0)
260255
.with_color(settings_icon_color)
261-
.at(self.settings_item.x + SIDE_PADDING, self.settings_item.y + 10.0)
256+
.at(
257+
self.settings_item.x + SIDE_PADDING,
258+
self.settings_item.y + 10.0,
259+
)
262260
.paint(ctx);
263261

264262
ctx.push_text_run(TextRun {

crates/prism-client/src/ui/launcher/profiles.rs

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ use crate::ui::theme;
88
use crate::ui::widgets::button::{Button, ButtonStyle};
99
use crate::ui::widgets::dropdown::Dropdown;
1010
use crate::ui::widgets::icon::{
11-
Icon, ICON_ADD, ICON_BALANCE, ICON_CODE, ICON_DIAL, ICON_GAMEPAD, ICON_KEYBOARD, ICON_MONITOR,
12-
ICON_SPEED,
11+
ICON_ADD, ICON_BALANCE, ICON_CODE, ICON_DIAL, ICON_GAMEPAD, ICON_KEYBOARD, ICON_MONITOR,
12+
ICON_SPEED, Icon,
1313
};
1414
use crate::ui::widgets::segmented::SegmentedControl;
1515
use crate::ui::widgets::slider::Slider;
@@ -413,8 +413,7 @@ impl Widget for ProfilesPanel {
413413

414414
// PERFORMANCE SETTINGS (single-column controls)
415415
let mut y = y_start + 32.0; // room for section header
416-
self.bitrate_slider
417-
.layout(Rect::new(x, y + 50.0, w, 32.0));
416+
self.bitrate_slider.layout(Rect::new(x, y + 50.0, w, 32.0));
418417
y += 110.0;
419418
self.encoder_dropdown
420419
.layout(Rect::new(x, y + 20.0, w, 36.0));
@@ -646,8 +645,7 @@ impl Widget for ProfilesPanel {
646645
}
647646

648647
if self.dirty {
649-
let badge_x =
650-
name_x + tw + 16.0 + if draft.builtin { 74.0 } else { 0.0 };
648+
let badge_x = name_x + tw + 16.0 + if draft.builtin { 74.0 } else { 0.0 };
651649
let chip = Rect::new(badge_x, editor.y + 24.0, 80.0, 20.0);
652650
ctx.push_glass_quad(theme::launcher_status_chip(chip, theme::ChipTone::Warning));
653651
ctx.push_text_run(TextRun {
@@ -678,9 +676,7 @@ impl Widget for ProfilesPanel {
678676

679677
// Section helper
680678
let paint_section_header = |ctx: &mut PaintContext, y: f32, icon: char, title: &str| {
681-
ctx.push_glass_quad(theme::launcher_inner_separator(Rect::new(
682-
x, y, w, 1.0,
683-
)));
679+
ctx.push_glass_quad(theme::launcher_inner_separator(Rect::new(x, y, w, 1.0)));
684680
Icon::new(icon)
685681
.with_size(16.0)
686682
.with_color(theme::PRIMARY_BLUE)
@@ -706,8 +702,8 @@ impl Widget for ProfilesPanel {
706702
let bitrate_mbps = self.bitrate_slider.value().round() as u32;
707703
let value_str = format!("{}", bitrate_mbps);
708704
ctx.push_text_run(TextRun {
709-
x: x,
710-
y: y,
705+
x,
706+
y,
711707
text: "Bitrate Preference".into(),
712708
font_size: theme::FONT_CAPTION,
713709
color: theme::LT_TEXT_MUTED,
@@ -717,7 +713,7 @@ impl Widget for ProfilesPanel {
717713
let val_w = theme::text_width(&value_str, theme::FONT_DISPLAY);
718714
ctx.push_text_run(TextRun {
719715
x: x + w - val_w - 50.0,
720-
y: y,
716+
y,
721717
text: value_str,
722718
font_size: theme::FONT_DISPLAY,
723719
color: theme::LT_TEXT_PRIMARY,
@@ -756,8 +752,8 @@ impl Widget for ProfilesPanel {
756752

757753
y += 110.0;
758754
ctx.push_text_run(TextRun {
759-
x: x,
760-
y: y,
755+
x,
756+
y,
761757
text: "Latency vs Quality".into(),
762758
font_size: theme::FONT_CAPTION,
763759
color: theme::LT_TEXT_MUTED,

crates/prism-client/src/ui/launcher/recent_list.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,9 @@ use std::time::{SystemTime, UNIX_EPOCH};
66
use crate::config::servers::{SavedServer, ServerStatus};
77
use crate::ui::theme;
88
use crate::ui::widgets::button::{Button, ButtonStyle};
9-
use crate::ui::widgets::icon::{Icon, ICON_SYNC};
9+
use crate::ui::widgets::icon::{ICON_SYNC, Icon};
1010
use crate::ui::widgets::{
11-
ColorMode, EventResponse, PaintContext, Rect, Size, TextRun, UiAction, UiEvent,
12-
Widget,
11+
ColorMode, EventResponse, PaintContext, Rect, Size, TextRun, UiAction, UiEvent, Widget,
1312
};
1413

1514
const ROW_H: f32 = 54.0;
@@ -117,7 +116,7 @@ impl RecentList {
117116
self.rows = ordered
118117
.iter()
119118
.take(MAX_VISIBLE)
120-
.map(|s| RecentRow::from_saved(s))
119+
.map(RecentRow::from_saved)
121120
.collect();
122121
}
123122

crates/prism-client/src/ui/launcher/server_card.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use crate::config::servers::{SavedServer, ServerStatus};
77
use crate::renderer::animation::{Animation, EaseCurve};
88
use crate::ui::theme;
99
use crate::ui::widgets::button::{Button, ButtonStyle};
10-
use crate::ui::widgets::icon::{Icon, ICON_EDIT, ICON_HEART, ICON_MORE_VERT};
10+
use crate::ui::widgets::icon::{ICON_EDIT, ICON_HEART, ICON_MORE_VERT, Icon};
1111
use crate::ui::widgets::{
1212
ColorMode, EventResponse, GlassQuad, MouseButton, PaintContext, Rect, Size, TextRun, UiAction,
1313
UiEvent, Widget,

crates/prism-client/src/ui/launcher/settings.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use std::sync::{Arc, Mutex};
77
use crate::config::client_config_prefs::UserPrefs;
88
use crate::ui::theme;
99
use crate::ui::widgets::dropdown::Dropdown;
10-
use crate::ui::widgets::icon::{Icon, ICON_MIC, ICON_SPEAKER};
10+
use crate::ui::widgets::icon::{ICON_MIC, ICON_SPEAKER, Icon};
1111
use crate::ui::widgets::toggle::Toggle;
1212
use crate::ui::widgets::{
1313
ColorMode, EventResponse, PaintContext, Rect, Size, TextRun, UiEvent, Widget,

0 commit comments

Comments
 (0)