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:
+16
-16
@@ -162,14 +162,14 @@ impl PrintStatusCache {
|
||||
// the next one that did looked like it had skipped ahead. That is now
|
||||
// reported where it happens (see `handle_incoming_report`), which
|
||||
// leaves this warning meaning what it says.
|
||||
if let (Some(last), Some(incoming_seq), false) = (self.last_sequence_id, incoming_seq, is_full_object) {
|
||||
if incoming_seq != last.wrapping_add(1) {
|
||||
eprintln!(
|
||||
"print.push_status sequence gap: expected {}, got {incoming_seq} - the in-memory \
|
||||
object may be missing whatever changed in between",
|
||||
last.wrapping_add(1)
|
||||
);
|
||||
}
|
||||
if let (Some(last), Some(incoming_seq), false) = (self.last_sequence_id, incoming_seq, is_full_object)
|
||||
&& incoming_seq != last.wrapping_add(1)
|
||||
{
|
||||
eprintln!(
|
||||
"print.push_status sequence gap: expected {}, got {incoming_seq} - the in-memory \
|
||||
object may be missing whatever changed in between",
|
||||
last.wrapping_add(1)
|
||||
);
|
||||
}
|
||||
if let Some(incoming_seq) = incoming_seq {
|
||||
self.last_sequence_id = Some(incoming_seq);
|
||||
@@ -305,17 +305,17 @@ impl BambuMqttSession {
|
||||
/// whose `sequence_id` matches the one this call sent.
|
||||
///
|
||||
/// This crate tried adding its own correlation field
|
||||
/// (`continuum_correlation_id`) instead of relying on `sequence_id`,
|
||||
/// on the understanding that extra fields survive into most replies.
|
||||
/// Confirmed live that this doesn't hold for `get_version` specifically
|
||||
/// - a real H2C's reply had exactly `["command", "module",
|
||||
/// (`continuum_correlation_id`) instead of relying on `sequence_id`, on
|
||||
/// the understanding that extra fields survive into most replies.
|
||||
/// Confirmed live that this doesn't hold for `get_version`
|
||||
/// specifically - a real H2C's reply had exactly `["command", "module",
|
||||
/// "sequence_id"]`, nothing extra at all, so the correlation field
|
||||
/// never came back and every `get_version` call just timed out.
|
||||
/// `sequence_id` is what's actually proven to round-trip for it
|
||||
/// (confirmed earlier, live, on both protocol versions), so that's
|
||||
/// what this uses. Whether a custom field survives on some *other*
|
||||
/// command (`calibration`, say) is unverified, not confirmed false -
|
||||
/// this was only ever checked for `get_version`.
|
||||
/// (confirmed earlier, live, on both protocol versions), so that's what
|
||||
/// this uses. Whether a custom field survives on some *other* command
|
||||
/// (`calibration`, say) is unverified, not confirmed false - this was
|
||||
/// only ever checked for `get_version`.
|
||||
///
|
||||
/// Not for `print.push_status` - that's not a single reply, see
|
||||
/// `PrintStatusCache`. Not for a command with no reply at all either,
|
||||
|
||||
Reference in New Issue
Block a user