Skip to content

Commit

Permalink
Merge branch '🚨-clippy' into 🦆
Browse files Browse the repository at this point in the history
  • Loading branch information
yvt committed Jan 13, 2023
2 parents 8ace157 + 52660a6 commit 1e93844
Show file tree
Hide file tree
Showing 9 changed files with 14 additions and 23 deletions.
3 changes: 1 addition & 2 deletions src/r3_core/src/bind/sorter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -587,15 +587,14 @@ trait TopologicalSortOutputSink<VertexRef> {
/// ¹ Kahn, Arthur B. (1962), "Topological sorting of large networks",
/// *Communications of the ACM*, **5** (11): 558–562, doi:10.1145/368996.369025
const fn topological_sort<
'a,
Graph,
VertexRef,
VertexRefLessThan,
ReadyVertexQueue,
VertexInfoMap,
OutputSink,
>(
graph: &'a Graph,
graph: &Graph,
vertex_ord_lt: &mut VertexRefLessThan,
out_vertices: &mut OutputSink,
temp_ready_vertex_queue: &mut ReadyVertexQueue,
Expand Down
5 changes: 2 additions & 3 deletions src/r3_port_riscv_test_driver/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,13 @@ fn main() {
generated_code,
r#"
instantiate_test!({{
path: crate::driver_kernel_tests::{0},
path: crate::driver_kernel_tests::{name},
}},);
"#,
name,
)
.unwrap();
} else if !selected_test.is_empty() {
panic!("unknown test type: {:?}", selected_test);
panic!("unknown test type: {selected_test:?}");
}

let out_generated_code_path = Path::new(&out_dir).join("gen.rs");
Expand Down
4 changes: 2 additions & 2 deletions src/r3_port_std/src/threading_unix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,8 @@ fn park_inner(data: &ThreadData) {
// Interrupted while waiting. Try again.
continue;
}
Ok(i) => panic!("unexpected return value: {}", i),
Err(e) => panic!("failed to evict park token: {}", e),
Ok(i) => panic!("unexpected return value: {i}"),
Err(e) => panic!("failed to evict park token: {e}"),
}

break;
Expand Down
7 changes: 2 additions & 5 deletions src/r3_port_std/src/ums/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,7 @@ fn preempt() {
.zip(new_counters.iter())
.enumerate()
.all(|(i, (old, new))| (thread_i == i) == (old != new)),
"old_counters = {:?}, new_counters = {:?}",
old_counters,
new_counters,
"old_counters = {old_counters:?}, new_counters = {new_counters:?}",
);
};

Expand Down Expand Up @@ -226,8 +224,7 @@ fn yield_ring(count: usize) {

assert!(
new_counters.iter().all(|&c| c != 0),
"new_counters = {:?}",
new_counters,
"new_counters = {new_counters:?}",
);

st.done.store(true, Ordering::Relaxed);
Expand Down
4 changes: 2 additions & 2 deletions src/r3_support_rza1/src/gpio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ unsafe fn clear_bit16(reg: *mut u16, bit: u8) {

#[inline]
fn panic_if_pin_is_invalid((n, m): Pin) {
assert!(n >= 1 && n < 12, "1 <= {} < 12", n);
assert!(m < 16, "0 <= {} < 16", m);
assert!((1..12).contains(&n), "1 <= {n} < 12");
assert!(m < 16, "0 <= {m} < 16");
}

impl GpioExt for rza1::gpio::RegisterBlock {
Expand Down
2 changes: 1 addition & 1 deletion src/r3_test_runner/src/targets/jlink.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ impl DebugProbe for Fe310JLinkDebugProbe {
for (path, (_, offset)) in section_files.iter().zip(regions.iter()) {
writeln!(cmd, "loadbin \"{}\" 0x{:08x}", path.display(), offset).unwrap();
}
writeln!(cmd, "setpc 0x{:x}", entry).unwrap();
writeln!(cmd, "setpc 0x{entry:x}").unwrap();
writeln!(cmd, "g").unwrap();
writeln!(cmd, "q").unwrap();

Expand Down
6 changes: 2 additions & 4 deletions src/r3_test_suite/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,8 @@ fn main() {
kernel_benchmark_list.push(TestMeta("kernel_benchmarks", name));
} else {
panic!(
"Unrecognized test type: `{}`
"Unrecognized test type: `{selected_test}`
Test names should start with a prefix like `kernel_tests::`.",
selected_test
);
}
}
Expand Down Expand Up @@ -84,9 +83,8 @@ fn main() {
fn expect_valid_test_name(name: &str) {
if name.contains(|c: char| !c.is_alphanumeric() && c != '_') || name.is_empty() {
panic!(
"Invalid test name: `{}`
"Invalid test name: `{name}`
Test names should match /[a-zA-Z0-9_]+/",
name
)
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/r3_test_suite/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ impl SeqTracker {
// Note: Some targets don't support CAS atomics
let got = self.counter.load(Ordering::Relaxed);
log::debug!("{} (expected: {}) → {}", got, old, new);
assert_eq!(got, old, "expected {}, got {}", old, got);
assert_eq!(got, old, "expected {old}, got {got}");
self.counter.store(new, Ordering::Relaxed);
}
}
4 changes: 1 addition & 3 deletions src/r3_test_suite/src/utils/conditional.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,7 @@ pub trait KernelTimeExt: traits::KernelBase {
log::trace!("time = {:?}ms (expected = {:?}ms)", t, range);
assert!(
range.contains(&t),
"time = {:?}ms (expected = {:?}ms)",
t,
range
"time = {t:?}ms (expected = {range:?}ms)"
);
}

Expand Down

0 comments on commit 1e93844

Please sign in to comment.