diff --git a/src/lib.rs b/src/lib.rs index 6a5774f..09644d5 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -84,12 +84,24 @@ pub fn invoke(_ctx: Context, inputs: Inputs) -> Result { .map(|(n, c)| Share { node: n.to_string(), paths_via_node: *c, - share: if total > 0 { *c as f32 / total as f32 } else { 0.0 }, + share: if total > 0 { + *c as f32 / total as f32 + } else { + 0.0 + }, }) .collect(); - shares.sort_by(|a, b| b.share.partial_cmp(&a.share).unwrap_or(core::cmp::Ordering::Equal)); + shares.sort_by(|a, b| { + b.share + .partial_cmp(&a.share) + .unwrap_or(core::cmp::Ordering::Equal) + }); - let out = Output { target, shares, method: "path-count-proportional" }; + let out = Output { + target, + shares, + method: "path-count-proportional", + }; Outputs::new().with_json("attribution", &out) }