ext/pf2/src/profile_serializer.rs in pf2-0.6.0 vs ext/pf2/src/profile_serializer.rs in pf2-0.7.0

- old
+ new

@@ -27,15 +27,11 @@ impl ThreadProfile { fn new(thread_id: ThreadId) -> ThreadProfile { ThreadProfile { thread_id, // The root node - stack_tree: StackTreeNode { - children: HashMap::new(), - node_id: 0, - frame_id: 0, - }, + stack_tree: StackTreeNode { children: HashMap::new(), node_id: 0, frame_id: 0 }, frame_table: HashMap::new(), samples: vec![], } } } @@ -89,13 +85,11 @@ impl ProfileSerializer { pub fn serialize(profile: &Profile) -> String { let mut sequence = 1; - let mut serializer = ProfileSerializer { - threads: HashMap::new(), - }; + let mut serializer = ProfileSerializer { threads: HashMap::new() }; unsafe { // Process each sample for sample in profile.samples.iter() { let mut merged_stack: Vec<FrameTableEntry> = vec![]; @@ -220,13 +214,12 @@ }); if merged_stack.is_empty() { // This is the leaf node, record a Sample let elapsed_ns = (sample.timestamp - profile.start_instant).as_nanos(); - thread_serializer.samples.push(ProfileSample { - elapsed_ns, - stack_tree_id: stack_tree.node_id, - }); + thread_serializer + .samples + .push(ProfileSample { elapsed_ns, stack_tree_id: stack_tree.node_id }); } // Register frame metadata to frame table, if not registered yet thread_serializer .frame_table