aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Alex Martens <alex@thinglab.org> 2023-10-29 15:20:42 -0700
committerGravatar Alex Martens <alex@thinglab.org> 2023-10-29 15:23:55 -0700
commit05369913a63f329600e7bf70ddfffef78509dc22 (patch)
tree4c8992c9cf5b219bd68394780982fba2c24214d6
parent7f6ff8fb72eb333344c02147c06e7dc6801870c3 (diff)
downloadcortex-m-05369913a63f329600e7bf70ddfffef78509dc22.tar.gz
cortex-m-05369913a63f329600e7bf70ddfffef78509dc22.tar.zst
cortex-m-05369913a63f329600e7bf70ddfffef78509dc22.zip
Fix new clippy lints
-rw-r--r--cortex-m-semihosting/src/debug.rs16
-rw-r--r--cortex-m/src/peripheral/scb.rs10
-rw-r--r--xtask/tests/ci.rs10
3 files changed, 14 insertions, 22 deletions
diff --git a/cortex-m-semihosting/src/debug.rs b/cortex-m-semihosting/src/debug.rs
index a4fa6d8..7c7ff9d 100644
--- a/cortex-m-semihosting/src/debug.rs
+++ b/cortex-m-semihosting/src/debug.rs
@@ -11,16 +11,14 @@
//! ```no_run
//! use cortex_m_semihosting::debug::{self, EXIT_SUCCESS, EXIT_FAILURE};
//!
-//! fn main() {
-//! if 2 == 2 {
-//! // report success
-//! debug::exit(EXIT_SUCCESS);
-//! } else {
-//! // report failure
-//! debug::exit(EXIT_FAILURE);
-//! }
+//! if 2 == 2 {
+//! // report success
+//! debug::exit(EXIT_SUCCESS);
+//! } else {
+//! // report failure
+//! debug::exit(EXIT_FAILURE);
//! }
-//!
+//! ```
/// This values are taken from section 5.5.2 of
/// ADS Debug Target Guide (DUI0058).
diff --git a/cortex-m/src/peripheral/scb.rs b/cortex-m/src/peripheral/scb.rs
index b9cf0e4..b10f9d2 100644
--- a/cortex-m/src/peripheral/scb.rs
+++ b/cortex-m/src/peripheral/scb.rs
@@ -664,10 +664,7 @@ impl SCB {
/// a runtime-dependent `panic!()` call.
#[inline]
pub unsafe fn invalidate_dcache_by_slice<T>(&mut self, slice: &mut [T]) {
- self.invalidate_dcache_by_address(
- slice.as_ptr() as usize,
- slice.len() * core::mem::size_of::<T>(),
- );
+ self.invalidate_dcache_by_address(slice.as_ptr() as usize, core::mem::size_of_val(slice));
}
/// Cleans D-cache by address.
@@ -750,10 +747,7 @@ impl SCB {
/// to main memory, overwriting whatever was in main memory.
#[inline]
pub fn clean_dcache_by_slice<T>(&mut self, slice: &[T]) {
- self.clean_dcache_by_address(
- slice.as_ptr() as usize,
- slice.len() * core::mem::size_of::<T>(),
- );
+ self.clean_dcache_by_address(slice.as_ptr() as usize, core::mem::size_of_val(slice));
}
/// Cleans and invalidates D-cache by address.
diff --git a/xtask/tests/ci.rs b/xtask/tests/ci.rs
index 1dc4754..3c3ef99 100644
--- a/xtask/tests/ci.rs
+++ b/xtask/tests/ci.rs
@@ -27,16 +27,16 @@ static NON_BASE_TARGETS: &[&str] = &[
fn build(package: &str, target: &str, features: &[&str]) {
println!("building {} for {} {:?}", package, target, features);
let mut cargo = Command::new("cargo");
- cargo.args(&["build", "-p", package, "--target", target]);
+ cargo.args(["build", "-p", package, "--target", target]);
for feat in features {
- cargo.args(&["--features", *feat]);
+ cargo.args(["--features", *feat]);
}
// A `critical_section` implementation is always needed.
if package == "cortex-m" {
- cargo.args(&["--features", "critical-section-single-core"]);
+ cargo.args(["--features", "critical-section-single-core"]);
} else {
- cargo.args(&["--features", "cortex-m/critical-section-single-core"]);
+ cargo.args(["--features", "cortex-m/critical-section-single-core"]);
}
// Cargo features don't work right when invoked from the workspace root, so change to the
@@ -77,7 +77,7 @@ fn check_crates_build(_is_nightly: bool) {
let used_features = &*all_features
.iter()
.copied()
- .filter(|feat| should_use_feature(*feat))
+ .filter(|feat| should_use_feature(feat))
.collect::<Vec<_>>();
// (note: we don't test with default features disabled, since we don't use them yet)