Skip to content

Commit

Permalink
Merge #706
Browse files Browse the repository at this point in the history
706: Fix some clippy lints r=Yatekii a=Tiwalun

These lints probably got added with the new Rust version.

Co-authored-by: Dominik Boehi <[email protected]>
  • Loading branch information
bors[bot] and Tiwalun authored Jun 21, 2021
2 parents 2a4f6bf + b03fe97 commit 14e9637
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 11 deletions.
9 changes: 3 additions & 6 deletions probe-rs/src/debug/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -331,11 +331,10 @@ impl<'debuginfo, 'probe, 'core> Iterator for StackFrameIterator<'debuginfo, 'pro
self.inlining_state
);
in_inlined_function = true;
break;
} else {
// No inlined function
break;
}
break;
}
}
} else {
Expand Down Expand Up @@ -1018,9 +1017,9 @@ impl<'debuginfo> UnitInfo<'debuginfo> {
if (ranges.begin <= address) && (address < ranges.end) {
// Check if we are actually in an inlined function

if find_inlined {
let die = FunctionDie::new(current.clone());
let die = FunctionDie::new(current.clone());

if find_inlined {
log::debug!(
"Found DIE, now checking for inlined functions: name={:?}",
die.function_name(&self)
Expand All @@ -1033,8 +1032,6 @@ impl<'debuginfo> UnitInfo<'debuginfo> {
Some(FunctionDie::new(current.clone()))
});
} else {
let die = FunctionDie::new(current.clone());

log::debug!("Found DIE: name={:?}", die.function_name(&self));

return Some(die);
Expand Down
2 changes: 1 addition & 1 deletion probe-rs/src/probe/cmsisdap/commands/transfer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ pub enum RW {

/// Contains information about requested access from host debugger.
#[allow(non_snake_case)]
#[derive(Copy, Clone, Debug)]
#[derive(Clone, Debug)]
pub struct InnerTransferRequest {
/// 0 = Debug PortType (DP), 1 = Access PortType (AP).
pub APnDP: PortType,
Expand Down
2 changes: 1 addition & 1 deletion probe-rs/src/probe/cmsisdap/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ impl CmsisDap {
return Ok(0);
}

let mut batch = std::mem::replace(&mut self.batch, Vec::new());
let mut batch = std::mem::take(&mut self.batch);

debug!("{} items in batch", batch.len());

Expand Down
4 changes: 2 additions & 2 deletions probe-rs/src/probe/stlink/constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ impl SwdFrequencyToDelayCount {
}

/// Get the SWD frequency in kHz
pub(crate) fn to_khz(&self) -> u32 {
pub(crate) fn to_khz(self) -> u32 {
use SwdFrequencyToDelayCount::*;

match self {
Expand Down Expand Up @@ -243,7 +243,7 @@ impl JTagFrequencyToDivider {
}

/// Return the frequency in kHz
pub(crate) fn to_khz(&self) -> u32 {
pub(crate) fn to_khz(self) -> u32 {
use JTagFrequencyToDivider::*;

match self {
Expand Down
3 changes: 2 additions & 1 deletion smoke-tester/src/dut_definition.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,8 @@ impl DutDefinition {
} else {
// For relative paths, join the path with the location of the source file to create an absolute path.

let source_file_directory = source_file.parent().unwrap_or(Path::new("."));
let source_file_directory =
source_file.parent().unwrap_or_else(|| Path::new("."));

let flash_binary_location = source_file_directory.join(path);

Expand Down

0 comments on commit 14e9637

Please sign in to comment.