Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix new clippy lints #490

Merged
merged 1 commit into from
Oct 30, 2023
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
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
Loading