git-ents.gitmain
⌘K
foforge
commit 6af23f1
fix: resolve clippy and typos failures in CI

cargo clippy -D warnings rejected the server binary and integration test, and the typos hook misread the Fly.io 6PN term as a misspelling.

fix: avoid explicit counter loop and let-underscore-must-use in main fix: add reason to allow(missing_docs) in server integration test chore: add workspace clippy.toml enabling unwrap/panic in tests chore: ignore 6PN in typos config Assisted-by: Claude:claude-opus-4-8

Joseph D. Carpinelli · 2 months ago

Reviews

No reviews of this commit yet — record a verdict below.

Start a review

verdict

.config/typos.toml @@ -37,4 +37,5 @@ # Keep these empty to not ignore anything by default extend-ignore-identifiers-re = [] extend-ignore-words-re = [] -extend-ignore-re = [] +# Fly.io 6PN (private network) — a real term, not a typo +extend-ignore-re = ["6PN"]
crates/git-ents-server/src/main.rs @@ -8,7 +8,10 @@ use clap::{CommandFactory, Parser}; #[derive(Parser)] -#[command(name = "git-ents-server", about = "Helpful guardians of your git trees.")] +#[command( + name = "git-ents-server", + about = "Helpful guardians of your git trees." +)] struct Args { /// Generate man pages into the given directory. #[arg(long, value_name = "DIR")] @@ -43,15 +46,16 @@ } }; - let mut count = 0usize; - for stream in listener.incoming() { + for (count, stream) in listener.incoming().enumerate() { if let Ok(mut stream) = stream { let mut buf = [0u8; 4096]; - let _ = stream.read(&mut buf); - let _ = stream.write_all(b"HTTP/1.1 200 OK\r\nContent-Length: 0\r\n\r\n"); + let _read = stream.read(&mut buf); + let _write = stream.write_all(b"HTTP/1.1 200 OK\r\nContent-Length: 0\r\n\r\n"); } - count += 1; - if args.max_requests.is_some_and(|max| count >= max) { + if args + .max_requests + .is_some_and(|max| count.saturating_add(1) >= max) + { break; } }
crates/git-ents-server/tests/server.rs @@ -1,4 +1,4 @@ -#![allow(missing_docs)] +#![allow(missing_docs, reason = "integration test binary")] use std::io::{Read, Write}; use std::net::TcpStream; @@ -32,7 +32,10 @@ stream.write_all(b"GET / HTTP/1.0\r\n\r\n").unwrap(); let mut response = String::new(); stream.read_to_string(&mut response).unwrap(); - assert!(response.starts_with("HTTP/1.1 200 OK"), "unexpected response: {response}"); + assert!( + response.starts_with("HTTP/1.1 200 OK"), + "unexpected response: {response}" + ); } let status = child.wait().unwrap();
clippy.toml @@ -1,0 +1,5 @@ +allow-indexing-slicing-in-tests = true +allow-panic-in-tests = true +allow-unwrap-in-tests = true +allow-expect-in-tests = true +allow-dbg-in-tests = true