Use rustfmt style edition 2024 (#3121)
diff --git a/probe-rs-tools/src/bin/cargo-embed.rs b/probe-rs-tools/src/bin/cargo-embed.rs index 8094dd0..6375509 100644 --- a/probe-rs-tools/src/bin/cargo-embed.rs +++ b/probe-rs-tools/src/bin/cargo-embed.rs
@@ -1,6 +1,6 @@ #[cfg(unix)] use std::os::unix::process::CommandExt; -use std::process::{exit, Command}; +use std::process::{Command, exit}; fn main() { let mut args: Vec<_> = std::env::args_os().collect();
diff --git a/probe-rs-tools/src/bin/cargo-flash.rs b/probe-rs-tools/src/bin/cargo-flash.rs index 92f9165..8a9ef02 100644 --- a/probe-rs-tools/src/bin/cargo-flash.rs +++ b/probe-rs-tools/src/bin/cargo-flash.rs
@@ -1,6 +1,6 @@ #[cfg(unix)] use std::os::unix::process::CommandExt; -use std::process::{exit, Command}; +use std::process::{Command, exit}; fn main() { let mut args: Vec<_> = std::env::args_os().collect();
diff --git a/probe-rs-tools/src/bin/probe-rs/cmd/benchmark.rs b/probe-rs-tools/src/bin/probe-rs/cmd/benchmark.rs index 1a19f3c..35202ab 100644 --- a/probe-rs-tools/src/bin/probe-rs/cmd/benchmark.rs +++ b/probe-rs-tools/src/bin/probe-rs/cmd/benchmark.rs
@@ -4,7 +4,7 @@ }; use anyhow::Context; -use probe_rs::{probe::list::Lister, MemoryInterface}; +use probe_rs::{MemoryInterface, probe::list::Lister}; use crate::util::common_options::LoadedProbeOptions; use crate::util::common_options::ProbeOptions;
diff --git a/probe-rs-tools/src/bin/probe-rs/cmd/cargo_embed/config/mod.rs b/probe-rs-tools/src/bin/probe-rs/cmd/cargo_embed/config/mod.rs index ed12137..cccbcb5 100644 --- a/probe-rs-tools/src/bin/probe-rs/cmd/cargo_embed/config/mod.rs +++ b/probe-rs-tools/src/bin/probe-rs/cmd/cargo_embed/config/mod.rs
@@ -1,7 +1,7 @@ use anyhow::bail; use figment::{ - providers::{Format, Json, Toml, Yaml}, Figment, + providers::{Format, Json, Toml, Yaml}, }; use probe_rs::probe::WireProtocol; use serde::{Deserialize, Serialize}; @@ -211,8 +211,8 @@ Some("yml" | "yaml") => original.merge(Yaml::file(conf_file).nested()), _ => { return Err(anyhow::anyhow!( - "File format not recognized from extension (supported: .toml, .json, .yaml / .yml)" - )) + "File format not recognized from extension (supported: .toml, .json, .yaml / .yml)" + )); } }; Ok(())
diff --git a/probe-rs-tools/src/bin/probe-rs/cmd/cargo_embed/mod.rs b/probe-rs-tools/src/bin/probe-rs/cmd/cargo_embed/mod.rs index 192e029..963bddb 100644 --- a/probe-rs-tools/src/bin/probe-rs/cmd/cargo_embed/mod.rs +++ b/probe-rs-tools/src/bin/probe-rs/cmd/cargo_embed/mod.rs
@@ -2,7 +2,7 @@ mod error; mod rttui; -use anyhow::{anyhow, Context, Result}; +use anyhow::{Context, Result, anyhow}; use clap::Parser; use colored::Colorize; use parking_lot::FairMutex; @@ -10,7 +10,7 @@ use probe_rs::gdb_server::GdbInstanceConfiguration; use probe_rs::probe::list::Lister; use probe_rs::rtt::ScanRegion; -use probe_rs::{probe::DebugProbeSelector, Session}; +use probe_rs::{Session, probe::DebugProbeSelector}; use std::ffi::OsString; use std::time::Instant; use std::{fs, thread}; @@ -25,6 +25,7 @@ }; use time::{OffsetDateTime, UtcOffset}; +use crate::FormatOptions; use crate::util::cargo::target_instruction_set; use crate::util::common_options::{BinaryDownloadOptions, OperationError, ProbeOptions}; use crate::util::flash::{build_loader, run_flash_download}; @@ -32,7 +33,6 @@ use crate::util::rtt::client::RttClient; use crate::util::rtt::{self, RttChannelConfig, RttConfig}; use crate::util::{cargo::build_artifact, common_options::CargoOptions, logging}; -use crate::FormatOptions; #[derive(Debug, clap::Parser)] #[clap( @@ -218,7 +218,8 @@ Err(OperationError::MultipleProbesFound { list }) => { use std::fmt::Write; - return Err(anyhow!("The following devices were found:\n \ + return Err(anyhow!( + "The following devices were found:\n \ {} \ \ Use '--probe VID:PID'\n \ @@ -226,7 +227,13 @@ You can also set the [default.probe] config attribute \ (in your Embed.toml) to select which probe to use. \ For usage examples see https://github.com/probe-rs/probe-rs/blob/master/probe-rs-tools/src/bin/probe-rs/cmd/cargo_embed/config/default.toml .", - list.iter().enumerate().fold(String::new(), |mut s, (num, link)| { let _ = writeln!(s, "[{num}]: {link}"); s }))); + list.iter() + .enumerate() + .fold(String::new(), |mut s, (num, link)| { + let _ = writeln!(s, "[{num}]: {link}"); + s + }) + )); } Err(OperationError::AttachingFailed { source, @@ -237,7 +244,9 @@ tracing::info!( "A hard reset during attaching might help. This will reset the entire chip." ); - tracing::info!("Set `general.connect_under_reset` in your cargo-embed configuration file to enable this feature."); + tracing::info!( + "Set `general.connect_under_reset` in your cargo-embed configuration file to enable this feature." + ); } return Err(source).context("failed attaching to target"); }
diff --git a/probe-rs-tools/src/bin/probe-rs/cmd/cargo_embed/rttui/app.rs b/probe-rs-tools/src/bin/probe-rs/cmd/cargo_embed/rttui/app.rs index d2f812c..7672eef 100644 --- a/probe-rs-tools/src/bin/probe-rs/cmd/cargo_embed/rttui/app.rs +++ b/probe-rs-tools/src/bin/probe-rs/cmd/cargo_embed/rttui/app.rs
@@ -1,16 +1,16 @@ -use anyhow::{anyhow, Context, Result}; +use anyhow::{Context, Result, anyhow}; use probe_rs::Core; use ratatui::{ + Terminal, backend::CrosstermBackend, crossterm::{ event::{self, KeyCode, KeyEventKind}, execute, - terminal::{disable_raw_mode, enable_raw_mode, EnterAlternateScreen, LeaveAlternateScreen}, + terminal::{EnterAlternateScreen, LeaveAlternateScreen, disable_raw_mode, enable_raw_mode}, }, layout::{Constraint, Direction, Layout, Rect}, style::{Color, Modifier, Style}, widgets::{Block, Borders, List, Paragraph, Tabs}, - Terminal, }; use std::{cell::RefCell, io::Write, rc::Rc}; use std::{path::PathBuf, sync::mpsc::TryRecvError}; @@ -18,7 +18,7 @@ use crate::{ cmd::cargo_embed::rttui::{channel::ChannelData, tab::TabConfig}, - util::rtt::{client::RttClient, DataFormat, DefmtProcessor, DefmtState, RttDecoder}, + util::rtt::{DataFormat, DefmtProcessor, DefmtState, RttDecoder, client::RttClient}, }; use super::super::config;
diff --git a/probe-rs-tools/src/bin/probe-rs/cmd/cargo_embed/rttui/channel.rs b/probe-rs-tools/src/bin/probe-rs/cmd/cargo_embed/rttui/channel.rs index c4959bd..47fff81 100644 --- a/probe-rs-tools/src/bin/probe-rs/cmd/cargo_embed/rttui/channel.rs +++ b/probe-rs-tools/src/bin/probe-rs/cmd/cargo_embed/rttui/channel.rs
@@ -1,10 +1,10 @@ use std::net::SocketAddr; -use probe_rs::{rtt::Error, Core}; +use probe_rs::{Core, rtt::Error}; use crate::{ cmd::cargo_embed::rttui::tcp::TcpPublisher, - util::rtt::{client::RttClient, RttActiveUpChannel, RttDataHandler, RttDecoder}, + util::rtt::{RttActiveUpChannel, RttDataHandler, RttDecoder, client::RttClient}, }; pub enum ChannelData {
diff --git a/probe-rs-tools/src/bin/probe-rs/cmd/cargo_embed/rttui/event.rs b/probe-rs-tools/src/bin/probe-rs/cmd/cargo_embed/rttui/event.rs index de68662..69416ec 100644 --- a/probe-rs-tools/src/bin/probe-rs/cmd/cargo_embed/rttui/event.rs +++ b/probe-rs-tools/src/bin/probe-rs/cmd/cargo_embed/rttui/event.rs
@@ -1,5 +1,5 @@ use std::sync::mpsc; -use std::sync::{atomic::AtomicBool, Arc}; +use std::sync::{Arc, atomic::AtomicBool}; use std::thread; use std::time::Duration;
diff --git a/probe-rs-tools/src/bin/probe-rs/cmd/cargo_flash/diagnostics.rs b/probe-rs-tools/src/bin/probe-rs/cmd/cargo_flash/diagnostics.rs index 889c3ee..834fe02 100644 --- a/probe-rs-tools/src/bin/probe-rs/cmd/cargo_flash/diagnostics.rs +++ b/probe-rs-tools/src/bin/probe-rs/cmd/cargo_flash/diagnostics.rs
@@ -6,9 +6,9 @@ use bytesize::ByteSize; use probe_rs::{ + Error as ProbeRsError, Target, config::{RegistryError, TargetDescriptionSource}, flashing::{FileDownloadError, FlashError}, - Error as ProbeRsError, Target, }; use crate::util::cargo::ArtifactError;
diff --git a/probe-rs-tools/src/bin/probe-rs/cmd/cargo_flash/mod.rs b/probe-rs-tools/src/bin/probe-rs/cmd/cargo_flash/mod.rs index 7670190..738c723 100644 --- a/probe-rs-tools/src/bin/probe-rs/cmd/cargo_flash/mod.rs +++ b/probe-rs-tools/src/bin/probe-rs/cmd/cargo_flash/mod.rs
@@ -12,7 +12,7 @@ BinaryDownloadOptions, CargoOptions, OperationError, ProbeOptions, }; use crate::util::flash; -use crate::util::logging::{setup_logging, LevelFilter}; +use crate::util::logging::{LevelFilter, setup_logging}; use crate::util::{cargo::build_artifact, logging}; /// Common options when flashing a target device.
diff --git a/probe-rs-tools/src/bin/probe-rs/cmd/complete.rs b/probe-rs-tools/src/bin/probe-rs/cmd/complete.rs index 755426d..8e20892 100644 --- a/probe-rs-tools/src/bin/probe-rs/cmd/complete.rs +++ b/probe-rs-tools/src/bin/probe-rs/cmd/complete.rs
@@ -1,12 +1,11 @@ use std::path::PathBuf; use std::{fmt::Write, path::Path}; -use anyhow::{anyhow, Context, Result}; +use anyhow::{Context, Result, anyhow}; use clap::CommandFactory; use clap_complete::{ - generate, + Generator, Shell, generate, shells::{Bash, PowerShell, Zsh}, - Generator, Shell, }; use probe_rs::probe::list::Lister; @@ -303,7 +302,9 @@ println!("{script}"); eprintln!("The user home directory could not be located."); eprintln!("Write the script to ~\\Documents\\WindowsPowerShell\\{file_name}"); - eprintln!("Install the autocompletion with `Import-Module ~\\Documents\\WindowsPowerShell\\{file_name}`"); + eprintln!( + "Install the autocompletion with `Import-Module ~\\Documents\\WindowsPowerShell\\{file_name}`" + ); return Ok(()); }; let path = dir
diff --git a/probe-rs-tools/src/bin/probe-rs/cmd/dap_server/debug_adapter/dap/adapter.rs b/probe-rs-tools/src/bin/probe-rs/cmd/dap_server/debug_adapter/dap/adapter.rs index 125f07e..d1f8224 100644 --- a/probe-rs-tools/src/bin/probe-rs/cmd/dap_server/debug_adapter/dap/adapter.rs +++ b/probe-rs-tools/src/bin/probe-rs/cmd/dap_server/debug_adapter/dap/adapter.rs
@@ -8,32 +8,32 @@ }, }; use crate::cmd::dap_server::{ + DebuggerError, debug_adapter::protocol::{ProtocolAdapter, ProtocolHelper}, server::{ configuration::ConsoleLog, core_data::CoreHandle, session_data::{BreakpointType, SourceLocationScope}, }, - DebuggerError, }; use crate::util::rtt; -use anyhow::{anyhow, Result}; -use base64::{engine::general_purpose as base64_engine, Engine as _}; +use anyhow::{Result, anyhow}; +use base64::{Engine as _, engine::general_purpose as base64_engine}; use dap_types::*; use parse_int::parse; use probe_rs::{ + Architecture::Riscv, + CoreStatus, Error, HaltReason, MemoryInterface, RegisterValue, architecture::{ arm::ArmError, riscv::communication_interface::RiscvError, xtensa::communication_interface::XtensaError, }, - Architecture::Riscv, - CoreStatus, Error, HaltReason, MemoryInterface, RegisterValue, }; use probe_rs_debug::{ - stack_frame::StackFrameInfo, ColumnType, ObjectRef, SourceLocation, SteppingMode, VariableName, - VerifiedBreakpoint, + ColumnType, ObjectRef, SourceLocation, SteppingMode, VariableName, VerifiedBreakpoint, + stack_frame::StackFrameInfo, }; -use serde::{de::DeserializeOwned, Serialize}; +use serde::{Serialize, de::DeserializeOwned}; use typed_path::NativePathBuf; use std::{fmt::Display, str, time::Duration}; @@ -367,7 +367,9 @@ { response_body = evaluate_response; } else { - response_body.result = format!("Error: Could not parse response body: {repl_response_body:?}"); + response_body.result = format!( + "Error: Could not parse response body: {repl_response_body:?}" + ); }; } else { response_body.result = repl_response @@ -817,7 +819,9 @@ }); self.send_event("stopped", event_body)?; } else { - tracing::debug!("Core is halted, but not due to a breakpoint and halt_after_reset is not set. Continuing."); + tracing::debug!( + "Core is halted, but not due to a breakpoint and halt_after_reset is not set. Continuing." + ); self.r#continue(target_core, request)?; } } @@ -850,7 +854,7 @@ "Failed to clear existing breakpoints before setting new ones : {}", error ))), - ) + ); } } @@ -1010,7 +1014,7 @@ } } Err(error) => { - return self.send_response::<()>(request, Err(&DebuggerError::ProbeRs(error))) + return self.send_response::<()>(request, Err(&DebuggerError::ProbeRs(error))); } }; @@ -1484,7 +1488,10 @@ frame_info, )?; } else { - tracing::error!("Could not cache deferred child variables for variable: {}. No register data available.", parent_variable.name); + tracing::error!( + "Could not cache deferred child variables for variable: {}. No register data available.", + parent_variable.name + ); } } }
diff --git a/probe-rs-tools/src/bin/probe-rs/cmd/dap_server/debug_adapter/dap/repl_commands.rs b/probe-rs-tools/src/bin/probe-rs/cmd/dap_server/debug_adapter/dap/repl_commands.rs index bd26aae..9c33619 100644 --- a/probe-rs-tools/src/bin/probe-rs/cmd/dap_server/debug_adapter/dap/repl_commands.rs +++ b/probe-rs-tools/src/bin/probe-rs/cmd/dap_server/debug_adapter/dap/repl_commands.rs
@@ -7,7 +7,7 @@ repl_types::*, request_helpers::set_instruction_breakpoint, }; -use crate::cmd::dap_server::{server::core_data::CoreHandle, DebuggerError}; +use crate::cmd::dap_server::{DebuggerError, server::core_data::CoreHandle}; use itertools::Itertools; use probe_rs::{CoreDump, CoreStatus, HaltReason}; use probe_rs_debug::{ObjectRef, VariableName}; @@ -186,9 +186,9 @@ } } } - Err(DebuggerError::UserMessage( - format!("Invalid parameters {command_arguments:?}. See the `help` command for more information."), - )) + Err(DebuggerError::UserMessage(format!( + "Invalid parameters {command_arguments:?}. See the `help` command for more information." + ))) }, }, ReplCommand { @@ -239,8 +239,7 @@ sub_commands: Some(&[ ReplCommand { command: "frame", - help_text: - "Describe the current frame, or the frame at the specified (hex) address.", + help_text: "Describe the current frame, or the frame at the specified (hex) address.", sub_commands: None, args: Some(&[ReplCommandArgs::Optional("address")]), // TODO: This is easy to implement ... just requires deciding how to format the output. @@ -380,9 +379,7 @@ if input_address == 0 { // No address was specified, so we'll use the frame address, if available. - let frame_id = request_arguments - .frame_id - .map(ObjectRef::from); + let frame_id = request_arguments.frame_id.map(ObjectRef::from); input_address = if let Some(frame_pc) = frame_id .and_then(|frame_id| {
diff --git a/probe-rs-tools/src/bin/probe-rs/cmd/dap_server/debug_adapter/dap/repl_commands_helpers.rs b/probe-rs-tools/src/bin/probe-rs/cmd/dap_server/debug_adapter/dap/repl_commands_helpers.rs index a7326f5..8259995 100644 --- a/probe-rs-tools/src/bin/probe-rs/cmd/dap_server/debug_adapter/dap/repl_commands_helpers.rs +++ b/probe-rs-tools/src/bin/probe-rs/cmd/dap_server/debug_adapter/dap/repl_commands_helpers.rs
@@ -1,14 +1,14 @@ use probe_rs::MemoryInterface; use probe_rs_debug::{ObjectRef, VariableName}; -use crate::cmd::dap_server::{server::core_data::CoreHandle, DebuggerError}; +use crate::cmd::dap_server::{DebuggerError, server::core_data::CoreHandle}; use super::{ dap_types::{ CompletionItem, CompletionItemType, CompletionsArguments, DisassembledInstruction, EvaluateArguments, EvaluateResponseBody, Response, }, - repl_commands::{ReplCommand, ReplHandler, REPL_COMMANDS}, + repl_commands::{REPL_COMMANDS, ReplCommand, ReplHandler}, repl_types::*, request_helpers::disassemble_target_memory, }; @@ -153,7 +153,7 @@ Err(err) => { return Err(DebuggerError::UserMessage(format!( "Cannot read memory at address {address:#010x}: {err:?}" - ))) + ))); } } }
diff --git a/probe-rs-tools/src/bin/probe-rs/cmd/dap_server/debug_adapter/dap/request_helpers.rs b/probe-rs-tools/src/bin/probe-rs/cmd/dap_server/debug_adapter/dap/request_helpers.rs index 048090f..0c39ec1 100644 --- a/probe-rs-tools/src/bin/probe-rs/cmd/dap_server/debug_adapter/dap/request_helpers.rs +++ b/probe-rs-tools/src/bin/probe-rs/cmd/dap_server/debug_adapter/dap/request_helpers.rs
@@ -1,14 +1,14 @@ use crate::cmd::dap_server::{ + DebuggerError, debug_adapter::dap::dap_types::{DisassembledInstruction, Source}, peripherals::svd_cache::{SvdVariableCache, Variable}, server::{core_data::CoreHandle, session_data::BreakpointType}, - DebuggerError, }; use addr2line::gimli::RunTimeEndian; -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use capstone::{ - arch::arm::ArchMode as armArchMode, arch::arm64::ArchMode as aarch64ArchMode, - arch::riscv::ArchMode as riscvArchMode, prelude::*, Endian, + Endian, arch::arm::ArchMode as armArchMode, arch::arm64::ArchMode as aarch64ArchMode, + arch::riscv::ArchMode as riscvArchMode, prelude::*, }; use itertools::Itertools; use probe_rs::{CoreType, Error, InstructionSet, MemoryInterface}; @@ -312,7 +312,10 @@ maybe_previous_source_location = Some(current_source_location); } else { // It won't affect the outcome, but log it for completeness. - tracing::debug!("The request `Disassemble` could not resolve a source location for memory reference: {:#010}", instruction.address()); + tracing::debug!( + "The request `Disassemble` could not resolve a source location for memory reference: {:#010}", + instruction.address() + ); } disassembled_instructions.push(DisassembledInstruction { @@ -602,20 +605,28 @@ ColumnType::LeftEdge => 0_i64, ColumnType::Column(c) => c as i64, }); - breakpoint_response.message = Some(format!("Instruction breakpoint set @:{memory_reference:#010x}. File: {}: Line: {}, Column: {}", - &source_location.file_name().unwrap_or_else(|| "<unknown source file>".to_string()), - breakpoint_response.line.unwrap_or(0), - breakpoint_response.column.unwrap_or(0))); + breakpoint_response.message = Some(format!( + "Instruction breakpoint set @:{memory_reference:#010x}. File: {}: Line: {}, Column: {}", + &source_location + .file_name() + .unwrap_or_else(|| "<unknown source file>".to_string()), + breakpoint_response.line.unwrap_or(0), + breakpoint_response.column.unwrap_or(0) + )); } None => { - breakpoint_response.message = Some(format!("Instruction breakpoint set @:{memory_reference:#010x}, but could not resolve a source location.")); + breakpoint_response.message = Some(format!( + "Instruction breakpoint set @:{memory_reference:#010x}, but could not resolve a source location." + )); } } } Err(error) => { breakpoint_response.instruction_reference = Some(requested_breakpoint.instruction_reference); - breakpoint_response.message = Some(format!("Warning: Could not set breakpoint at memory address: {memory_reference:#010x}: {error}")); + breakpoint_response.message = Some(format!( + "Warning: Could not set breakpoint at memory address: {memory_reference:#010x}: {error}" + )); } } } else {
diff --git a/probe-rs-tools/src/bin/probe-rs/cmd/dap_server/debug_adapter/protocol.rs b/probe-rs-tools/src/bin/probe-rs/cmd/dap_server/debug_adapter/protocol.rs index e7f1394..1d3a515 100644 --- a/probe-rs-tools/src/bin/probe-rs/cmd/dap_server/debug_adapter/protocol.rs +++ b/probe-rs-tools/src/bin/probe-rs/cmd/dap_server/debug_adapter/protocol.rs
@@ -1,12 +1,12 @@ use crate::cmd::dap_server::{ + DebuggerError, debug_adapter::dap::dap_types::{ ErrorResponseBody, Event, Message, MessageSeverity, OutputEventBody, ProtocolMessage, Request, Response, ShowMessageEventBody, }, server::configuration::ConsoleLog, - DebuggerError, }; -use anyhow::{anyhow, Context}; +use anyhow::{Context, anyhow}; use serde::Serialize; use std::{ collections::{BTreeMap, HashMap},
diff --git a/probe-rs-tools/src/bin/probe-rs/cmd/dap_server/mod.rs b/probe-rs-tools/src/bin/probe-rs/cmd/dap_server/mod.rs index b861246..3fa9957 100644 --- a/probe-rs-tools/src/bin/probe-rs/cmd/dap_server/mod.rs +++ b/probe-rs-tools/src/bin/probe-rs/cmd/dap_server/mod.rs
@@ -9,10 +9,10 @@ use anyhow::Result; use probe_rs::{ + CoreDumpError, Error, architecture::arm::ap::AccessPortError, flashing::FileDownloadError, - probe::{list::Lister, DebugProbeError}, - CoreDumpError, Error, + probe::{DebugProbeError, list::Lister}, }; use probe_rs_debug::DebugError; use server::startup::debug;
diff --git a/probe-rs-tools/src/bin/probe-rs/cmd/dap_server/peripherals/svd_cache.rs b/probe-rs-tools/src/bin/probe-rs/cmd/dap_server/peripherals/svd_cache.rs index a0df667..3429d4b 100644 --- a/probe-rs-tools/src/bin/probe-rs/cmd/dap_server/peripherals/svd_cache.rs +++ b/probe-rs-tools/src/bin/probe-rs/cmd/dap_server/peripherals/svd_cache.rs
@@ -1,7 +1,7 @@ use std::collections::BTreeMap; use probe_rs::MemoryInterface; -use probe_rs_debug::{get_object_reference, DebugError, ObjectRef}; +use probe_rs_debug::{DebugError, ObjectRef, get_object_reference}; /// VariableCache stores available `Variable`s, and provides methods to create and navigate the parent-child relationships of the Variables. #[derive(Debug, Clone, PartialEq)] @@ -93,7 +93,12 @@ [] => None, [variable] => Some(variable), [.., last] => { - tracing::error!("Found {} variables with parent_key={:?} and name={}. Please report this as a bug.", child_variables.len(), parent_key, variable_name); + tracing::error!( + "Found {} variables with parent_key={:?} and name={}. Please report this as a bug.", + child_variables.len(), + parent_key, + variable_name + ); Some(last) } } @@ -117,7 +122,10 @@ // Validate that the parent_key exists ... if !self.variable_hash_map.contains_key(&parent_key) { - return Err(DebugError::Other(format!("SvdVariableCache: Attempted to add a new variable: {} with non existent `parent_key`: {:?}. Please report this as a bug", cache_variable.name, parent_key))); + return Err(DebugError::Other(format!( + "SvdVariableCache: Attempted to add a new variable: {} with non existent `parent_key`: {:?}. Please report this as a bug", + cache_variable.name, parent_key + ))); } tracing::trace!( @@ -131,7 +139,10 @@ .variable_hash_map .insert(cache_variable.variable_key, cache_variable.clone()) { - return Err(DebugError::Other(format!("Attempt to insert a new `SvdVariable`:{:?} with a duplicate cache key: {:?}. Please report this as a bug.", cache_variable.name, old_variable.variable_key))); + return Err(DebugError::Other(format!( + "Attempt to insert a new `SvdVariable`:{:?} with a duplicate cache key: {:?}. Please report this as a bug.", + cache_variable.name, old_variable.variable_key + ))); } Ok(cache_variable.variable_key)
diff --git a/probe-rs-tools/src/bin/probe-rs/cmd/dap_server/peripherals/svd_variables.rs b/probe-rs-tools/src/bin/probe-rs/cmd/dap_server/peripherals/svd_variables.rs index 86ed8ab..dcd5ed6 100644 --- a/probe-rs-tools/src/bin/probe-rs/cmd/dap_server/peripherals/svd_variables.rs +++ b/probe-rs-tools/src/bin/probe-rs/cmd/dap_server/peripherals/svd_variables.rs
@@ -1,6 +1,6 @@ use crate::cmd::dap_server::{ - debug_adapter::{dap::adapter::DebugAdapter, protocol::ProtocolAdapter}, DebuggerError, + debug_adapter::{dap::adapter::DebugAdapter, protocol::ProtocolAdapter}, }; use std::{fmt::Debug, fs::File, io::Read, path::Path}; use svd_parser::Config;
diff --git a/probe-rs-tools/src/bin/probe-rs/cmd/dap_server/server/configuration.rs b/probe-rs-tools/src/bin/probe-rs/cmd/dap_server/server/configuration.rs index bafecea..e1574fc 100644 --- a/probe-rs-tools/src/bin/probe-rs/cmd/dap_server/server/configuration.rs +++ b/probe-rs-tools/src/bin/probe-rs/cmd/dap_server/server/configuration.rs
@@ -1,7 +1,7 @@ use crate::util::common_options::ProbeOptions; use crate::util::rtt; -use crate::{cmd::dap_server::DebuggerError, FormatOptions}; -use anyhow::{anyhow, Result}; +use crate::{FormatOptions, cmd::dap_server::DebuggerError}; +use anyhow::{Result, anyhow}; use probe_rs::probe::{DebugProbeSelector, WireProtocol}; use serde::{Deserialize, Serialize}; use std::{env::current_dir, path::PathBuf}; @@ -93,8 +93,8 @@ } Err(error) => { return Err(DebuggerError::Other(anyhow!( - "Please use the `program-binary` option to specify an executable for this target core. {error:?}" - ))); + "Please use the `program-binary` option to specify an executable for this target core. {error:?}" + ))); } }; // Update the `svd_file` and validate that the file exists, or else warn the user and continue. @@ -145,7 +145,9 @@ if let Ok(current_dir) = current_dir() { Some(current_dir) } else { - tracing::error!("Cannot use current working directory. Please check existence and permissions."); + tracing::error!( + "Cannot use current working directory. Please check existence and permissions." + ); None } }
diff --git a/probe-rs-tools/src/bin/probe-rs/cmd/dap_server/server/core_data.rs b/probe-rs-tools/src/bin/probe-rs/cmd/dap_server/server/core_data.rs index b2c3722..246b65b 100644 --- a/probe-rs-tools/src/bin/probe-rs/cmd/dap_server/server/core_data.rs +++ b/probe-rs-tools/src/bin/probe-rs/cmd/dap_server/server/core_data.rs
@@ -5,6 +5,7 @@ use crate::util::rtt::{self, DataFormat, DefmtProcessor, DefmtState}; use crate::{ cmd::dap_server::{ + DebuggerError, debug_adapter::{ dap::{ adapter::DebugAdapter, @@ -15,15 +16,14 @@ }, peripherals::svd_variables::SvdCache, server::debug_rtt, - DebuggerError, }, util::rtt::RttDecoder, }; -use anyhow::{anyhow, Result}; -use probe_rs::{rtt::ScanRegion, Core, CoreStatus, HaltReason}; +use anyhow::{Result, anyhow}; +use probe_rs::{Core, CoreStatus, HaltReason, rtt::ScanRegion}; use probe_rs_debug::VerifiedBreakpoint; use probe_rs_debug::{ - debug_info::DebugInfo, stack_frame::StackFrameInfo, ColumnType, ObjectRef, VariableCache, + ColumnType, ObjectRef, VariableCache, debug_info::DebugInfo, stack_frame::StackFrameInfo, }; use time::UtcOffset; use typed_path::TypedPath;
diff --git a/probe-rs-tools/src/bin/probe-rs/cmd/dap_server/server/debug_rtt.rs b/probe-rs-tools/src/bin/probe-rs/cmd/dap_server/server/debug_rtt.rs index 36a2e94..c010d2d 100644 --- a/probe-rs-tools/src/bin/probe-rs/cmd/dap_server/server/debug_rtt.rs +++ b/probe-rs-tools/src/bin/probe-rs/cmd/dap_server/server/debug_rtt.rs
@@ -1,13 +1,13 @@ -use crate::util::rtt::{client::RttClient, RttDataHandler}; +use crate::util::rtt::{RttDataHandler, client::RttClient}; use crate::{ cmd::dap_server::{ - debug_adapter::{dap::adapter::*, protocol::ProtocolAdapter}, DebuggerError, + debug_adapter::{dap::adapter::*, protocol::ProtocolAdapter}, }, util::rtt::RttDecoder, }; use anyhow::anyhow; -use probe_rs::{rtt, Core}; +use probe_rs::{Core, rtt}; /// Manage the active RTT target for a specific SessionData, as well as provide methods to reliably move RTT from target, through the debug_adapter, to the client. pub struct RttConnection {
diff --git a/probe-rs-tools/src/bin/probe-rs/cmd/dap_server/server/debugger.rs b/probe-rs-tools/src/bin/probe-rs/cmd/dap_server/server/debugger.rs index 0d56821..fca00ac 100644 --- a/probe-rs-tools/src/bin/probe-rs/cmd/dap_server/server/debugger.rs +++ b/probe-rs-tools/src/bin/probe-rs/cmd/dap_server/server/debugger.rs
@@ -2,13 +2,14 @@ configuration::{self, ConsoleLog}, logger::DebugLogger, session_data::SessionData, - startup::{get_file_timestamp, TargetSessionType}, + startup::{TargetSessionType, get_file_timestamp}, }; use crate::{ cmd::dap_server::{ + DebuggerError, debug_adapter::{ dap::{ - adapter::{get_arguments, DebugAdapter}, + adapter::{DebugAdapter, get_arguments}, dap_types::{ Capabilities, Event, ExitedEventBody, InitializeRequestArguments, MessageSeverity, Request, RttWindowOpenedArguments, TerminatedEventBody, @@ -18,17 +19,16 @@ protocol::ProtocolAdapter, }, peripherals::svd_variables::SvdCache, - DebuggerError, }, util::flash::build_loader, }; -use anyhow::{anyhow, Context}; +use anyhow::{Context, anyhow}; use probe_rs::{ + Architecture, CoreStatus, flashing::{ DownloadOptions, FileDownloadError, FlashProgress, ProgressEvent, ProgressOperation, }, probe::list::Lister, - Architecture, CoreStatus, }; use std::{ cell::RefCell, @@ -128,7 +128,9 @@ ); thread::sleep(Duration::from_millis(50)); // Small delay to reduce fast looping costs. } else { - tracing::trace!("Retrieving data from the core, no delay required between iterations of polling the core."); + tracing::trace!( + "Retrieving data from the core, no delay required between iterations of polling the core." + ); }; } @@ -473,7 +475,9 @@ }; let Some(path_to_elf) = target_core_config.program_binary.clone() else { - let error = DebuggerError::Other(anyhow!("Please specify use the `program-binary` option in `launch.json` to specify an executable")); + let error = DebuggerError::Other(anyhow!( + "Please specify use the `program-binary` option in `launch.json` to specify an executable" + )); debug_adapter.send_response::<()>(launch_attach_request, Err(&error))?; return Err(error); }; @@ -571,7 +575,9 @@ )) })?; let Some(path_to_elf) = target_core_config.program_binary.clone() else { - let err = DebuggerError::Other(anyhow!("Please specify use the `program-binary` option in `launch.json` to specify an executable")); + let err = DebuggerError::Other(anyhow!( + "Please specify use the `program-binary` option in `launch.json` to specify an executable" + )); debug_adapter.show_error_message(&err)?; return Err(err); @@ -778,7 +784,10 @@ debug_adapter = match Rc::try_unwrap(rc_debug_adapter) { Ok(debug_adapter) => debug_adapter.into_inner(), Err(too_many_strong_references) => { - let reference_error = DebuggerError::Other(anyhow!("Unexpected error while dereferencing the `debug_adapter` (It has {} strong references). Please report this as a bug.", Rc::strong_count(&too_many_strong_references))); + let reference_error = DebuggerError::Other(anyhow!( + "Unexpected error while dereferencing the `debug_adapter` (It has {} strong references). Please report this as a bug.", + Rc::strong_count(&too_many_strong_references) + )); tracing::error!("{reference_error:?}"); return Err(reference_error); } @@ -799,7 +808,10 @@ debug_adapter = match Rc::try_unwrap(rc_debug_adapter) { Ok(debug_adapter) => debug_adapter.into_inner(), Err(too_many_strong_references) => { - let reference_error = DebuggerError::Other(anyhow!("Unexpected error while dereferencing the `debug_adapter` (It has {} strong references). Please report this as a bug.", Rc::strong_count(&too_many_strong_references))); + let reference_error = DebuggerError::Other(anyhow!( + "Unexpected error while dereferencing the `debug_adapter` (It has {} strong references). Please report this as a bug.", + Rc::strong_count(&too_many_strong_references) + )); tracing::error!("{reference_error:?}"); return Err(reference_error); } @@ -968,6 +980,7 @@ #![allow(clippy::unwrap_used, clippy::panic)] use crate::cmd::dap_server::{ + DebuggerError, debug_adapter::{ dap::{ adapter::DebugAdapter, @@ -982,14 +995,13 @@ }, server::configuration::{ConsoleLog, CoreConfig, FlashingConfig, SessionConfig}, test::TestLister, - DebuggerError, }; use probe_rs::{ architecture::arm::FullyQualifiedApAddress, integration::{FakeProbe, Operation}, probe::{ - list::Lister, DebugProbe, DebugProbeError, DebugProbeInfo, DebugProbeSelector, - ProbeFactory, + DebugProbe, DebugProbeError, DebugProbeInfo, DebugProbeSelector, ProbeFactory, + list::Lister, }, }; use serde_json::json;
diff --git a/probe-rs-tools/src/bin/probe-rs/cmd/dap_server/server/logger.rs b/probe-rs-tools/src/bin/probe-rs/cmd/dap_server/server/logger.rs index b17f68d..1583483 100644 --- a/probe-rs-tools/src/bin/probe-rs/cmd/dap_server/server/logger.rs +++ b/probe-rs-tools/src/bin/probe-rs/cmd/dap_server/server/logger.rs
@@ -1,21 +1,21 @@ use crate::cmd::dap_server::{ - debug_adapter::{dap::adapter::DebugAdapter, protocol::ProtocolAdapter}, DebuggerError, + debug_adapter::{dap::adapter::DebugAdapter, protocol::ProtocolAdapter}, }; use parking_lot::{Mutex, MutexGuard}; use std::{ fs::File, - io::{stderr, Write}, + io::{Write, stderr}, path::Path, sync::Arc, }; use tracing::{level_filters::LevelFilter, subscriber::DefaultGuard}; use tracing_subscriber::{ - fmt::{format::FmtSpan, MakeWriter}, + EnvFilter, Layer, + fmt::{MakeWriter, format::FmtSpan}, prelude::__tracing_subscriber_SubscriberExt, util::SubscriberInitExt, - EnvFilter, Layer, }; /// DebugLogger manages the temporary file that is used to store the tracing messages that are generated during the DAP sessions.
diff --git a/probe-rs-tools/src/bin/probe-rs/cmd/dap_server/server/session_data.rs b/probe-rs-tools/src/bin/probe-rs/cmd/dap_server/server/session_data.rs index 8a67d31..11522a5 100644 --- a/probe-rs-tools/src/bin/probe-rs/cmd/dap_server/server/session_data.rs +++ b/probe-rs-tools/src/bin/probe-rs/cmd/dap_server/server/session_data.rs
@@ -4,18 +4,18 @@ }; use crate::{ cmd::dap_server::{ + DebuggerError, debug_adapter::{ dap::{adapter::DebugAdapter, dap_types::Source}, protocol::ProtocolAdapter, }, - DebuggerError, }, util::common_options::OperationError, }; -use anyhow::{anyhow, Result}; -use probe_rs::{config::TargetSelector, probe::list::Lister, CoreStatus, Session}; +use anyhow::{Result, anyhow}; +use probe_rs::{CoreStatus, Session, config::TargetSelector, probe::list::Lister}; use probe_rs_debug::{ - debug_info::DebugInfo, exception_handler_for_core, DebugRegisters, SourceLocation, + DebugRegisters, SourceLocation, debug_info::DebugInfo, exception_handler_for_core, }; use std::env::set_current_dir; use time::UtcOffset; @@ -111,7 +111,9 @@ // `CoreConfig` probe level initialization. if config.core_configs.len() != 1 { // TODO: For multi-core, allow > 1. - return Err(DebuggerError::Other(anyhow!("probe-rs-debugger requires that one, and only one, core be configured for debugging."))); + return Err(DebuggerError::Other(anyhow!( + "probe-rs-debugger requires that one, and only one, core be configured for debugging." + ))); } // Filter `CoreConfig` entries based on those that match an actual core on the target probe.
diff --git a/probe-rs-tools/src/bin/probe-rs/cmd/debug.rs b/probe-rs-tools/src/bin/probe-rs/cmd/debug.rs index 2bd26a1..118b24f 100644 --- a/probe-rs-tools/src/bin/probe-rs/cmd/debug.rs +++ b/probe-rs-tools/src/bin/probe-rs/cmd/debug.rs
@@ -4,25 +4,25 @@ use anyhow::anyhow; use capstone::{ - arch::arm::ArchMode as armArchMode, arch::arm64::ArchMode as aarch64ArchMode, - arch::riscv::ArchMode as riscvArchMode, prelude::*, Endian, + Endian, arch::arm::ArchMode as armArchMode, arch::arm64::ArchMode as aarch64ArchMode, + arch::riscv::ArchMode as riscvArchMode, prelude::*, }; use num_traits::Num; use parse_int::parse; -use probe_rs::architecture::arm::ap::AccessPortError; -use probe_rs::flashing::FileDownloadError; -use probe_rs::probe::list::Lister; -use probe_rs::probe::DebugProbeError; use probe_rs::CoreDump; use probe_rs::CoreDumpError; use probe_rs::CoreInterface; +use probe_rs::architecture::arm::ap::AccessPortError; +use probe_rs::flashing::FileDownloadError; +use probe_rs::probe::DebugProbeError; +use probe_rs::probe::list::Lister; use probe_rs::{Core, CoreType, InstructionSet, MemoryInterface, RegisterValue}; use probe_rs_debug::exception_handler_for_core; use probe_rs_debug::stack_frame::StackFrameInfo; use probe_rs_debug::{debug_info::DebugInfo, registers::DebugRegisters, stack_frame::StackFrame}; -use rustyline::{error::ReadlineError, DefaultEditor}; +use rustyline::{DefaultEditor, error::ReadlineError}; -use crate::{util::common_options::ProbeOptions, CoreOptions}; +use crate::{CoreOptions, util::common_options::ProbeOptions}; #[derive(clap::Parser)] pub struct Cmd {
diff --git a/probe-rs-tools/src/bin/probe-rs/cmd/download.rs b/probe-rs-tools/src/bin/probe-rs/cmd/download.rs index 29b57fa..8bea42a 100644 --- a/probe-rs-tools/src/bin/probe-rs/cmd/download.rs +++ b/probe-rs-tools/src/bin/probe-rs/cmd/download.rs
@@ -2,10 +2,10 @@ use crate::rpc::client::RpcClient; +use crate::FormatOptions; use crate::util::cli; use crate::util::common_options::BinaryDownloadOptions; use crate::util::common_options::ProbeOptions; -use crate::FormatOptions; #[derive(clap::Parser)] pub struct Cmd {
diff --git a/probe-rs-tools/src/bin/probe-rs/cmd/itm.rs b/probe-rs-tools/src/bin/probe-rs/cmd/itm.rs index 1d219da..386cb4a 100644 --- a/probe-rs-tools/src/bin/probe-rs/cmd/itm.rs +++ b/probe-rs-tools/src/bin/probe-rs/cmd/itm.rs
@@ -5,8 +5,8 @@ use probe_rs::architecture::arm::{component::TraceSink, swo::SwoConfig}; use probe_rs::probe::list::Lister; -use crate::util::common_options::ProbeOptions; use crate::CoreOptions; +use crate::util::common_options::ProbeOptions; #[derive(clap::Subcommand)] pub(crate) enum ItmSource {
diff --git a/probe-rs-tools/src/bin/probe-rs/cmd/profile.rs b/probe-rs-tools/src/bin/probe-rs/cmd/profile.rs index bbcb13e..c24cb2f 100644 --- a/probe-rs-tools/src/bin/probe-rs/cmd/profile.rs +++ b/probe-rs-tools/src/bin/probe-rs/cmd/profile.rs
@@ -8,10 +8,10 @@ use itm::TracePacket; use probe_rs::{ architecture::arm::{ - component::{find_component, Dwt, TraceSink}, + SwoConfig, + component::{Dwt, TraceSink, find_component}, dp::DpAddress, memory::PeripheralType, - SwoConfig, }, probe::list::Lister, };
diff --git a/probe-rs-tools/src/bin/probe-rs/cmd/read.rs b/probe-rs-tools/src/bin/probe-rs/cmd/read.rs index 414f9de..50c704f 100644 --- a/probe-rs-tools/src/bin/probe-rs/cmd/read.rs +++ b/probe-rs-tools/src/bin/probe-rs/cmd/read.rs
@@ -1,8 +1,8 @@ use crate::rpc::client::RpcClient; +use crate::CoreOptions; use crate::util::cli; use crate::util::common_options::{ProbeOptions, ReadWriteBitWidth, ReadWriteOptions}; -use crate::CoreOptions; /// Read from target memory address ///
diff --git a/probe-rs-tools/src/bin/probe-rs/cmd/reset.rs b/probe-rs-tools/src/bin/probe-rs/cmd/reset.rs index 699dbb3..0bf66ce 100644 --- a/probe-rs-tools/src/bin/probe-rs/cmd/reset.rs +++ b/probe-rs-tools/src/bin/probe-rs/cmd/reset.rs
@@ -1,7 +1,7 @@ use crate::{ + CoreOptions, rpc::client::RpcClient, util::{cli, common_options::ProbeOptions}, - CoreOptions, }; #[derive(clap::Parser)]
diff --git a/probe-rs-tools/src/bin/probe-rs/cmd/run.rs b/probe-rs-tools/src/bin/probe-rs/cmd/run.rs index a2dd206..f0501c4 100644 --- a/probe-rs-tools/src/bin/probe-rs/cmd/run.rs +++ b/probe-rs-tools/src/bin/probe-rs/cmd/run.rs
@@ -3,9 +3,9 @@ use crate::rpc::client::RpcClient; use crate::rpc::functions::monitor::{MonitorMode, MonitorOptions}; +use crate::FormatOptions; use crate::util::cli::{self, rtt_client}; use crate::util::common_options::{BinaryDownloadOptions, ProbeOptions}; -use crate::FormatOptions; use libtest_mimic::{Arguments, FormatSetting}; use probe_rs::flashing::FileDownloadError; @@ -277,7 +277,9 @@ || !cmd.test_options.filter.is_empty(); if test_args_specified { - anyhow::bail!("probe-rs was invoked with arguments exclusive to test mode, but the binary does not contain embedded-test"); + anyhow::bail!( + "probe-rs was invoked with arguments exclusive to test mode, but the binary does not contain embedded-test" + ); } tracing::debug!("No embedded-test in ELF file. Running as normal");
diff --git a/probe-rs-tools/src/bin/probe-rs/cmd/serve.rs b/probe-rs-tools/src/bin/probe-rs/cmd/serve.rs index 88a5d21..ac6a3a2 100644 --- a/probe-rs-tools/src/bin/probe-rs/cmd/serve.rs +++ b/probe-rs-tools/src/bin/probe-rs/cmd/serve.rs
@@ -4,16 +4,16 @@ //! client. The server also provides a status webpage that shows the available probes. use axum::{ + Router, extract::{ - ws::{self, WebSocket}, State, WebSocketUpgrade, + ws::{self, WebSocket}, }, http::HeaderValue, response::{Html, IntoResponse}, routing::{any, get}, - Router, }; -use base64::{engine::general_purpose::STANDARD, Engine}; +use base64::{Engine, engine::general_purpose::STANDARD}; use futures_util::{SinkExt, StreamExt}; use postcard_rpc::server::WireRxErrorKind; use probe_rs::probe::list::Lister; @@ -24,11 +24,11 @@ use std::{fmt::Write, sync::Arc}; use crate::{ + Config, rpc::{ functions::RpcApp, transport::websocket::{AxumWebsocketTx, WebsocketRx}, }, - Config, }; struct ServerState {
diff --git a/probe-rs-tools/src/bin/probe-rs/cmd/trace.rs b/probe-rs-tools/src/bin/probe-rs/cmd/trace.rs index c5462fb..29211e1 100644 --- a/probe-rs-tools/src/bin/probe-rs/cmd/trace.rs +++ b/probe-rs-tools/src/bin/probe-rs/cmd/trace.rs
@@ -3,12 +3,12 @@ use std::time::Duration; use std::time::Instant; -use probe_rs::probe::list::Lister; use probe_rs::MemoryInterface; -use scroll::{Pwrite, LE}; +use probe_rs::probe::list::Lister; +use scroll::{LE, Pwrite}; -use crate::util::{common_options::ProbeOptions, parse_u64}; use crate::CoreOptions; +use crate::util::{common_options::ProbeOptions, parse_u64}; #[derive(clap::Parser)] pub struct Cmd {
diff --git a/probe-rs-tools/src/bin/probe-rs/cmd/verify.rs b/probe-rs-tools/src/bin/probe-rs/cmd/verify.rs index d2cfd84..dd3af87 100644 --- a/probe-rs-tools/src/bin/probe-rs/cmd/verify.rs +++ b/probe-rs-tools/src/bin/probe-rs/cmd/verify.rs
@@ -1,11 +1,11 @@ use std::path::PathBuf; +use crate::FormatOptions; use crate::rpc::client::RpcClient; use crate::rpc::functions::flash::VerifyResult; use crate::util::cli; use crate::util::common_options::ProbeOptions; use crate::util::flash::CliProgressBars; -use crate::FormatOptions; #[derive(clap::Parser)] pub struct Cmd {
diff --git a/probe-rs-tools/src/bin/probe-rs/cmd/write.rs b/probe-rs-tools/src/bin/probe-rs/cmd/write.rs index 70a6b7f..f3ca8d2 100644 --- a/probe-rs-tools/src/bin/probe-rs/cmd/write.rs +++ b/probe-rs-tools/src/bin/probe-rs/cmd/write.rs
@@ -1,8 +1,8 @@ use crate::rpc::client::RpcClient; +use crate::CoreOptions; use crate::util::common_options::{ProbeOptions, ReadWriteBitWidth, ReadWriteOptions}; use crate::util::{cli, parse_u64}; -use crate::CoreOptions; /// Write to target memory address ///
diff --git a/probe-rs-tools/src/bin/probe-rs/main.rs b/probe-rs-tools/src/bin/probe-rs/main.rs index b53be6e..b1a89f0 100644 --- a/probe-rs-tools/src/bin/probe-rs/main.rs +++ b/probe-rs-tools/src/bin/probe-rs/main.rs
@@ -13,12 +13,12 @@ use anyhow::{Context, Result}; use clap::{ArgMatches, CommandFactory, FromArgMatches}; use colored::Colorize; +use figment::Figment; use figment::providers::{Data, Format as _, Json, Toml, Yaml}; use figment::value::Value; -use figment::Figment; use itertools::Itertools; use postcard_schema::Schema; -use probe_rs::{probe::list::Lister, Target}; +use probe_rs::{Target, probe::list::Lister}; use report::Report; use serde::{Deserialize, Serialize}; use time::{OffsetDateTime, UtcOffset}; @@ -570,7 +570,10 @@ if let Some(format_arg) = args.get(format_arg_pos + 1) { if let Some(format_arg) = format_arg.to_str() { if FormatKind::from_str(format_arg).is_ok() { - anyhow::bail!("--format has been renamed to --binary-format. Please use --binary-format {0} instead of --format {0}", format_arg); + anyhow::bail!( + "--format has been renamed to --binary-format. Please use --binary-format {0} instead of --format {0}", + format_arg + ); } } }
diff --git a/probe-rs-tools/src/bin/probe-rs/rpc/client.rs b/probe-rs-tools/src/bin/probe-rs/rpc/client.rs index e74dbb5..ee4e5b0 100644 --- a/probe-rs-tools/src/bin/probe-rs/rpc/client.rs +++ b/probe-rs-tools/src/bin/probe-rs/rpc/client.rs
@@ -8,13 +8,13 @@ use anyhow::Context as _; use postcard_rpc::{ + Topic, header::{VarSeq, VarSeqKind}, host_client::{HostClient, HostClientConfig, HostErr, IoClosed, Subscription}, - Topic, }; use postcard_schema::Schema; -use probe_rs::{flashing::FlashLoader, Session}; -use serde::{de::DeserializeOwned, Serialize}; +use probe_rs::{Session, flashing::FlashLoader}; +use serde::{Serialize, de::DeserializeOwned}; use tokio::sync::Mutex; use std::{ @@ -25,8 +25,19 @@ }; use crate::{ + FormatOptions, rpc::{ + Key, functions::{ + AttachEndpoint, BuildEndpoint, ChipInfoEndpoint, CreateRttClientEndpoint, + CreateTempFileEndpoint, EraseEndpoint, FlashEndpoint, ListChipFamiliesEndpoint, + ListProbesEndpoint, ListTestsEndpoint, LoadChipFamilyEndpoint, MonitorEndpoint, + MonitorTopic, ProgressEventTopic, ReadMemory8Endpoint, ReadMemory16Endpoint, + ReadMemory32Endpoint, ReadMemory64Endpoint, ResetCoreEndpoint, ResumeAllCoresEndpoint, + RpcResult, RunTestEndpoint, SelectProbeEndpoint, TakeStackTraceEndpoint, + TargetInfoDataTopic, TargetInfoEndpoint, TempFileDataEndpoint, TokioSpawner, + VerifyEndpoint, WriteMemory8Endpoint, WriteMemory16Endpoint, WriteMemory32Endpoint, + WriteMemory64Endpoint, chip::{ChipData, ChipFamily, ChipInfoRequest, LoadChipFamilyRequest}, file::{AppendFileRequest, TempFile}, flash::{ @@ -45,21 +56,10 @@ rtt_client::{CreateRttClientRequest, RttClientData, ScanRegion}, stack_trace::{StackTraces, TakeStackTraceRequest}, test::{ListTestsRequest, RunTestRequest, Test, TestResult, Tests}, - AttachEndpoint, BuildEndpoint, ChipInfoEndpoint, CreateRttClientEndpoint, - CreateTempFileEndpoint, EraseEndpoint, FlashEndpoint, ListChipFamiliesEndpoint, - ListProbesEndpoint, ListTestsEndpoint, LoadChipFamilyEndpoint, MonitorEndpoint, - MonitorTopic, ProgressEventTopic, ReadMemory16Endpoint, ReadMemory32Endpoint, - ReadMemory64Endpoint, ReadMemory8Endpoint, ResetCoreEndpoint, ResumeAllCoresEndpoint, - RpcResult, RunTestEndpoint, SelectProbeEndpoint, TakeStackTraceEndpoint, - TargetInfoDataTopic, TargetInfoEndpoint, TempFileDataEndpoint, TokioSpawner, - VerifyEndpoint, WriteMemory16Endpoint, WriteMemory32Endpoint, WriteMemory64Endpoint, - WriteMemory8Endpoint, }, transport::memory::{PostcardReceiver, PostcardSender, WireRx, WireTx}, - Key, }, - util::rtt::{client::RttClient, RttChannelConfig}, - FormatOptions, + util::rtt::{RttChannelConfig, client::RttClient}, }; #[cfg(feature = "remote")] @@ -141,10 +141,10 @@ #[cfg(feature = "remote")] mod tls { - use rustls::client::danger::HandshakeSignatureValid; - use rustls::crypto::{verify_tls12_signature, verify_tls13_signature, CryptoProvider}; - use rustls::pki_types::{CertificateDer, ServerName, UnixTime}; use rustls::DigitallySignedStruct; + use rustls::client::danger::HandshakeSignatureValid; + use rustls::crypto::{CryptoProvider, verify_tls12_signature, verify_tls13_signature}; + use rustls::pki_types::{CertificateDer, ServerName, UnixTime}; #[derive(Debug)] pub struct NoCertificateVerification(CryptoProvider);
diff --git a/probe-rs-tools/src/bin/probe-rs/rpc/functions.rs b/probe-rs-tools/src/bin/probe-rs/rpc/functions.rs index 9eeb097..e3d9b17 100644 --- a/probe-rs-tools/src/bin/probe-rs/rpc/functions.rs +++ b/probe-rs-tools/src/bin/probe-rs/rpc/functions.rs
@@ -2,38 +2,38 @@ use std::{convert::Infallible, future::Future}; use crate::rpc::functions::file::{ - append_temp_file, create_temp_file, AppendFileRequest, CreateFileResponse, + AppendFileRequest, CreateFileResponse, append_temp_file, create_temp_file, }; -use crate::rpc::functions::probe::{select_probe, SelectProbeRequest, SelectProbeResponse}; +use crate::rpc::functions::probe::{SelectProbeRequest, SelectProbeResponse, select_probe}; use crate::rpc::transport::memory::{WireRx, WireTx}; use crate::{ rpc::{ + Key, SessionState, functions::{ chip::{ - chip_info, list_families, load_chip_family, ChipInfoRequest, ChipInfoResponse, - ListFamiliesResponse, LoadChipFamilyRequest, + ChipInfoRequest, ChipInfoResponse, ListFamiliesResponse, LoadChipFamilyRequest, + chip_info, list_families, load_chip_family, }, flash::{ - build, erase, flash, verify, BuildRequest, BuildResponse, EraseRequest, - FlashRequest, ProgressEvent, VerifyRequest, VerifyResponse, + BuildRequest, BuildResponse, EraseRequest, FlashRequest, ProgressEvent, + VerifyRequest, VerifyResponse, build, erase, flash, verify, }, - info::{target_info, InfoEvent, TargetInfoRequest}, - memory::{read_memory, write_memory, ReadMemoryRequest, WriteMemoryRequest}, - monitor::{monitor, MonitorEvent, MonitorRequest}, + info::{InfoEvent, TargetInfoRequest, target_info}, + memory::{ReadMemoryRequest, WriteMemoryRequest, read_memory, write_memory}, + monitor::{MonitorEvent, MonitorRequest, monitor}, probe::{ - attach, list_probes, AttachRequest, AttachResponse, ListProbesRequest, - ListProbesResponse, + AttachRequest, AttachResponse, ListProbesRequest, ListProbesResponse, attach, + list_probes, }, - reset::{reset, ResetCoreRequest}, - resume::{resume_all_cores, ResumeAllCoresRequest}, - rtt_client::{create_rtt_client, CreateRttClientRequest, CreateRttClientResponse}, - stack_trace::{take_stack_trace, TakeStackTraceRequest, TakeStackTraceResponse}, + reset::{ResetCoreRequest, reset}, + resume::{ResumeAllCoresRequest, resume_all_cores}, + rtt_client::{CreateRttClientRequest, CreateRttClientResponse, create_rtt_client}, + stack_trace::{TakeStackTraceRequest, TakeStackTraceResponse, take_stack_trace}, test::{ - list_tests, run_test, ListTestsRequest, ListTestsResponse, RunTestRequest, - RunTestResponse, + ListTestsRequest, ListTestsResponse, RunTestRequest, RunTestResponse, list_tests, + run_test, }, }, - Key, SessionState, }, util::common_options::OperationError, }; @@ -43,11 +43,11 @@ use postcard_rpc::server::{ Dispatch, Sender as PostcardSender, Server, SpawnContext, WireRxErrorKind, WireTxErrorKind, }; -use postcard_rpc::{endpoints, host_client, server, topics, Topic, TopicDirection}; +use postcard_rpc::{Topic, TopicDirection, endpoints, host_client, server, topics}; use postcard_schema::Schema; -use probe_rs::{probe::list::Lister, Session}; +use probe_rs::{Session, probe::list::Lister}; use serde::{Deserialize, Serialize}; -use tokio::sync::mpsc::{channel, Receiver, Sender}; +use tokio::sync::mpsc::{Receiver, Sender, channel}; use tokio_util::sync::CancellationToken; pub mod chip;
diff --git a/probe-rs-tools/src/bin/probe-rs/rpc/functions/file.rs b/probe-rs-tools/src/bin/probe-rs/rpc/functions/file.rs index d10ce5a..88e9c07 100644 --- a/probe-rs-tools/src/bin/probe-rs/rpc/functions/file.rs +++ b/probe-rs-tools/src/bin/probe-rs/rpc/functions/file.rs
@@ -7,8 +7,8 @@ use serde::{Deserialize, Serialize}; use crate::rpc::{ - functions::{NoResponse, RpcContext, RpcResult}, Key, + functions::{NoResponse, RpcContext, RpcResult}, }; #[cfg(feature = "remote")]
diff --git a/probe-rs-tools/src/bin/probe-rs/rpc/functions/flash.rs b/probe-rs-tools/src/bin/probe-rs/rpc/functions/flash.rs index 7e5253a..7fe0e79 100644 --- a/probe-rs-tools/src/bin/probe-rs/rpc/functions/flash.rs +++ b/probe-rs-tools/src/bin/probe-rs/rpc/functions/flash.rs
@@ -1,20 +1,20 @@ use postcard_rpc::header::VarHeader; use postcard_schema::Schema; use probe_rs::{ + Session, flashing::{self, FileDownloadError, FlashLoader, FlashProgress}, rtt::ScanRegion, - Session, }; use serde::{Deserialize, Serialize}; use tokio::sync::mpsc::Sender; use crate::{ + FormatOptions, rpc::{ - functions::{NoResponse, ProgressEventTopic, RpcContext, RpcResult, RpcSpawnContext}, Key, + functions::{NoResponse, ProgressEventTopic, RpcContext, RpcResult, RpcSpawnContext}, }, util::{flash::build_loader, rtt::client::RttClient}, - FormatOptions, }; #[derive(Serialize, Deserialize, Default, Schema)]
diff --git a/probe-rs-tools/src/bin/probe-rs/rpc/functions/info.rs b/probe-rs-tools/src/bin/probe-rs/rpc/functions/info.rs index e7e3643..7f82f5c 100644 --- a/probe-rs-tools/src/bin/probe-rs/rpc/functions/info.rs +++ b/probe-rs-tools/src/bin/probe-rs/rpc/functions/info.rs
@@ -4,20 +4,19 @@ use anyhow::anyhow; use postcard_rpc::header::{VarHeader, VarSeq}; -use postcard_schema::{schema, Schema}; +use postcard_schema::{Schema, schema}; use probe_rs::{ architecture::{ arm::{ - self, + self, ApAddress, ApV2Address, ArmProbeInterface, ap::{ApClass, ApRegister, IDR}, component::Scs, - dp::{self, Ctrl, DpRegister, DLPIDR, DPIDR, TARGETID}, + dp::{self, Ctrl, DLPIDR, DPIDR, DpRegister, TARGETID}, memory::{ - romtable::{PeripheralID, RomTable}, ArmMemoryInterface, Component, ComponentId, CoresightComponent, PeripheralType, + romtable::{PeripheralID, RomTable}, }, sequences::DefaultArmSequence, - ApAddress, ApV2Address, ArmProbeInterface, }, riscv::communication_interface::RiscvCommunicationInterface, xtensa::communication_interface::{ @@ -30,9 +29,9 @@ use crate::{ rpc::functions::{ + NoResponse, RpcContext, TargetInfoDataTopic, chip::JEP106Code, probe::{DebugProbeEntry, WireProtocol}, - NoResponse, RpcContext, TargetInfoDataTopic, }, util::common_options::ProbeOptions, }; @@ -318,7 +317,9 @@ (probe_moved, Ok(dp_version)) => { probe = probe_moved; if dp_version < dp::DebugPortVersion::DPv2 && target_sel.is_none() { - let message = format!("Debug port version {dp_version} does not support SWD multidrop. Stopping here."); + let message = format!( + "Debug port version {dp_version} does not support SWD multidrop. Stopping here." + ); ctx.publish::<TargetInfoDataTopic>( VarSeq::Seq2(0), @@ -646,8 +647,7 @@ peripheral_id.part(), peripheral_id.dev_type(), peripheral_id.arch_id(), - peripheral_id.designer() - .unwrap_or("<unknown>"), + peripheral_id.designer().unwrap_or("<unknown>"), ) };
diff --git a/probe-rs-tools/src/bin/probe-rs/rpc/functions/memory.rs b/probe-rs-tools/src/bin/probe-rs/rpc/functions/memory.rs index 606f9eb..057b618 100644 --- a/probe-rs-tools/src/bin/probe-rs/rpc/functions/memory.rs +++ b/probe-rs-tools/src/bin/probe-rs/rpc/functions/memory.rs
@@ -1,6 +1,6 @@ use crate::rpc::{ - functions::{NoResponse, RpcContext, RpcResult}, Key, + functions::{NoResponse, RpcContext, RpcResult}, }; use postcard_rpc::header::VarHeader; use postcard_schema::Schema;
diff --git a/probe-rs-tools/src/bin/probe-rs/rpc/functions/monitor.rs b/probe-rs-tools/src/bin/probe-rs/rpc/functions/monitor.rs index 15a8f17..9aa08a3 100644 --- a/probe-rs-tools/src/bin/probe-rs/rpc/functions/monitor.rs +++ b/probe-rs-tools/src/bin/probe-rs/rpc/functions/monitor.rs
@@ -2,16 +2,16 @@ use crate::{ rpc::{ - functions::{flash::BootInfo, MonitorEndpoint, MonitorTopic, RpcSpawnContext, WireTxImpl}, - utils::run_loop::RunLoop, Key, + functions::{MonitorEndpoint, MonitorTopic, RpcSpawnContext, WireTxImpl, flash::BootInfo}, + utils::run_loop::RunLoop, }, util::rtt::client::RttClient, }; use anyhow::Context; use postcard_rpc::{header::VarHeader, server::Sender}; use postcard_schema::Schema; -use probe_rs::{semihosting::SemihostingCommand, BreakpointCause, Core, HaltReason, Session}; +use probe_rs::{BreakpointCause, Core, HaltReason, Session, semihosting::SemihostingCommand}; use serde::{Deserialize, Serialize}; use tokio::sync::mpsc; @@ -164,7 +164,9 @@ Ok(None) // Continue running } SemihostingCommand::GetCommandLine(_) => { - tracing::warn!("Target wanted to run semihosting operation SYS_GET_CMDLINE, but probe-rs does not support this operation yet. Continuing..."); + tracing::warn!( + "Target wanted to run semihosting operation SYS_GET_CMDLINE, but probe-rs does not support this operation yet. Continuing..." + ); Ok(None) // Continue running } SemihostingCommand::Errno(_) => Ok(None),
diff --git a/probe-rs-tools/src/bin/probe-rs/rpc/functions/probe.rs b/probe-rs-tools/src/bin/probe-rs/rpc/functions/probe.rs index 1c66e3b..7461f7f 100644 --- a/probe-rs-tools/src/bin/probe-rs/rpc/functions/probe.rs +++ b/probe-rs-tools/src/bin/probe-rs/rpc/functions/probe.rs
@@ -1,12 +1,12 @@ use postcard_rpc::header::VarHeader; use postcard_schema::Schema; -use probe_rs::{probe::DebugProbeInfo, Session}; +use probe_rs::{Session, probe::DebugProbeInfo}; use serde::{Deserialize, Serialize}; use crate::{ rpc::{ - functions::{RpcContext, RpcResult}, Key, + functions::{RpcContext, RpcResult}, }, util::common_options::{OperationError, ProbeOptions}, };
diff --git a/probe-rs-tools/src/bin/probe-rs/rpc/functions/reset.rs b/probe-rs-tools/src/bin/probe-rs/rpc/functions/reset.rs index 203cbdb..bd8dbf4 100644 --- a/probe-rs-tools/src/bin/probe-rs/rpc/functions/reset.rs +++ b/probe-rs-tools/src/bin/probe-rs/rpc/functions/reset.rs
@@ -1,6 +1,6 @@ use crate::rpc::{ - functions::{NoResponse, RpcContext}, Key, + functions::{NoResponse, RpcContext}, }; use postcard_rpc::header::VarHeader; use postcard_schema::Schema;
diff --git a/probe-rs-tools/src/bin/probe-rs/rpc/functions/resume.rs b/probe-rs-tools/src/bin/probe-rs/rpc/functions/resume.rs index 00a5541..4d4b01e 100644 --- a/probe-rs-tools/src/bin/probe-rs/rpc/functions/resume.rs +++ b/probe-rs-tools/src/bin/probe-rs/rpc/functions/resume.rs
@@ -1,6 +1,6 @@ use crate::rpc::{ - functions::{NoResponse, RpcContext}, Key, + functions::{NoResponse, RpcContext}, }; use postcard_rpc::header::VarHeader; use postcard_schema::Schema;
diff --git a/probe-rs-tools/src/bin/probe-rs/rpc/functions/rtt_client.rs b/probe-rs-tools/src/bin/probe-rs/rpc/functions/rtt_client.rs index e9ed3d9..7598552 100644 --- a/probe-rs-tools/src/bin/probe-rs/rpc/functions/rtt_client.rs +++ b/probe-rs-tools/src/bin/probe-rs/rpc/functions/rtt_client.rs
@@ -1,13 +1,13 @@ use crate::{ rpc::{ - functions::{RpcContext, RpcResult}, Key, + functions::{RpcContext, RpcResult}, }, - util::rtt::{client::RttClient, RttChannelConfig, RttConfig}, + util::rtt::{RttChannelConfig, RttConfig, client::RttClient}, }; use postcard_rpc::header::VarHeader; use postcard_schema::Schema; -use probe_rs::{rtt, Session}; +use probe_rs::{Session, rtt}; use serde::{Deserialize, Serialize}; /// Used to specify which memory regions to scan for the RTT control block.
diff --git a/probe-rs-tools/src/bin/probe-rs/rpc/functions/stack_trace.rs b/probe-rs-tools/src/bin/probe-rs/rpc/functions/stack_trace.rs index b8ab4f9..4fe741a 100644 --- a/probe-rs-tools/src/bin/probe-rs/rpc/functions/stack_trace.rs +++ b/probe-rs-tools/src/bin/probe-rs/rpc/functions/stack_trace.rs
@@ -1,13 +1,13 @@ use std::fmt::Write as _; use crate::rpc::{ - functions::{RpcContext, RpcResult}, Key, + functions::{RpcContext, RpcResult}, }; use postcard_rpc::header::VarHeader; use postcard_schema::Schema; use probe_rs::Session; -use probe_rs_debug::{exception_handler_for_core, DebugInfo, DebugRegisters}; +use probe_rs_debug::{DebugInfo, DebugRegisters, exception_handler_for_core}; use serde::{Deserialize, Serialize}; #[derive(Serialize, Deserialize, Schema)]
diff --git a/probe-rs-tools/src/bin/probe-rs/rpc/functions/test.rs b/probe-rs-tools/src/bin/probe-rs/rpc/functions/test.rs index 2e5a7c1..b7f5916 100644 --- a/probe-rs-tools/src/bin/probe-rs/rpc/functions/test.rs +++ b/probe-rs-tools/src/bin/probe-rs/rpc/functions/test.rs
@@ -3,20 +3,20 @@ use anyhow::Context; use postcard_rpc::{header::VarHeader, server::Sender}; use postcard_schema::Schema; -use probe_rs::{semihosting::SemihostingCommand, BreakpointCause, Core, HaltReason, Session}; +use probe_rs::{BreakpointCause, Core, HaltReason, Session, semihosting::SemihostingCommand}; use serde::{Deserialize, Serialize}; use tokio::sync::mpsc; use crate::{ rpc::{ + Key, functions::{ - flash::BootInfo, - monitor::{MonitorEvent, SemihostingOutput, SemihostingReader}, ListTestsEndpoint, MonitorTopic, RpcResult, RpcSpawnContext, RunTestEndpoint, WireTxImpl, + flash::BootInfo, + monitor::{MonitorEvent, SemihostingOutput, SemihostingReader}, }, utils::run_loop::{ReturnReason, RunLoop}, - Key, }, util::rtt::client::RttClient, }; @@ -376,7 +376,10 @@ HaltReason::Breakpoint(BreakpointCause::Semihosting(cmd)) => cmd, e => { // Exception occurred (e.g. hardfault) => Abort testing altogether - anyhow::bail!("The CPU halted unexpectedly: {:?}. Test should signal failure via a panic handler that calls `semihosting::proces::abort()` instead", e) + anyhow::bail!( + "The CPU halted unexpectedly: {:?}. Test should signal failure via a panic handler that calls `semihosting::proces::abort()` instead", + e + ) } };
diff --git a/probe-rs-tools/src/bin/probe-rs/rpc/mod.rs b/probe-rs-tools/src/bin/probe-rs/rpc/mod.rs index 067e44b..266e283 100644 --- a/probe-rs-tools/src/bin/probe-rs/rpc/mod.rs +++ b/probe-rs-tools/src/bin/probe-rs/rpc/mod.rs
@@ -4,14 +4,14 @@ marker::PhantomData, ops::DerefMut, sync::{ - atomic::{AtomicU64, Ordering}, Arc, + atomic::{AtomicU64, Ordering}, }, }; use postcard_schema::{ - schema::{DataModelType, NamedType, NamedValue}, Schema, + schema::{DataModelType, NamedType, NamedValue}, }; use probe_rs::Session; use serde::{Deserialize, Serialize};
diff --git a/probe-rs-tools/src/bin/probe-rs/rpc/transport/memory.rs b/probe-rs-tools/src/bin/probe-rs/rpc/transport/memory.rs index ce92787..14a8e48 100644 --- a/probe-rs-tools/src/bin/probe-rs/rpc/transport/memory.rs +++ b/probe-rs-tools/src/bin/probe-rs/rpc/transport/memory.rs
@@ -1,17 +1,17 @@ use std::{ future::Future, sync::{ - atomic::{AtomicUsize, Ordering}, Arc, + atomic::{AtomicUsize, Ordering}, }, }; use postcard_rpc::host_client; use postcard_rpc::{ + Topic, header::{VarHeader, VarKey, VarKeyKind, VarSeq}, server::{self, WireRxErrorKind, WireTxErrorKind}, standard_icd::LoggingTopic, - Topic, }; use serde::Serialize; use tokio::sync::mpsc::{Receiver, Sender};
diff --git a/probe-rs-tools/src/bin/probe-rs/rpc/utils/run_loop.rs b/probe-rs-tools/src/bin/probe-rs/rpc/utils/run_loop.rs index f68c636..d93df95 100644 --- a/probe-rs-tools/src/bin/probe-rs/rpc/utils/run_loop.rs +++ b/probe-rs-tools/src/bin/probe-rs/rpc/utils/run_loop.rs
@@ -3,7 +3,7 @@ use std::thread; use std::time::{Duration, Instant}; -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use probe_rs::{Core, Error, HaltReason, VectorCatchCondition}; use crate::util::rtt::client::RttClient;
diff --git a/probe-rs-tools/src/bin/probe-rs/util/cli.rs b/probe-rs-tools/src/bin/probe-rs/util/cli.rs index 5607cb1..c1d3e3c 100644 --- a/probe-rs-tools/src/bin/probe-rs/util/cli.rs +++ b/probe-rs-tools/src/bin/probe-rs/util/cli.rs
@@ -10,9 +10,12 @@ use tokio_util::sync::CancellationToken; use crate::{ + FormatOptions, rpc::{ + Key, client::{RpcClient, SessionInterface}, functions::{ + CancelTopic, flash::{BootInfo, DownloadOptions, FlashLayout, ProgressEvent, VerifyResult}, monitor::{MonitorEvent, MonitorMode, MonitorOptions, SemihostingOutput}, probe::{ @@ -21,20 +24,17 @@ rtt_client::ScanRegion, stack_trace::StackTrace, test::{Test, TestResult}, - CancelTopic, }, - Key, }, util::{ common_options::{BinaryDownloadOptions, ProbeOptions}, flash::CliProgressBars, logging, rtt::{ - self, client::RttClient, DataFormat, DefmtProcessor, DefmtState, RttChannelConfig, - RttDataHandler, RttDecoder, RttSymbolError, + self, DataFormat, DefmtProcessor, DefmtState, RttChannelConfig, RttDataHandler, + RttDecoder, RttSymbolError, client::RttClient, }, }, - FormatOptions, }; pub async fn attach_probe(
diff --git a/probe-rs-tools/src/bin/probe-rs/util/common_options.rs b/probe-rs-tools/src/bin/probe-rs/util/common_options.rs index cdfa8e6..8392097 100644 --- a/probe-rs-tools/src/bin/probe-rs/util/common_options.rs +++ b/probe-rs-tools/src/bin/probe-rs/util/common_options.rs
@@ -7,13 +7,13 @@ use super::cargo::ArtifactError; use crate::util::parse_u64; use probe_rs::{ + Permissions, Session, Target, config::{RegistryError, TargetSelector}, flashing::{FileDownloadError, FlashError}, integration::FakeProbe, probe::{ - list::Lister, DebugProbeError, DebugProbeInfo, DebugProbeSelector, Probe, WireProtocol, + DebugProbeError, DebugProbeInfo, DebugProbeSelector, Probe, WireProtocol, list::Lister, }, - Permissions, Session, Target, }; use serde::{Deserialize, Serialize};
diff --git a/probe-rs-tools/src/bin/probe-rs/util/flash.rs b/probe-rs-tools/src/bin/probe-rs/util/flash.rs index aea149c..9132ebf 100644 --- a/probe-rs-tools/src/bin/probe-rs/util/flash.rs +++ b/probe-rs-tools/src/bin/probe-rs/util/flash.rs
@@ -11,11 +11,11 @@ use colored::Colorize; use indicatif::{MultiProgress, ProgressBar, ProgressStyle}; use parking_lot::Mutex; -use probe_rs::flashing::{BinOptions, FlashProgress, Format, IdfOptions}; use probe_rs::InstructionSet; +use probe_rs::flashing::{BinOptions, FlashProgress, Format, IdfOptions}; use probe_rs::{ - flashing::{DownloadOptions, FileDownloadError, FlashLoader}, Session, + flashing::{DownloadOptions, FileDownloadError, FlashLoader}, }; /// Performs the flash download with the given loader. Ensure that the loader has the data to load already stored.
diff --git a/probe-rs-tools/src/bin/probe-rs/util/logging.rs b/probe-rs-tools/src/bin/probe-rs/util/logging.rs index 4e58eea..da4cad2 100644 --- a/probe-rs-tools/src/bin/probe-rs/util/logging.rs +++ b/probe-rs-tools/src/bin/probe-rs/util/logging.rs
@@ -4,7 +4,7 @@ use std::{fs::File, path::Path, sync::LazyLock}; use tracing_appender::non_blocking::WorkerGuard; use tracing_subscriber::{ - fmt::format::FmtSpan, layer::SubscriberExt, util::SubscriberInitExt, EnvFilter, Layer, + EnvFilter, Layer, fmt::format::FmtSpan, layer::SubscriberExt, util::SubscriberInitExt, }; /// Stores the progress bar for the logging facility.
diff --git a/probe-rs-tools/src/bin/probe-rs/util/rtt/client.rs b/probe-rs-tools/src/bin/probe-rs/util/rtt/client.rs index 8813bef..79df812 100644 --- a/probe-rs-tools/src/bin/probe-rs/util/rtt/client.rs +++ b/probe-rs-tools/src/bin/probe-rs/util/rtt/client.rs
@@ -1,7 +1,7 @@ use crate::util::rtt::{RttActiveDownChannel, RttActiveUpChannel, RttConfig, RttConnection}; use probe_rs::{ - rtt::{Error, Rtt, ScanRegion}, Core, MemoryInterface, + rtt::{Error, Rtt, ScanRegion}, }; pub struct RttClient {
diff --git a/probe-rs-tools/src/bin/probe-rs/util/rtt/processing.rs b/probe-rs-tools/src/bin/probe-rs/util/rtt/processing.rs index 458de08..b90e5df 100644 --- a/probe-rs-tools/src/bin/probe-rs/util/rtt/processing.rs +++ b/probe-rs-tools/src/bin/probe-rs/util/rtt/processing.rs
@@ -1,10 +1,10 @@ -use anyhow::{anyhow, Context}; +use anyhow::{Context, anyhow}; use defmt_decoder::{ - log::format::{Formatter, FormatterConfig, FormatterFormat}, DecodeError, StreamDecoder, + log::format::{Formatter, FormatterConfig, FormatterFormat}, }; use probe_rs::rtt::Error; -use time::{macros::format_description, OffsetDateTime, UtcOffset}; +use time::{OffsetDateTime, UtcOffset, macros::format_description}; use std::{ fmt::{self, Write}, @@ -150,7 +150,9 @@ .with_context(|| "Failed to parse defmt data")?; let locs = if !table.is_empty() && locs.is_empty() { - tracing::warn!("Insufficient DWARF info; compile your program with `debug = 2` to enable location info."); + tracing::warn!( + "Insufficient DWARF info; compile your program with `debug = 2` to enable location info." + ); None } else if table.indices().all(|idx| locs.contains_key(&(idx as u64))) { Some(locs)
diff --git a/probe-rs-tools/src/bin/probe-rs/util/visualizer.rs b/probe-rs-tools/src/bin/probe-rs/util/visualizer.rs index f6560ce..73a5ff2 100644 --- a/probe-rs-tools/src/bin/probe-rs/util/visualizer.rs +++ b/probe-rs-tools/src/bin/probe-rs/util/visualizer.rs
@@ -3,8 +3,8 @@ use std::path::Path; use svg::{ - node::element::{Group, Rectangle, Text}, Document, Node, + node::element::{Group, Rectangle, Text}, }; use crate::rpc::functions::flash::FlashLayout;