Merge recent update from ch7 && cargo clippy

This commit is contained in:
Yifan Wu 2022-01-22 12:32:36 -08:00
parent 737340b0a0
commit c9583b0f53
20 changed files with 236 additions and 163 deletions

View file

@ -78,12 +78,10 @@ impl PipeRingBuffer {
pub fn available_read(&self) -> usize {
if self.status == RingBufferStatus::EMPTY {
0
} else if self.tail > self.head {
self.tail - self.head
} else {
if self.tail > self.head {
self.tail - self.head
} else {
self.tail + RING_BUFFER_SIZE - self.head
}
self.tail + RING_BUFFER_SIZE - self.head
}
}
pub fn available_write(&self) -> usize {
@ -165,4 +163,4 @@ impl File for Pipe {
}
}
}
}
}