Clear the clippy warnings, except the two that are not cosmetic

Down from 29 warnings to 2, in the spirit of 4ab95ff.

The doc warnings were all one mistake made repeatedly: a paragraph wrapped so
that a line *began* with `- ` or `+ `, which rustdoc reads as a markdown list
marker and the following lines as unindented continuations. The prose always
meant an em-dash. Fixed by moving the dash to the end of the previous line and
re-wrapping; not one word changed, which is the point - these comments record
things confirmed against real printers and are worth more than the warning.
The genuine lists just had their continuations de-indented and stayed lists.

The code ones are `match x { V(v) => .., _ => {} }` to `if let`, and nested
`if let Some(x) = .. { if cond { .. } }` to a let-chain. None had an `else`,
so each is the same control flow written once instead of twice.

Two warnings are left deliberately, because fixing them is not cosmetic:
`AmsTray` (544 bytes against 32) and `BambuReport` (984 against 120) both have
one variant far larger than the rest. The fix clippy wants is a `Box`, which
changes how every reader of those enums is written and puts an allocation on
the push_status path that currently has none. Worth measuring before doing,
not worth doing to silence a warning.

51 tests still pass.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
2026-10-15 21:43:06 +00:00
co-authored by Claude Opus 5
parent aa49cbba49
commit 6766ebbe80
11 changed files with 97 additions and 98 deletions
+25 -25
View File
@@ -10,20 +10,20 @@
//!
//! - `status` read-only. Connect, print state, list `cache/`.
//! - `probe-missing` **zero physical risk.** Sends `print.gcode_file`
//! pointing at a file that does not exist. The printer
//! cannot start anything, so this isolates one
//! question: does it accept and parse the command shape
//! at all? A clean rejection naming the file means the
//! shape is right and only the target was wrong. A
//! parse error, or silence, means the shape is wrong.
//! pointing at a file that does not exist. The printer
//! cannot start anything, so this isolates one
//! question: does it accept and parse the command shape
//! at all? A clean rejection naming the file means the
//! shape is right and only the target was wrong. A
//! parse error, or silence, means the shape is wrong.
//! - `start <file>` sends `print.gcode_file`/`print.project_file` for a
//! file in `cache/`. Gated on `gcode_state: IDLE` and
//! on the explicit flag.
//! file in `cache/`. Gated on `gcode_state: IDLE` and
//! on the explicit flag.
//! - `pause` / `resume` / `stop`
//! the control commands. `stop` cancels - it is the
//! undo for `start`, and the reason `start` is worth
//! testing at all: without it a cloud-initiated print
//! could only be ended at the machine.
//! the control commands. `stop` cancels - it is the
//! undo for `start`, and the reason `start` is worth
//! testing at all: without it a cloud-initiated print
//! could only be ended at the machine.
//!
//! After whatever it sends, it watches the `print.push_status` stream and
//! reports every change to the fields that matter. Run with
@@ -230,10 +230,10 @@ async fn main() -> anyhow::Result<()> {
async fn wait_for_state(bambu: &continuum_proxy::printer::BambuPrinter) -> anyhow::Result<String> {
let deadline = tokio::time::Instant::now() + STATUS_TIMEOUT;
loop {
if let Some(report) = bambu.print_status().await {
if let Some(state) = report.gcode_state.clone() {
return Ok(state);
}
if let Some(report) = bambu.print_status().await
&& let Some(state) = report.gcode_state.clone()
{
return Ok(state);
}
if tokio::time::Instant::now() >= deadline {
anyhow::bail!(
@@ -259,11 +259,11 @@ async fn watch(bambu: &continuum_proxy::printer::BambuPrinter, before: String) {
tokio::time::sleep(Duration::from_millis(1500)).await;
if let Some(report) = bambu.print_status().await {
if let Some(state) = report.gcode_state.clone() {
if state != last {
println!(" gcode_state: {last} -> {state}");
last = state;
}
if let Some(state) = report.gcode_state.clone()
&& state != last
{
println!(" gcode_state: {last} -> {state}");
last = state;
}
if report.print_error != last_error {
println!(" print_error: {:?} -> {:?}", last_error, report.print_error);
@@ -274,10 +274,10 @@ async fn watch(bambu: &continuum_proxy::printer::BambuPrinter, before: String) {
println!(" subtask_name: '{last_task}' -> '{task}'");
last_task = task;
}
if let Some(hms) = &report.hms {
if !hms.is_empty() {
println!(" hms (printer alerts): {}", serde_json::to_string(hms).unwrap_or_default());
}
if let Some(hms) = &report.hms
&& !hms.is_empty()
{
println!(" hms (printer alerts): {}", serde_json::to_string(hms).unwrap_or_default());
}
}
}