Skip to content

Commit 2759e38

Browse files
claudesinelaw
authored andcommitted
style(webui): satisfy rustfmt and clippy (fmt wrap + drop must-use results)
CI's fmt and clippy jobs were red on the previous commit: - rustfmt wanted the 403 `respond(...)` guard call wrapped across lines. - `#![deny(clippy::let_underscore_must_use)]` rejected `let _ =` on the must-use results of `serde_json::to_writer` (value_fingerprint) and `self.flush()` (ws close echo). Discard them with `drop(...)` instead — behaviourally identical, no `let _`. No functional change. fmt clean, `cargo clippy --all-features` errors gone, webui unit tests still 7/7. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LsqkqerfYQ4A48asmUxDQG
1 parent 0be35c2 commit 2759e38

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

  • crates/fresh-editor/src/webui

crates/fresh-editor/src/webui/mod.rs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -606,7 +606,12 @@ fn serve_request(
606606
if req.method == "POST" {
607607
if let Some(origin) = req.header("origin") {
608608
if !origin_host_matches(origin, req.header("host"), bind_host) {
609-
respond(&mut stream, "403 Forbidden", "text/plain", b"origin not allowed")?;
609+
respond(
610+
&mut stream,
611+
"403 Forbidden",
612+
"text/plain",
613+
b"origin not allowed",
614+
)?;
610615
return Ok(Served::Http { mutated: false });
611616
}
612617
}
@@ -1134,8 +1139,9 @@ fn value_fingerprint(v: &Value) -> u64 {
11341139
}
11351140
}
11361141
let mut hw = HashWriter(std::collections::hash_map::DefaultHasher::new());
1137-
// Writing to a hasher never fails, and Value serialization is infallible.
1138-
let _ = serde_json::to_writer(&mut hw, v);
1142+
// Writing to a hasher never fails, and Value serialization is infallible —
1143+
// `drop` the (always-Ok) result without a `let _` (denied for must-use).
1144+
drop(serde_json::to_writer(&mut hw, v));
11391145
hw.0.finish()
11401146
}
11411147

@@ -1321,7 +1327,7 @@ impl WsSession {
13211327
// gone, and we're dropping the client either way) and
13221328
// report the disconnect.
13231329
self.enqueue(0x8, &frame.payload);
1324-
let _ = self.flush();
1330+
drop(self.flush());
13251331
return Err(std::io::Error::new(
13261332
ErrorKind::ConnectionAborted,
13271333
"client sent close",

0 commit comments

Comments
 (0)