Lint layout_2013 with clippy (#31221)

* Lint layout_2013 with clippy

CARGO_BUILD_RUSTC=rustc cargo clippy --fix -p layout_2013 --broken-code

* ./mach fmt

* Cosmetic adjustments
This commit is contained in:
Oriol Brufau 2024-01-30 12:46:35 +01:00 committed by GitHub
parent 16cabcf736
commit f7ead9bcb6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
28 changed files with 490 additions and 483 deletions

View file

@ -96,7 +96,7 @@ impl FlowList {
/// SECURITY-NOTE(pcwalton): This does not hand out `FlowRef`s by design. Do not add a method
/// to do so! See the comment above in `FlowList`.
#[inline]
pub fn iter<'a>(&'a self) -> FlowListIterator {
pub fn iter(&self) -> FlowListIterator {
FlowListIterator {
it: self.flows.iter(),
}
@ -141,6 +141,12 @@ impl FlowList {
}
}
impl Default for FlowList {
fn default() -> Self {
Self::new()
}
}
impl<'a> DoubleEndedIterator for FlowListIterator<'a> {
fn next_back(&mut self) -> Option<&'a dyn Flow> {
self.it.next_back().map(Deref::deref)
@ -187,7 +193,7 @@ pub struct FlowListRandomAccessMut<'a> {
}
impl<'a> FlowListRandomAccessMut<'a> {
pub fn get<'b>(&'b mut self, index: usize) -> &'b mut dyn Flow {
pub fn get(&mut self, index: usize) -> &mut dyn Flow {
while index >= self.cache.len() {
match self.iterator.next() {
None => panic!("Flow index out of range!"),