projects
/
Mitarbeiter
/
Tim-Zeitz
/
stud-rust-base.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
updates, clippy, formatting
[Mitarbeiter/Tim-Zeitz/stud-rust-base.git]
/
src
/
index_heap.rs
diff --git
a/src/index_heap.rs
b/src/index_heap.rs
index 5850ae802a3005775e593a86e1d6091931421d18..2c6f61397984a7719e9d3156440d3ea28adbee7a 100644
(file)
--- a/
src/index_heap.rs
+++ b/
src/index_heap.rs
@@
-168,10
+168,7
@@
impl<T: Ord + Indexing> IndexdMinHeap<T> {
let mut hole = Hole::new(&mut self.data, position);
loop {
let mut hole = Hole::new(&mut self.data, position);
loop {
- if let Some(smallest_child) =
- IndexdMinHeap::<T>::children_index_range(position, heap_size)
- .min_by_key(|&child_index| hole.get(child_index))
- {
+ if let Some(smallest_child) = IndexdMinHeap::<T>::children_index_range(position, heap_size).min_by_key(|&child_index| hole.get(child_index)) {
if hole.get(smallest_child) >= hole.element() {
self.positions[hole.element().as_index()] = position;
return; // no child is smaller
if hole.get(smallest_child) >= hole.element() {
self.positions[hole.element().as_index()] = position;
return; // no child is smaller
@@
-218,11
+215,7
@@
impl<'a, T> Hole<'a, T> {
unsafe fn new(data: &'a mut [T], pos: usize) -> Self {
debug_assert!(pos < data.len());
let elt = ptr::read(&data[pos]);
unsafe fn new(data: &'a mut [T], pos: usize) -> Self {
debug_assert!(pos < data.len());
let elt = ptr::read(&data[pos]);
- Hole {
- data,
- elt: Some(elt),
- pos,
- }
+ Hole { data, elt: Some(elt), pos }
}
/// Returns a reference to the element removed.
}
/// Returns a reference to the element removed.