Skip to content

Commit

Permalink
refactor(test_runner): address the explicit_auto_deref clippy lint
Browse files Browse the repository at this point in the history
  • Loading branch information
yvt committed Aug 14, 2022
1 parent 3d64ddb commit d37a949
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/r3_test_runner/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#![feature(exhaustive_patterns)]
#![feature(generic_arg_infer)]
#![feature(must_not_suspend)] // `must_not_suspend` lint
#![feature(lint_reasons)]
#![feature(decl_macro)] // `macro`
#![feature(pin_macro)] // `core::pin::pin!`
#![feature(let_else)] // `let ... = ... else { ... }`
Expand Down
2 changes: 1 addition & 1 deletion src/r3_test_runner/src/selection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ fn all_test_runs(test_source: &TestSource) -> impl Iterator<Item = TestRun<'_>>
test_source
.driver_kernel_tests
.iter()
.map(|s| TestCase::DriverKernelTest(&**s)),
.map(|s| TestCase::DriverKernelTest(s)),
);

iproduct!(cases, &[false, true]).map(|(case, &cpu_lock_by_basepri)| TestRun {
Expand Down
6 changes: 5 additions & 1 deletion src/r3_test_runner/src/targets/kflash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,11 @@ impl DebugProbe for KflashDebugProbe {
let serial_m = Mutex::new(&mut self.serial);
let isp_boot_cmds = self.isp_boot_cmds;
retry_on_fail(|| async {
maix_enter_isp_mode(*serial_m.try_lock().unwrap(), isp_boot_cmds).await
// Holding the `LockGuard` across a suspend point is okay because
// `Mutex::lock` is never called for this mutex. (It's practically
// a thread-safe `RefCell`.)
#[allow(must_not_suspend)]
maix_enter_isp_mode(&mut serial_m.try_lock().unwrap(), isp_boot_cmds).await
})
.await
.map_err(RunError::Communication)?;
Expand Down
3 changes: 2 additions & 1 deletion src/r3_test_runner/src/targets/probe_rs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ impl DebugProbe for ProbeRsDebugProbe {
let exe2 = exe.clone();
let mut session = spawn_blocking(move || {
probe_rs::flashing::download_file(
&mut *session,
&mut session,
&exe2,
probe_rs::flashing::Format::Elf,
)?;
Expand Down Expand Up @@ -368,6 +368,7 @@ impl AsyncBufRead for ReadRtt {
let num_read_bytes = Self::read_inner(
&mut session,
&mut rtt,
#[expect(clippy::explicit_auto_deref)] // false positive
&mut *buf,
halt_on_access,
)?;
Expand Down

0 comments on commit d37a949

Please sign in to comment.