Skip to content

Commit 523cf3d

Browse files
committed
appease clippy
1 parent 5e5eb0e commit 523cf3d

File tree

3 files changed

+14
-16
lines changed

3 files changed

+14
-16
lines changed

cortex-m/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@
1717
//! are:
1818
//!
1919
//! - Reduced overhead. FFI eliminates the possibility of inlining so all operations include a
20-
//! function call overhead when `inline-asm` is not enabled.
20+
//! function call overhead when `inline-asm` is not enabled.
2121
//!
2222
//! - Some of the `register` API only becomes available only when `inline-asm` is enabled. Check the
23-
//! API docs for details.
23+
//! API docs for details.
2424
//!
2525
//! The disadvantage is that `inline-asm` requires a Rust version at least 1.59 to use the `asm!()`
2626
//! macro. In the future 0.8 and above versions of `cortex-m`, this feature will always be enabled.

cortex-m/src/peripheral/scb.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -646,10 +646,7 @@ impl SCB {
646646
/// a runtime-dependent `panic!()` call.
647647
#[inline]
648648
pub unsafe fn invalidate_dcache_by_slice<T>(&mut self, slice: &mut [T]) {
649-
self.invalidate_dcache_by_address(
650-
slice.as_ptr() as usize,
651-
slice.len() * core::mem::size_of::<T>(),
652-
);
649+
self.invalidate_dcache_by_address(slice.as_ptr() as usize, core::mem::size_of_val(slice));
653650
}
654651

655652
/// Cleans D-cache by address.
@@ -732,10 +729,7 @@ impl SCB {
732729
/// to main memory, overwriting whatever was in main memory.
733730
#[inline]
734731
pub fn clean_dcache_by_slice<T>(&mut self, slice: &[T]) {
735-
self.clean_dcache_by_address(
736-
slice.as_ptr() as usize,
737-
slice.len() * core::mem::size_of::<T>(),
738-
);
732+
self.clean_dcache_by_address(slice.as_ptr() as usize, core::mem::size_of_val(slice));
739733
}
740734

741735
/// Cleans and invalidates D-cache by address.

cortex-m/src/register/primask.rs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,17 +41,21 @@ pub fn read() -> Primask {
4141
/// Reads the entire PRIMASK register
4242
/// Note that bits [31:1] are reserved and UNK (Unknown)
4343
#[inline]
44+
#[cfg(cortex_m)]
4445
pub fn read_raw() -> u32 {
4546
let r: u32;
46-
#[cfg(cortex_m)]
47-
unsafe {
48-
asm!("mrs {}, PRIMASK", out(reg) r, options(nomem, nostack, preserves_flags))
49-
};
50-
#[cfg(not(cortex_m))]
51-
panic!("cannot read PRIMASK on non-cortex-m platform");
47+
unsafe { asm!("mrs {}, PRIMASK", out(reg) r, options(nomem, nostack, preserves_flags)) };
5248
r
5349
}
5450

51+
/// Reads the entire PRIMASK register
52+
/// Note that bits [31:1] are reserved and UNK (Unknown)
53+
#[inline]
54+
#[cfg(not(cortex_m))]
55+
pub fn read_raw() -> u32 {
56+
panic!("cannot read PRIMASK on non-cortex-m platform");
57+
}
58+
5559
/// Writes the entire PRIMASK register
5660
/// Note that bits [31:1] are reserved and SBZP (Should-Be-Zero-or-Preserved)
5761
///

0 commit comments

Comments
 (0)