style(sight): make the crate rustfmt + clippy-clean#664
Closed
jfeng18 wants to merge 2 commits into
Closed
Conversation
This was referenced May 31, 2026
cccaca3 to
8667191
Compare
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
Author
|
Superseded by #726 (sight-lint-v2) which covers all 102 files plus 6 additional. Closing to reduce duplication. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Bring
sightup to the repo's lint standard so it can passcargo fmt --checkandcargo clippy -D warnings(which the PR template already expects, but CI never enforced for agentsight).Stacked on #663 (the polish PR); the bottom 4 commits are #663's and will drop out once it merges — review the top 3:
style: apply rustfmt to the whole crate— first-timecargo fmt(whitespace only).style: apply clippy autofixes— machine-applicablecargo clippy --fix(inlined format args, redundant closures, unnecessary casts, …).style: clear remaining clippy lints— manual fixes (strip_prefix, &PathBuf→&Path, struct-literal vs Default-reassign, test loops) + scoped allows for intentional patterns (FFImissing_safety_doc, probe'staticlifetime-laundering casts, and crate-level type_complexity / large_enum_variant / too_many_arguments / module_inception / should_implement_trait).After this,
cargo clippy --lib --bins --tests -- -D warningsandcargo fmt --checkboth pass.Follow-ups (not in this push)
fmt --check+clippy -D warningsinto thetest-agentsightjob is ready but needs aworkflow-scoped push; will be added before this leaves draft.include/agentsight.h) is out of sync withsrc/ffi.rs(declares a removedadd_domain_rule, omitsadd_https/add_http); the C example and an FFI build gate depend on fixing that.Test plan
cargo fmt --checkclean;cargo clippy -- -D warningspasses (lib + bins + tests)Generated with Claude Code
Update (lint)
Huffman fix split out to #670 —
fix(sight): decode HPACK Huffman headers. This stack rebased onto the newchore/sight-polish(no Huffman);cargo fmtre-applied against the no-Huffman base, all rustfmt/clippy commits replayed.cargo fmt --checkandcargo clippy -D warningsboth pass.Update (2026-06-02 conflict-fix rebase)
Rebased onto post-Huffman
main(#670 merged). Theframe.rsrustfmt conflict (predicted inCLAUDE.md's rebase note: rustfmt commit recreated against new base) was resolved by the canonical recipe — drop the original rustfmt commit, replay clippy commits, then runcargo fmtonce on the new base to produce a fresh rustfmt commit. While in rebase mode, also normalised every commit subject to ≤50 chars (thecommit msg ≤50rule mandates re-checking inherited subjects on amend).Update (2026-06-02 clippy 1.89 fixes)
CI's
Test agentsightjob runs on rustc 1.89.0, which tightensclippy::collapsible_if(turnsif let X { if Y {} }into a hard errorunder
-D warnings). The previous push tripped 99 of these. Folded themachine-applicable
cargo clippy --fixoutput (25 files, mostlycollapsing nested
if let/ifblocks into&& letchains) into theexisting
clear remaining clippy lintscommit so the stack remains 6lint commits, no extra noise. Re-ran
cargo +1.89.0 clippy -D warnings,cargo +1.89.0 fmt --check, andcargo test --liblocally — all green.