Resolve diagnostic probe strict Clippy findings
This commit is contained in:
@@ -97,7 +97,7 @@ fn point_contact(a: P, b: P, c: P, d: P) -> Option<P> {
|
||||
}
|
||||
let t = cross(sub(c, a), v) / denominator;
|
||||
let s = cross(sub(c, a), u) / denominator;
|
||||
(t >= -1e-9 && t <= 1. + 1e-9 && s >= -1e-9 && s <= 1. + 1e-9)
|
||||
((-1e-9..=1. + 1e-9).contains(&t) && (-1e-9..=1. + 1e-9).contains(&s))
|
||||
.then_some((a.0 + t.clamp(0., 1.) * u.0, a.1 + t.clamp(0., 1.) * u.1))
|
||||
}
|
||||
fn point_contacts(a: &[P], b: &[P]) -> Vec<(P, bool)> {
|
||||
@@ -249,15 +249,14 @@ fn metrics(project: &Project, diagram: Id) -> Value {
|
||||
shared += overlap;
|
||||
excluded_shared +=
|
||||
overlap.min(common_tips.len() as f64 * routing::PORT_STUB as f64);
|
||||
if let Some(at) = crossing {
|
||||
if unique.insert(((at.0 / EPS).round() as i64, (at.1 / EPS).round() as i64))
|
||||
{
|
||||
let near_tip = common_tips.iter().any(|tip| {
|
||||
length(sub(at, *tip)) <= routing::PORT_STUB as f64 + EPS
|
||||
});
|
||||
excluded_stub_crossings += usize::from(near_tip);
|
||||
crossings.push(json!({"edges":[a.id,b.id],"at":[at.0,at.1],"within_common_terminal_stub":near_tip}));
|
||||
}
|
||||
if let Some(at) = crossing
|
||||
&& unique.insert(((at.0 / EPS).round() as i64, (at.1 / EPS).round() as i64))
|
||||
{
|
||||
let near_tip = common_tips
|
||||
.iter()
|
||||
.any(|tip| length(sub(at, *tip)) <= routing::PORT_STUB as f64 + EPS);
|
||||
excluded_stub_crossings += usize::from(near_tip);
|
||||
crossings.push(json!({"edges":[a.id,b.id],"at":[at.0,at.1],"within_common_terminal_stub":near_tip}));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user