Skip to content

Commit ffe291c

Browse files
committed
fix: resolve 5 clippy warnings (unused imports, method naming, dead code)
- chess/fingerprint.rs: remove unused VsaOps import - qualia/felt_parse.rs: rename from_str to parse (avoid std trait confusion) - qualia/agent_state.rs: rename from_str to parse (same reason) - bin/server.rs: fix unused assignment + collapsible if https://claude.ai/code/session_01PJXVVtCXFi2BvJMrM8gmwE
1 parent 3079c3c commit ffe291c

4 files changed

Lines changed: 18 additions & 20 deletions

File tree

src/bin/server.rs

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3228,8 +3228,6 @@ fn parse_url(url: &str) -> Result<(String, u16, String), String> {
32283228
/// Read an HTTP response body (skip headers, read body).
32293229
fn read_http_response(stream: &mut TcpStream) -> Result<String, String> {
32303230
let mut reader = BufReader::new(stream.try_clone().map_err(|e| e.to_string())?);
3231-
let mut response = String::new();
3232-
32333231
// Read status line
32343232
let mut status_line = String::new();
32353233
reader
@@ -3244,24 +3242,24 @@ fn read_http_response(stream: &mut TcpStream) -> Result<String, String> {
32443242
if line.trim().is_empty() {
32453243
break;
32463244
}
3247-
if let Some((key, val)) = line.split_once(':') {
3248-
if key.trim().eq_ignore_ascii_case("content-length") {
3249-
content_length = val.trim().parse().unwrap_or(0);
3250-
}
3245+
if let Some((key, val)) = line.split_once(':')
3246+
&& key.trim().eq_ignore_ascii_case("content-length")
3247+
{
3248+
content_length = val.trim().parse().unwrap_or(0);
32513249
}
32523250
}
32533251

32543252
// Read body
3255-
if content_length > 0 {
3253+
let response = if content_length > 0 {
32563254
let mut body = vec![0u8; content_length];
32573255
std::io::Read::read_exact(&mut reader, &mut body).map_err(|e| e.to_string())?;
3258-
response = String::from_utf8_lossy(&body).to_string();
3256+
String::from_utf8_lossy(&body).to_string()
32593257
} else {
32603258
// Read until connection closes (chunked or unknown length)
32613259
let mut buf = String::new();
32623260
let _ = std::io::Read::read_to_string(&mut reader, &mut buf);
3263-
response = buf;
3264-
}
3261+
buf
3262+
};
32653263

32663264
Ok(response)
32673265
}

src/chess/fingerprint.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
//! ⊕ BIND(phase, ADDR_PHASE)
2020
//! ```
2121
22-
use crate::core::{DIM_U64, Fingerprint, VsaOps};
22+
use crate::core::{DIM_U64, Fingerprint};
2323
use super::position::{ChessPosition, Color, GamePhase, PieceType};
2424

2525
/// Bit ranges for each section of the fingerprint.

src/qualia/agent_state.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ impl Default for PresenceMode {
8989

9090
impl PresenceMode {
9191
/// Parse from string (e.g., from ada-rs PresenceMode)
92-
pub fn from_str(s: &str) -> Self {
92+
pub fn parse(s: &str) -> Self {
9393
match s.to_lowercase().as_str() {
9494
"wife" | "intimate" => PresenceMode::Wife,
9595
"work" | "focus" | "professional" => PresenceMode::Work,
@@ -923,12 +923,12 @@ mod tests {
923923

924924
#[test]
925925
fn test_presence_mode_parse() {
926-
assert_eq!(PresenceMode::from_str("wife"), PresenceMode::Wife);
927-
assert_eq!(PresenceMode::from_str("intimate"), PresenceMode::Wife);
928-
assert_eq!(PresenceMode::from_str("work"), PresenceMode::Work);
929-
assert_eq!(PresenceMode::from_str("agi"), PresenceMode::Agi);
930-
assert_eq!(PresenceMode::from_str("hybrid"), PresenceMode::Hybrid);
931-
assert_eq!(PresenceMode::from_str("unknown"), PresenceMode::Neutral);
926+
assert_eq!(PresenceMode::parse("wife"), PresenceMode::Wife);
927+
assert_eq!(PresenceMode::parse("intimate"), PresenceMode::Wife);
928+
assert_eq!(PresenceMode::parse("work"), PresenceMode::Work);
929+
assert_eq!(PresenceMode::parse("agi"), PresenceMode::Agi);
930+
assert_eq!(PresenceMode::parse("hybrid"), PresenceMode::Hybrid);
931+
assert_eq!(PresenceMode::parse("unknown"), PresenceMode::Neutral);
932932
}
933933

934934
// ─── CoreAxes ───

src/qualia/felt_parse.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ impl GhostType {
109109
}
110110

111111
/// Parse from string (case-insensitive).
112-
pub fn from_str(s: &str) -> Option<Self> {
112+
pub fn parse(s: &str) -> Option<Self> {
113113
match s.to_lowercase().as_str() {
114114
"love" => Some(GhostType::Love),
115115
"epiphany" => Some(GhostType::Epiphany),
@@ -1149,7 +1149,7 @@ mod tests {
11491149
fn test_ghost_type_roundtrip() {
11501150
for ghost_type in &GhostType::ALL {
11511151
let s = ghost_type.as_str();
1152-
let parsed = GhostType::from_str(s).unwrap();
1152+
let parsed = GhostType::parse(s).unwrap();
11531153
assert_eq!(*ghost_type, parsed, "roundtrip failed for {}", s);
11541154
}
11551155
}

0 commit comments

Comments
 (0)