diff --git a/cortex-m-semihosting/src/debug.rs b/cortex-m-semihosting/src/debug.rs index a4fa6d83..7c7ff9d1 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 b9cf0e4b..b10f9d20 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(&mut self, slice: &mut [T]) { - self.invalidate_dcache_by_address( - slice.as_ptr() as usize, - slice.len() * core::mem::size_of::(), - ); + 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(&mut self, slice: &[T]) { - self.clean_dcache_by_address( - slice.as_ptr() as usize, - slice.len() * core::mem::size_of::(), - ); + 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 1dc4754c..3c3ef990 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::>(); // (note: we don't test with default features disabled, since we don't use them yet)