Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions boards/components/src/led.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
),+
]
)
};};
}

Expand Down
22 changes: 11 additions & 11 deletions boards/components/src/led_matrix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
),+
]
)
};};
}

Expand Down
6 changes: 3 additions & 3 deletions capsules/src/l3gd20.rs
Original file line number Diff line number Diff line change
Expand Up @@ -377,9 +377,9 @@ impl Driver for L3gd20Spi<'_> {
) -> ReturnCode {
match subscribe_num {
0 /* set the one shot callback */ => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just FYI this is a known rustfmt issue: rust-lang/rustfmt#4119

self.callback.insert (callback);
ReturnCode::SUCCESS
},
self.callback.insert (callback);
ReturnCode::SUCCESS
},
// default
_ => ReturnCode::ENOSUPPORT,
}
Expand Down
6 changes: 3 additions & 3 deletions capsules/src/lsm303agr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
Expand Down
6 changes: 3 additions & 3 deletions capsules/src/lsm303dlhc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
Expand Down
6 changes: 3 additions & 3 deletions capsules/src/mlx90614.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
Expand Down
2 changes: 1 addition & 1 deletion chips/stm32f303xc/src/i2c.rs
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ const I2C1_BASE: StaticRef<I2CRegisters> =
unsafe { StaticRef::new(0x4000_5400 as *const I2CRegisters) };

// const I2C2_BASE: StaticRef<I2CRegisters> =
// unsafe { StaticRef::new(0x4000_5800 as *const I2CRegisters) };
// unsafe { StaticRef::new(0x4000_5800 as *const I2CRegisters) };

pub struct I2C<'a> {
registers: StaticRef<I2CRegisters>,
Expand Down
4 changes: 2 additions & 2 deletions kernel/src/debug.rs
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,7 @@ pub unsafe fn flush<W: Write + IoWrite>(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);
}
Expand All @@ -580,7 +580,7 @@ pub unsafe fn flush<W: Write + IoWrite>(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");
Expand Down
9 changes: 9 additions & 0 deletions tools/run_cargo_fmt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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)"
Expand Down