aboutsummaryrefslogtreecommitdiff
path: root/src/smart_positioning.rs
diff options
context:
space:
mode:
authorRuben Beltran del Rio <jj@r.bdr.sh>2025-12-16 16:35:08 +0100
committerRuben Beltran del Rio <jj@r.bdr.sh>2025-12-16 17:38:30 +0100
commitbf4b51af43005415deac6ba475992c83b5f2f82e (patch)
tree4bdc419138a070096735a45a74ea5eaf8822c691 /src/smart_positioning.rs
parentafd0794104228cd20e177f41dc68e9ae7ecaabda (diff)
Adapt to edition 2024
Diffstat (limited to 'src/smart_positioning.rs')
-rw-r--r--src/smart_positioning.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/smart_positioning.rs b/src/smart_positioning.rs
index 81a2c3d..55d3bf3 100644
--- a/src/smart_positioning.rs
+++ b/src/smart_positioning.rs
@@ -10,6 +10,8 @@ pub struct LabelPosition {
pub y: f64,
}
+// All fields relate to sizing/dimensions, so the consistent postfix is intentional and clear
+#[allow(clippy::struct_field_names)]
#[derive(Debug, Clone)]
pub struct PositioningDimensions {
pub map_size: (f64, f64),
@@ -89,6 +91,8 @@ pub fn calculate_optimal_label_position_cached(
);
// Score: collisions * 100 + note_collisions * 500 + distance * 0.5 + index * 0.1 + ownership
+ // Safe casts: collision counts and position indices are small numbers (< 1000 typically)
+ #[allow(clippy::cast_precision_loss)]
let score = (collision_count as f64) * 100.0
+ (note_collision_count as f64) * 500.0
+ distance * 0.5