From 92b785911067d4926bb7ef52bb7213ec5f043f98 Mon Sep 17 00:00:00 2001 From: Berkus Decker Date: Wed, 4 Aug 2021 00:52:52 +0300 Subject: [PATCH] [sq] rustfmt the device_tree code --- machine/src/device_tree.rs | 38 +++++++++++++++++++++++--------------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/machine/src/device_tree.rs b/machine/src/device_tree.rs index ae1bcc9c..726faa5d 100644 --- a/machine/src/device_tree.rs +++ b/machine/src/device_tree.rs @@ -79,7 +79,11 @@ impl<'a, 'i: 'a, 'dt: 'i> DeviceTreeProp<'a, 'i, 'dt> { Self(source) } - pub fn payload_pairs_iter(&'a self, address_cells: u32, size_cells: u32) -> PayloadPairsIter<'a, 'i, 'dt> { + pub fn payload_pairs_iter( + &'a self, + address_cells: u32, + size_cells: u32, + ) -> PayloadPairsIter<'a, 'i, 'dt> { PayloadPairsIter::new(&self.0, address_cells, size_cells) } } @@ -93,7 +97,11 @@ pub struct PayloadPairsIter<'a, 'i: 'a, 'dt: 'i> { } impl<'a, 'i: 'a, 'dt: 'i> PayloadPairsIter<'a, 'i, 'dt> { - pub fn new(prop: &'a DevTreeIndexProp<'a, 'i, 'dt>, address_cells: u32, size_cells: u32) -> Self { + pub fn new( + prop: &'a DevTreeIndexProp<'a, 'i, 'dt>, + address_cells: u32, + size_cells: u32, + ) -> Self { Self { prop, total: prop.length(), @@ -113,39 +121,39 @@ impl<'a, 'i: 'a, 'dt: 'i> Iterator for PayloadPairsIter<'a, 'i, 'dt> { return None; } Some(match (self.address_cells, self.size_cells) { - (1,1) => { + (1, 1) => { let result: Self::Item = ( self.prop.u32(self.offset / 8).unwrap().into(), - self.prop.u32(self.offset / 8 + 1).unwrap().into() + self.prop.u32(self.offset / 8 + 1).unwrap().into(), ); self.offset += 8; result - }, - (1,2) => { + } + (1, 2) => { let result: Self::Item = ( self.prop.u32(self.offset / 12).unwrap().into(), - u64::from(self.prop.u32(self.offset / 12 + 1).unwrap()) << 32 | - u64::from(self.prop.u32(self.offset / 12 + 2).unwrap()) + u64::from(self.prop.u32(self.offset / 12 + 1).unwrap()) << 32 + | u64::from(self.prop.u32(self.offset / 12 + 2).unwrap()), ); self.offset += 12; result - }, - (2,1) => { + } + (2, 1) => { let result: Self::Item = ( self.prop.u64(self.offset / 12).unwrap(), - self.prop.u32(self.offset / 12 + 2).unwrap().into() + self.prop.u32(self.offset / 12 + 2).unwrap().into(), ); self.offset += 12; result - }, - (2,2) => { + } + (2, 2) => { let result: Self::Item = ( self.prop.u64(self.offset / 16).unwrap(), - self.prop.u64(self.offset / 16 + 1).unwrap() + self.prop.u64(self.offset / 16 + 1).unwrap(), ); self.offset += 16; result - }, + } _ => panic!("oooops"), }) }