Skip to content

Commit 16da4c6

Browse files
committed
[tx2-web] Fix some new clippy warnings (following rustup update).
1 parent ad08ccd commit 16da4c6

File tree

4 files changed

+8
-10
lines changed

4 files changed

+8
-10
lines changed

tx2-web/rust/src/io.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ pub fn get_builtin_sample_tape(sample_name: &str) -> Result<Vec<u8>, String> {
211211
match sample_name {
212212
"echo" => Ok(sample_binary_echo()),
213213
"hello" => Ok(sample_binary_hello()),
214-
_ => Err(format!("unknown sample file '{}'", sample_name)),
214+
_ => Err(format!("unknown sample file '{sample_name}'")),
215215
}
216216
.map(|data| data.to_vec())
217217
}
@@ -258,7 +258,7 @@ pub fn tx2_device_statuses(
258258
let context = make_context(simulated_system_time_secs, elapsed_time_secs);
259259
match tx2.sequence_statuses(&context) {
260260
Err(e) => {
261-
panic!("tx2_device_statuses: failed: {}", e);
261+
panic!("tx2_device_statuses: failed: {e}");
262262
}
263263
Ok(statuses) => statuses
264264
.into_iter()

tx2-web/rust/src/io/keyboard.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -304,8 +304,7 @@ fn hit_detection_colour_does_not_map_to_a_key_code() {
304304
return;
305305
}
306306
panic!(
307-
"Colour {} should map to 'no key' (that is, {:?}) but it actually mapped to {:?}",
308-
HIT_DETECTION_BACKGROUND, expected, got
307+
"Colour {HIT_DETECTION_BACKGROUND} should map to 'no key' (that is, {expected:?}) but it actually mapped to {got:?}",
309308
);
310309
}
311310

@@ -1922,8 +1921,7 @@ fn codes_used_in_both_near_and_far_keyboards() {
19221921
let expected_count: usize = if once_keys.contains(code) { 1 } else { 2 };
19231922
if *actual_count != expected_count {
19241923
panic!(
1925-
"expected to see code code {:o} with frequency of {} but got frequency of {}",
1926-
code, expected_count, actual_count
1924+
"expected to see code code {code:o} with frequency of {expected_count} but got frequency of {actual_count}",
19271925
);
19281926
}
19291927
}
@@ -1947,7 +1945,7 @@ fn all_input_codes_used() {
19471945
}
19481946
n => {
19491947
if !key_code_counts.contains_key(&n) {
1950-
panic!("No key generates code {:o}", n);
1948+
panic!("No key generates code {n:o}");
19511949
}
19521950
}
19531951
}

tx2-web/rust/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ pub fn tx2_codabo(tx2: &mut Tx2, simulated_time: f64, elapsed_time_secs: f64) {
125125
event!(Level::INFO, "codabo");
126126
let context = make_context(simulated_time, elapsed_time_secs);
127127
if let Err(e) = tx2.codabo(&context, &ResetMode::ResetTSP) {
128-
panic!("codabo failed: {}", e);
128+
panic!("codabo failed: {e}");
129129
}
130130
tx2.set_next_execution_due(context.simulated_time, Some(context.simulated_time));
131131
tx2.set_run_mode(RunMode::Running);

tx2-web/rust/src/lw.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ pub(crate) fn display_lw_unit_output_event(unit: Unsigned6Bit, ch: DescribedChar
2626
Level::INFO,
2727
"display_lw_unit_output_event: handling output event for LW unit {unit:?}"
2828
);
29-
let current_line_element_id = format!("lw{:o}-current-line", unit);
29+
let current_line_element_id = format!("lw{unit:o}-current-line");
3030
let current_line_el = doc
3131
.get_element_by_id(&current_line_element_id)
3232
.expect("LW current line element is missing from HTML document");
@@ -37,7 +37,7 @@ pub(crate) fn display_lw_unit_output_event(unit: Unsigned6Bit, ch: DescribedChar
3737
..
3838
} => {
3939
event!(Level::INFO, "LW: processing a carriage return");
40-
let history_element_id = format!("lw{:o}-history", unit);
40+
let history_element_id = format!("lw{unit:o}-history");
4141
let history_el = doc
4242
.get_element_by_id(&history_element_id)
4343
.expect("LW history element is missing from HTML document");

0 commit comments

Comments
 (0)