Skip to content

style(sight): make the crate rustfmt + clippy-clean#664

Closed
jfeng18 wants to merge 2 commits into
alibaba:mainfrom
jfeng18:chore/sight-lint
Closed

style(sight): make the crate rustfmt + clippy-clean#664
jfeng18 wants to merge 2 commits into
alibaba:mainfrom
jfeng18:chore/sight-lint

Conversation

@jfeng18

@jfeng18 jfeng18 commented May 30, 2026

Copy link
Copy Markdown
Contributor

Summary

Bring sight up to the repo's lint standard so it can pass cargo fmt --check and cargo 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:

  1. style: apply rustfmt to the whole crate — first-time cargo fmt (whitespace only).
  2. style: apply clippy autofixes — machine-applicable cargo clippy --fix (inlined format args, redundant closures, unnecessary casts, …).
  3. style: clear remaining clippy lints — manual fixes (strip_prefix, &PathBuf→&Path, struct-literal vs Default-reassign, test loops) + scoped allows for intentional patterns (FFI missing_safety_doc, probe 'static lifetime-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 warnings and cargo fmt --check both pass.

Follow-ups (not in this push)

  • A CI commit wiring fmt --check + clippy -D warnings into the test-agentsight job is ready but needs a workflow-scoped push; will be added before this leaves draft.
  • Separate PR: the cbindgen-generated FFI header (include/agentsight.h) is out of sync with src/ffi.rs (declares a removed add_domain_rule, omits add_https/add_http); the C example and an FFI build gate depend on fixing that.

Test plan

  • 439 unit tests pass, zero behavior change
  • cargo fmt --check clean; cargo clippy -- -D warnings passes (lib + bins + tests)

Generated with Claude Code


Update (lint)

Huffman fix split out to #670fix(sight): decode HPACK Huffman headers. This stack rebased onto the new chore/sight-polish (no Huffman); cargo fmt re-applied against the no-Huffman base, all rustfmt/clippy commits replayed. cargo fmt --check and cargo clippy -D warnings both pass.


Update (2026-06-02 conflict-fix rebase)

Rebased onto post-Huffman main (#670 merged). The frame.rs rustfmt conflict (predicted in CLAUDE.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 run cargo fmt once on the new base to produce a fresh rustfmt commit. While in rebase mode, also normalised every commit subject to ≤50 chars (the commit msg ≤50 rule mandates re-checking inherited subjects on amend).


Update (2026-06-02 clippy 1.89 fixes)

CI's Test agentsight job runs on rustc 1.89.0, which tightens
clippy::collapsible_if (turns if let X { if Y {} } into a hard error
under -D warnings). The previous push tripped 99 of these. Folded the
machine-applicable cargo clippy --fix output (25 files, mostly
collapsing nested if let/if blocks into && let chains) into the
existing clear remaining clippy lints commit so the stack remains 6
lint commits, no extra noise. Re-ran cargo +1.89.0 clippy -D warnings,
cargo +1.89.0 fmt --check, and cargo test --lib locally — all green.

@github-actions github-actions Bot added component:sight src/agentsight/ scope:documentation ./docs/|./*.md|./NOTICE labels May 30, 2026
@jfeng18 jfeng18 force-pushed the chore/sight-lint branch 9 times, most recently from cccaca3 to 8667191 Compare June 3, 2026 04:55
@jfeng18 jfeng18 marked this pull request as ready for review June 3, 2026 04:55
@jfeng18 jfeng18 requested a review from chengshuyi as a code owner June 3, 2026 04:55
@jfeng18 jfeng18 force-pushed the chore/sight-lint branch from 8667191 to fa62241 Compare June 3, 2026 11:24
@jfeng18

jfeng18 commented Jun 3, 2026

Copy link
Copy Markdown
Contributor Author

Hi — pure rustfmt + clippy -D warnings cleanup, predecessor #663 already merged. Rebased onto latest main (including #688 wildcard + #679 FFI delta), CI-verified with toolchain 1.89. Merging this unblocks the CI gate PR #668.

jfeng18 and others added 2 commits June 3, 2026 19:59
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@jfeng18 jfeng18 force-pushed the chore/sight-lint branch from fa62241 to 4031911 Compare June 3, 2026 12:09
@jfeng18

jfeng18 commented Jun 6, 2026

Copy link
Copy Markdown
Contributor Author

Superseded by #726 (sight-lint-v2) which covers all 102 files plus 6 additional. Closing to reduce duplication.

@jfeng18 jfeng18 closed this Jun 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component:sight src/agentsight/ scope:documentation ./docs/|./*.md|./NOTICE

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant