diff options
author | 林炳权 <695601626@qq.com> | 2023-10-06 02:49:09 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-05 14:49:09 -0400 |
commit | 7a01799f490739612be27725f1584a995f6b1491 (patch) | |
tree | f7861a6db6d055ed109281533786046ad44c4eb8 /cli/tools/coverage | |
parent | ab3c9d41e483e5a7e6a326c66af7052a51301f91 (diff) |
chore: update to Rust 1.73 (#20781)
Diffstat (limited to 'cli/tools/coverage')
-rw-r--r-- | cli/tools/coverage/merge.rs | 22 |
1 files changed, 6 insertions, 16 deletions
diff --git a/cli/tools/coverage/merge.rs b/cli/tools/coverage/merge.rs index 0a436acfb..c7f9b1524 100644 --- a/cli/tools/coverage/merge.rs +++ b/cli/tools/coverage/merge.rs @@ -26,7 +26,7 @@ pub fn merge_processes( for script_cov in process_cov.result { url_to_scripts .entry(script_cov.url.clone()) - .or_insert_with(Vec::new) + .or_default() .push(script_cov); } } @@ -66,10 +66,7 @@ pub fn merge_scripts( end: root_range_cov.end_char_offset, } }; - range_to_funcs - .entry(root_range) - .or_insert_with(Vec::new) - .push(func_cov); + range_to_funcs.entry(root_range).or_default().push(func_cov); } } @@ -103,11 +100,7 @@ impl Ord for CharRange { impl PartialOrd for CharRange { fn partial_cmp(&self, other: &Self) -> Option<::std::cmp::Ordering> { - if self.start != other.start { - self.start.partial_cmp(&other.start) - } else { - other.end.partial_cmp(&self.end) - } + Some(self.cmp(other)) } } @@ -167,7 +160,7 @@ fn into_start_events<'a>(trees: Vec<&'a mut RangeTree<'a>>) -> Vec<StartEvent> { for child in tree.children.drain(..) { result .entry(child.start) - .or_insert_with(Vec::new) + .or_default() .push((parent_index, child)); } } @@ -294,7 +287,7 @@ fn merge_range_tree_children<'a>( }; parent_to_nested .entry(parent_index) - .or_insert_with(Vec::new) + .or_default() .push(child); } } @@ -312,10 +305,7 @@ fn merge_range_tree_children<'a>( flat_children[parent_index].push(tree); continue; } - parent_to_nested - .entry(parent_index) - .or_insert_with(Vec::new) - .push(tree); + parent_to_nested.entry(parent_index).or_default().push(tree); } start_event_queue.set_pending_offset(open_range_end); open_range = Some(CharRange { |