From b26ceb633995586b74e874206ef547cd2a518331 Mon Sep 17 00:00:00 2001 From: Sam Date: Mon, 13 Sep 2021 10:41:55 -0400 Subject: [PATCH] Removed a few unnecessary casts. --- voxygen/src/hud/group.rs | 5 ++--- voxygen/src/hud/mod.rs | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/voxygen/src/hud/group.rs b/voxygen/src/hud/group.rs index 6f20134a7b..1d3d8d5696 100644 --- a/voxygen/src/hud/group.rs +++ b/voxygen/src/hud/group.rs @@ -383,8 +383,7 @@ impl<'a> Widget for Group<'a> { inventory, health, energy, skill_set, *body, self.msm, ); let char_name = stats.name.to_string(); - let health_perc = - health.current() as f64 / health.base_max().max(health.maximum()) as f64; + let health_perc = health.current() / health.base_max().max(health.maximum()); // change panel positions when debug info is shown let x = if debug_on { i / 8 } else { i / 12 }; let y = if debug_on { i % 8 } else { i % 12 }; @@ -411,7 +410,7 @@ impl<'a> Widget for Group<'a> { .set(state.ids.member_panels_bg[i], ui); // Health Image::new(self.imgs.bar_content) - .w_h(148.0 * health_perc, 22.0) + .w_h(148.0 * f64::from(health_perc), 22.0) .color(Some(health_col)) .top_left_with_margins_on(state.ids.member_panels_bg[i], 2.0, 2.0) .set(state.ids.member_health[i], ui); diff --git a/voxygen/src/hud/mod.rs b/voxygen/src/hud/mod.rs index 9b2db8e469..6b9b28548e 100644 --- a/voxygen/src/hud/mod.rs +++ b/voxygen/src/hud/mod.rs @@ -1120,7 +1120,7 @@ impl Hud { //self.input = client.read_storage::(); if let Some(health) = healths.get(me) { // Hurt Frame - let hp_percentage = health.current() as f32 / health.maximum() as f32 * 100.0; + let hp_percentage = health.current() / health.maximum() * 100.0; if hp_percentage < 10.0 && !health.is_dead { let hurt_fade = (self.pulse * (10.0 - hp_percentage as f32) * 0.1/* speed factor */).sin()