From 02438a93a931961a308fc0db95366bb8db56b649 Mon Sep 17 00:00:00 2001 From: Ayoze Torres <53948812+ayozetr@users.noreply.github.com> Date: Tue, 11 Aug 2026 17:47:50 +0100 Subject: [PATCH] fix: annotate float literals so the build is clean on Rust 1.97 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit CI runs `cargo clippy --all-targets --locked -- -D warnings` on whatever `dtolnay/rust-toolchain@stable` resolves to, and on the current stable that fails with 32 instances of: falling back to `f32` as the trait bound `f32: From` is not satisfied They sit in calls like `Stroke::new(1.0, arc_border())`, where the parameter is generic and an unsuffixed float literal no longer resolves the way it used to. rustc still accepts it but announces it as a future hard error, and `-D warnings` promotes it to a build failure today — so the Linux and Windows jobs both go red on every pull request, whatever the pull request touches. Mechanical change (`1.0` -> `1.0_f32`), produced by `cargo fix`, which is where all 32 suggestions came from. --- src/app.rs | 10 +++++----- src/theme.rs | 16 ++++++++-------- src/widgets.rs | 38 +++++++++++++++++++------------------- 3 files changed, 32 insertions(+), 32 deletions(-) diff --git a/src/app.rs b/src/app.rs index 814adfe..eba5e23 100644 --- a/src/app.rs +++ b/src/app.rs @@ -2082,7 +2082,7 @@ impl ArcTrackerSyncApp { ui.painter().vline( divider_x, (inner.top() + 6.0)..=(inner.bottom() - 6.0), - Stroke::new(1.0, arc_border_soft()), + Stroke::new(1.0_f32, arc_border_soft()), ); // Left rail: the four-phase stepper. progress_stages() supplies each @@ -2403,7 +2403,7 @@ impl ArcTrackerSyncApp { ui.painter().hline( rect.x_range(), rect.bottom() - 0.5, - Stroke::new(1.0, arc_border_soft()), + Stroke::new(1.0_f32, arc_border_soft()), ); let drag = ui.interact( @@ -2629,7 +2629,7 @@ impl ArcTrackerSyncApp { ui.painter().hline( rect.x_range(), rect.top() + 0.5, - Stroke::new(1.0, arc_border_soft()), + Stroke::new(1.0_f32, arc_border_soft()), ); let (dot_color, job) = self.footer_identity(); @@ -3132,7 +3132,7 @@ impl ArcTrackerSyncApp { fn render_activity_log(&self, ui: &mut egui::Ui) { Frame::NONE .fill(arc_input()) - .stroke(Stroke::new(1.0, arc_border())) + .stroke(Stroke::new(1.0_f32, arc_border())) .corner_radius(CornerRadius::same(theme::RADIUS_CONTROL)) .inner_margin(egui::Margin::same(14)) .show(ui, |ui| { @@ -3190,7 +3190,7 @@ impl ArcTrackerSyncApp { let window_r = if maximized { 0 } else { theme::RADIUS_WINDOW }; let window_frame = Frame::NONE .fill(arc_bg()) - .stroke(Stroke::new(1.0, arc_border())) + .stroke(Stroke::new(1.0_f32, arc_border())) .corner_radius(CornerRadius::same(window_r)); let state = self.hub_state(); diff --git a/src/theme.rs b/src/theme.rs index 0cae0e9..c00679d 100644 --- a/src/theme.rs +++ b/src/theme.rs @@ -179,13 +179,13 @@ pub fn apply_arc_theme(ctx: &egui::Context) { let mut visuals = egui::Visuals::dark(); visuals.panel_fill = arc_bg(); visuals.window_fill = arc_card(); - visuals.window_stroke = Stroke::new(1.0, arc_border()); + visuals.window_stroke = Stroke::new(1.0_f32, arc_border()); visuals.window_corner_radius = CornerRadius::same(RADIUS_CARD); visuals.extreme_bg_color = arc_input(); visuals.faint_bg_color = arc_muted(); visuals.hyperlink_color = arc_primary(); visuals.selection.bg_fill = arc_primary(); - visuals.selection.stroke = Stroke::new(1.0, arc_primary_foreground()); + visuals.selection.stroke = Stroke::new(1.0_f32, arc_primary_foreground()); for state in [ &mut visuals.widgets.inactive, @@ -199,18 +199,18 @@ pub fn apply_arc_theme(ctx: &egui::Context) { visuals.widgets.inactive.bg_fill = arc_input(); visuals.widgets.inactive.weak_bg_fill = arc_input(); - visuals.widgets.inactive.bg_stroke = Stroke::new(1.0, arc_border()); - visuals.widgets.inactive.fg_stroke = Stroke::new(1.0, arc_foreground()); + visuals.widgets.inactive.bg_stroke = Stroke::new(1.0_f32, arc_border()); + visuals.widgets.inactive.fg_stroke = Stroke::new(1.0_f32, arc_foreground()); visuals.widgets.hovered.bg_fill = arc_muted(); visuals.widgets.hovered.weak_bg_fill = arc_muted(); - visuals.widgets.hovered.bg_stroke = Stroke::new(1.0, arc_border_strong()); - visuals.widgets.hovered.fg_stroke = Stroke::new(1.0, arc_foreground()); + visuals.widgets.hovered.bg_stroke = Stroke::new(1.0_f32, arc_border_strong()); + visuals.widgets.hovered.fg_stroke = Stroke::new(1.0_f32, arc_foreground()); // Pressed/active state stays subtle (a faint surface) rather than flashing // the gold accent, which inverted text and made controls hard to read. visuals.widgets.active.bg_fill = arc_muted(); visuals.widgets.active.weak_bg_fill = arc_muted(); - visuals.widgets.active.bg_stroke = Stroke::new(1.0, arc_border_strong()); - visuals.widgets.active.fg_stroke = Stroke::new(1.0, arc_foreground()); + visuals.widgets.active.bg_stroke = Stroke::new(1.0_f32, arc_border_strong()); + visuals.widgets.active.fg_stroke = Stroke::new(1.0_f32, arc_foreground()); let mut style = (*ctx.style()).clone(); style.visuals = visuals; diff --git a/src/widgets.rs b/src/widgets.rs index 964ee04..07b2a1c 100644 --- a/src/widgets.rs +++ b/src/widgets.rs @@ -51,7 +51,7 @@ pub fn primary_button(ui: &mut egui::Ui, label: &str) -> bool { pub fn secondary_button(ui: &mut egui::Ui, label: &str) -> bool { let button = egui::Button::new(RichText::new(label).color(arc_foreground())) .fill(arc_input()) - .stroke(Stroke::new(1.0, arc_border())) + .stroke(Stroke::new(1.0_f32, arc_border())) .corner_radius(CornerRadius::same(RADIUS_CONTROL)); ui.add(button) .on_hover_cursor(egui::CursorIcon::PointingHand) @@ -72,7 +72,7 @@ pub fn launcher_segment(ui: &mut egui::Ui, label: &str, selected: bool) -> bool ( arc_input(), arc_foreground(), - Stroke::new(1.0, arc_border()), + Stroke::new(1.0_f32, arc_border()), ) }; let button = egui::Button::new(RichText::new(label).size(TEXT_CAPTION).color(text)) @@ -89,7 +89,7 @@ pub fn launcher_segment(ui: &mut egui::Ui, label: &str, selected: bool) -> bool pub fn card(ui: &mut egui::Ui, add_contents: impl FnOnce(&mut egui::Ui) -> R) -> R { Frame::NONE .fill(arc_card()) - .stroke(Stroke::new(1.0, arc_border())) + .stroke(Stroke::new(1.0_f32, arc_border())) .corner_radius(CornerRadius::same(RADIUS_CARD)) .inner_margin(Margin::same(16)) .show(ui, |ui| { @@ -108,7 +108,7 @@ pub fn tone_card( ) -> R { Frame::NONE .fill(tone.linear_multiply(TONE_FILL_OPACITY)) - .stroke(Stroke::new(1.0, tone.linear_multiply(TONE_STROKE_OPACITY))) + .stroke(Stroke::new(1.0_f32, tone.linear_multiply(TONE_STROKE_OPACITY))) .corner_radius(CornerRadius::same(RADIUS_TILE)) .inner_margin(Margin::symmetric(14, 12)) .show(ui, |ui| { @@ -162,7 +162,7 @@ pub fn hairline(ui: &mut egui::Ui) { ui.painter().hline( rect.x_range(), rect.center().y, - Stroke::new(1.0, arc_border_soft()), + Stroke::new(1.0_f32, arc_border_soft()), ); } @@ -183,7 +183,7 @@ fn paint_pill_bg(ui: &egui::Ui, rect: Rect, color: Color32) { painter.rect_stroke( rect, CornerRadius::same(RADIUS_PILL), - Stroke::new(1.0, color.linear_multiply(PILL_STROKE_OPACITY)), + Stroke::new(1.0_f32, color.linear_multiply(PILL_STROKE_OPACITY)), StrokeKind::Inside, ); } @@ -268,7 +268,7 @@ pub fn toggle_switch(ui: &mut egui::Ui, on: &mut bool) -> bool { painter.rect_stroke( rect, CornerRadius::same(RADIUS_PILL), - Stroke::new(1.0, arc_border_strong()), + Stroke::new(1.0_f32, arc_border_strong()), StrokeKind::Inside, ); } @@ -314,7 +314,7 @@ pub fn vertical_stepper(ui: &mut egui::Ui, nodes: &[StepperNode<'_>], tone: Colo }; let top = pos2(center.x, center.y + node_r + 4.0); let bottom = pos2(center.x, center.y + STEP_ROW_HEIGHT - node_r - 4.0); - painter.line_segment([top, bottom], Stroke::new(2.0, color)); + painter.line_segment([top, bottom], Stroke::new(2.0_f32, color)); } match node.state { @@ -329,11 +329,11 @@ pub fn vertical_stepper(ui: &mut egui::Ui, nodes: &[StepperNode<'_>], tone: Colo 0.18 }; painter.circle_filled(center, node_r + 6.0, tone.linear_multiply(halo)); - painter.circle_stroke(center, node_r, Stroke::new(2.0, tone)); + painter.circle_stroke(center, node_r, Stroke::new(2.0_f32, tone)); painter.circle_filled(center, 4.5, tone); } StageState::Pending => { - painter.circle_stroke(center, node_r, Stroke::new(1.5, arc_border_strong())); + painter.circle_stroke(center, node_r, Stroke::new(1.5_f32, arc_border_strong())); painter.text( center, Align2::CENTER_CENTER, @@ -423,7 +423,7 @@ pub fn window_button(ui: &mut egui::Ui, kind: WindowButton) -> bool { arc_muted_text() }; let c = rect.center(); - let stroke = Stroke::new(1.4, fg); + let stroke = Stroke::new(1.4_f32, fg); match kind { WindowButton::Minimize => { painter.line_segment([c + vec2(-5.0, 0.0), c + vec2(5.0, 0.0)], stroke); @@ -550,7 +550,7 @@ fn mix(a: Color32, b: Color32, t: f32) -> Color32 { } fn draw_check(painter: &egui::Painter, center: Pos2, color: Color32) { - let stroke = Stroke::new(2.0, color); + let stroke = Stroke::new(2.0_f32, color); let p1 = center + vec2(-4.5, 0.0); let p2 = center + vec2(-1.0, 3.5); let p3 = center + vec2(5.0, -3.5); @@ -591,7 +591,7 @@ fn arrowhead(painter: &egui::Painter, points: &[Pos2], color: Color32) { } fn draw_phase_icon(painter: &egui::Painter, center: Pos2, color: Color32, phase: usize) { - let stroke = Stroke::new(2.0, color); + let stroke = Stroke::new(2.0_f32, color); match phase { 0 => { // Account — head + shoulders. @@ -682,7 +682,7 @@ fn draw_gear(painter: &egui::Painter, center: Pos2, color: Color32, size: f32) { // The "spoke" settings glyph: a hub ring with eight evenly-spaced spokes. // Round caps on both ends make every spoke look identical so the icon reads // as symmetric and round. - let stroke = Stroke::new(1.6, color); + let stroke = Stroke::new(1.6_f32, color); let cap = stroke.width / 2.0; let hub = size * 0.20; let r_in = size * 0.31; @@ -712,7 +712,7 @@ pub fn back_button(ui: &mut egui::Ui) -> bool { } else { arc_muted_text() }; - let stroke = Stroke::new(1.7, fg); + let stroke = Stroke::new(1.7_f32, fg); let c = rect.center(); painter.line_segment([c + vec2(7.0, 0.0), c + vec2(-7.0, 0.0)], stroke); painter.line_segment([c + vec2(-7.0, 0.0), c + vec2(-2.0, -5.0)], stroke); @@ -726,7 +726,7 @@ pub fn back_button(ui: &mut egui::Ui) -> bool { pub fn secondary_button_full(ui: &mut egui::Ui, label: &str) -> bool { let button = egui::Button::new(RichText::new(label).color(arc_foreground())) .fill(arc_input()) - .stroke(Stroke::new(1.0, arc_border_strong())) + .stroke(Stroke::new(1.0_f32, arc_border_strong())) .corner_radius(CornerRadius::same(RADIUS_CONTROL)); ui.add_sized(vec2(ui.available_width(), 38.0), button) .on_hover_cursor(egui::CursorIcon::PointingHand) @@ -752,11 +752,11 @@ pub fn refresh_badge(ui: &mut egui::Ui) { painter.rect_stroke( rect, CornerRadius::same(11), - Stroke::new(1.0, accent.linear_multiply(0.40)), + Stroke::new(1.0_f32, accent.linear_multiply(0.40)), StrokeKind::Inside, ); let arc = arc_points(rect.center(), 6.5, 130.0, 400.0, 28); - painter.add(Shape::line(arc.clone(), Stroke::new(2.0, accent))); + painter.add(Shape::line(arc.clone(), Stroke::new(2.0_f32, accent))); arrowhead(painter, &arc, accent); } @@ -795,7 +795,7 @@ pub fn arc_modal(id: &str) -> egui::Modal { .frame( Frame::NONE .fill(arc_card()) - .stroke(Stroke::new(1.0, arc_border())) + .stroke(Stroke::new(1.0_f32, arc_border())) .corner_radius(CornerRadius::same(RADIUS_CARD)) .inner_margin(Margin::same(26)), )