Skip to content

Commit

Permalink
Merge pull request #490 from newAM/fix-clippy
Browse files Browse the repository at this point in the history
Fix new clippy lints
  • Loading branch information
newAM authored Oct 30, 2023
2 parents 7f6ff8f + 0536991 commit 7cdf8c6
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 22 deletions.
16 changes: 7 additions & 9 deletions cortex-m-semihosting/src/debug.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down
10 changes: 2 additions & 8 deletions cortex-m/src/peripheral/scb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down
10 changes: 5 additions & 5 deletions xtask/tests/ci.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 7cdf8c6

Please sign in to comment.