diff --git a/boards/components/src/led.rs b/boards/components/src/led.rs index faf0ae73d1..0a53da2468 100644 --- a/boards/components/src/led.rs +++ b/boards/components/src/led.rs @@ -25,17 +25,17 @@ macro_rules! led_component_helper { use kernel::static_init; const NUM_LEDS: usize = count_expressions!($($L),+); - static_init!( - [&'static $Led; NUM_LEDS], - [ - $( - static_init!( - $Led, - $L - ) - ),+ - ] - ) + static_init!( + [&'static $Led; NUM_LEDS], + [ + $( + static_init!( + $Led, + $L + ) + ),+ + ] + ) };}; } diff --git a/boards/components/src/led_matrix.rs b/boards/components/src/led_matrix.rs index 9cb79f1168..0071972d17 100644 --- a/boards/components/src/led_matrix.rs +++ b/boards/components/src/led_matrix.rs @@ -55,17 +55,17 @@ macro_rules! led_line_component_helper { use kernel::static_init; const NUM_LEDS: usize = count_expressions!($($L),+); - static_init!( - [&'static $Pin; NUM_LEDS], - [ - $( - static_init!( - &'static $Pin, - $L - ) - ),+ - ] - ) + static_init!( + [&'static $Pin; NUM_LEDS], + [ + $( + static_init!( + &'static $Pin, + $L + ) + ),+ + ] + ) };}; } diff --git a/capsules/src/l3gd20.rs b/capsules/src/l3gd20.rs index 9ead651c71..9379ca3023 100644 --- a/capsules/src/l3gd20.rs +++ b/capsules/src/l3gd20.rs @@ -377,9 +377,9 @@ impl Driver for L3gd20Spi<'_> { ) -> ReturnCode { match subscribe_num { 0 /* set the one shot callback */ => { - self.callback.insert (callback); - ReturnCode::SUCCESS - }, + self.callback.insert (callback); + ReturnCode::SUCCESS + }, // default _ => ReturnCode::ENOSUPPORT, } diff --git a/capsules/src/lsm303agr.rs b/capsules/src/lsm303agr.rs index b0d08aa8b6..b96a3c2274 100644 --- a/capsules/src/lsm303agr.rs +++ b/capsules/src/lsm303agr.rs @@ -607,9 +607,9 @@ impl Driver for Lsm303agrI2C<'_> { ) -> ReturnCode { match subscribe_num { 0 /* set the one shot callback */ => { - self.callback.insert (callback); - ReturnCode::SUCCESS - }, + self.callback.insert (callback); + ReturnCode::SUCCESS + }, // default _ => ReturnCode::ENOSUPPORT, } diff --git a/capsules/src/lsm303dlhc.rs b/capsules/src/lsm303dlhc.rs index 8ba5a4774f..0fd5e58dce 100644 --- a/capsules/src/lsm303dlhc.rs +++ b/capsules/src/lsm303dlhc.rs @@ -621,9 +621,9 @@ impl Driver for Lsm303dlhcI2C<'_> { ) -> ReturnCode { match subscribe_num { 0 /* set the one shot callback */ => { - self.callback.insert (callback); - ReturnCode::SUCCESS - }, + self.callback.insert (callback); + ReturnCode::SUCCESS + }, // default _ => ReturnCode::ENOSUPPORT, } diff --git a/capsules/src/mlx90614.rs b/capsules/src/mlx90614.rs index f7af584c9a..ecf2515d70 100644 --- a/capsules/src/mlx90614.rs +++ b/capsules/src/mlx90614.rs @@ -199,9 +199,9 @@ impl<'a> Driver for Mlx90614SMBus<'a> { ) -> ReturnCode { match subscribe_num { 0 /* set the one shot callback */ => { - self.callback.insert(callback); - ReturnCode::SUCCESS - }, + self.callback.insert(callback); + ReturnCode::SUCCESS + }, // default _ => ReturnCode::ENOSUPPORT, } diff --git a/chips/stm32f303xc/src/i2c.rs b/chips/stm32f303xc/src/i2c.rs index 1f0f843a27..d841aaf361 100644 --- a/chips/stm32f303xc/src/i2c.rs +++ b/chips/stm32f303xc/src/i2c.rs @@ -227,7 +227,7 @@ const I2C1_BASE: StaticRef = unsafe { StaticRef::new(0x4000_5400 as *const I2CRegisters) }; // const I2C2_BASE: StaticRef = -// unsafe { StaticRef::new(0x4000_5800 as *const I2CRegisters) }; +// unsafe { StaticRef::new(0x4000_5800 as *const I2CRegisters) }; pub struct I2C<'a> { registers: StaticRef, diff --git a/kernel/src/debug.rs b/kernel/src/debug.rs index d3367eeb0d..e7e18883bc 100644 --- a/kernel/src/debug.rs +++ b/kernel/src/debug.rs @@ -570,7 +570,7 @@ pub unsafe fn flush(writer: &mut W) { if ring_buffer.has_elements() { let _ = writer.write_str( "\r\n---| Debug buffer not empty. Flushing. May repeat some of last message(s):\r\n", - ); + ); writer.write_ring_buffer(ring_buffer); } @@ -580,7 +580,7 @@ pub unsafe fn flush(writer: &mut W) { None => { let _ = writer.write_str( "\r\n---| No debug queue found. You can set it with the DebugQueue component.\r\n", - ); + ); } Some(buffer) => { let _ = writer.write_str("\r\n---| Flushing debug queue:\r\n"); diff --git a/tools/run_cargo_fmt.sh b/tools/run_cargo_fmt.sh index bce9087eab..43e9078c53 100755 --- a/tools/run_cargo_fmt.sh +++ b/tools/run_cargo_fmt.sh @@ -86,6 +86,15 @@ done rm xx00 printf "\rFormatting complete. %-$((39))s\n" "" +# Check for tab characters in Rust source files that haven't been +# removed by rustfmt +RUST_FILES_WITH_TABS="$(git grep --files-with-matches $'\t' -- '*.rs' || grep -lr --include '*.rs' $'\t' . || true)" +if [ "$RUST_FILES_WITH_TABS" != "" ]; then + echo "ERROR: The following files contain tab characters, please use spaces instead:" + echo "$RUST_FILES_WITH_TABS" | sed 's/^/ -> /' + let FAIL=FAIL+1 +fi + if [[ $FAIL -ne 0 ]]; then echo echo "$(tput bold)Formatting errors.$(tput sgr0)"