Skip to content

Commit

Permalink
Clean for clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
cwfitzgerald committed Feb 10, 2023
1 parent 498e039 commit fdc3ebd
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@ where
pub fn allocate_range(&mut self, length: T) -> Result<Range<T>, RangeAllocationError<T>> {
assert_ne!(length + length, length);
let mut best_fit: Option<(usize, Range<T>)> = None;

// This is actually correct. With the trait bound as it is, we have
// no way to summon a value of 0 directly, so we make one by subtracting
// something from itself. Once the trait bound can be changed, this can
// be fixed.
#[allow(clippy::eq_op)]
let mut fragmented_free_length = length - length;
for (index, range) in self.free_ranges.iter().cloned().enumerate() {
let range_length = range.end - range.start;
Expand Down Expand Up @@ -133,7 +139,7 @@ where
}

/// Returns an iterator over allocated non-empty ranges
pub fn allocated_ranges<'a>(&'a self) -> impl 'a + Iterator<Item = Range<T>> {
pub fn allocated_ranges(&self) -> impl Iterator<Item = Range<T>> + '_ {
let first = match self.free_ranges.first() {
Some(Range { ref start, .. }) if *start > self.initial_range.start => {
Some(self.initial_range.start..*start)
Expand Down

0 comments on commit fdc3ebd

Please sign in to comment.