Fix inverted ifs
@@ -250,50 +250,55 @@ impl Probe {
/// Returns a probe specific memory interface if any is present for given probe.
pub fn dedicated_memory_interface(&self) -> Result<Option<Memory>, DebugProbeError> {
- if self.attached {
- return Err(DebugProbeError::NotAttached);
- }
+ if !self.attached {
+ Err(DebugProbeError::NotAttached)
+ } else {
Ok(self.inner.dedicated_memory_interface())
}
+ }
pub fn has_dap_interface(&self) -> bool {
self.inner.get_interface_dap().is_some()
}
pub fn get_interface_dap(&self) -> Result<Option<&dyn DAPAccess>, DebugProbeError> {
- if self.attached {
- return Err(DebugProbeError::NotAttached);
- }
+ if !self.attached {
+ Err(DebugProbeError::NotAttached)
+ } else {
Ok(self.inner.get_interface_dap())
}
+ }
pub fn get_interface_dap_mut(&mut self) -> Result<Option<&mut dyn DAPAccess>, DebugProbeError> {
- if self.attached {
- return Err(DebugProbeError::NotAttached);
- }
+ if !self.attached {
+ Err(DebugProbeError::NotAttached)
+ } else {
Ok(self.inner.get_interface_dap_mut())
}
+ }
pub fn has_jtag_interface(&self) -> bool {
self.inner.get_interface_jtag().is_some()
}
pub fn get_interface_jtag(&self) -> Result<Option<&dyn JTAGAccess>, DebugProbeError> {
- if self.attached {
- return Err(DebugProbeError::NotAttached);
- }
+ if !self.attached {
+ Err(DebugProbeError::NotAttached)
+ } else {
Ok(self.inner.get_interface_jtag())
}
+ }
pub fn get_interface_jtag_mut(
&mut self,
) -> Result<Option<&mut dyn JTAGAccess>, DebugProbeError> {
- if self.attached {
- return Err(DebugProbeError::NotAttached);
- }
+ if !self.attached {
+ Err(DebugProbeError::NotAttached)
+ } else {
Ok(self.inner.get_interface_jtag_mut())
}
}
+}
pub trait DebugProbe: Send + Sync + fmt::Debug {
fn new_from_probe_info(info: &DebugProbeInfo) -> Result<Box<Self>, DebugProbeError>
