Skip to content

[codex] Tighten Clippy lint policy#98

Merged
vansour merged 4 commits into
mainfrom
codex/clippy-strict-lints
May 17, 2026
Merged

[codex] Tighten Clippy lint policy#98
vansour merged 4 commits into
mainfrom
codex/clippy-strict-lints

Conversation

@vansour
Copy link
Copy Markdown
Owner

@vansour vansour commented May 17, 2026

Summary

  • add a workspace-level Cargo lint policy for clippy::pedantic and selected high-signal clippy::restriction lints
  • opt every workspace crate into the shared lint policy with [lints] workspace = true
  • carry the strict Clippy cleanup and explicit audit baselines across the workspace so the lint gate stays reproducible

Validation

  • cargo clippy --workspace --all-targets --all-features --locked -- -D warnings
  • cargo clippy --workspace --all-targets --all-features --locked -- -D warnings -W clippy::restriction
  • cargo clippy --workspace --all-targets --all-features --locked -- -W clippy::restriction
  • ./scripts/run-clippy-gate.sh
  • cargo check --workspace --all-features --locked
  • cargo test --workspace --all-features --locked --lib
  • cargo fmt --all --check
  • git diff --check

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 17, 2026

Important

Review skipped

Too many files!

This PR contains 300 files, which is 150 over the limit of 150.

To get a review, narrow the scope:
• coderabbit review --type committed # exclude uncommitted changes
• coderabbit review --dir # limit to a subdirectory
• coderabbit review --base # compare against a closer base

⚙️ Run configuration

Configuration used: Repository UI (base), Organization UI (inherited)

Review profile: ASSERTIVE

Plan: Pro

Run ID: e986e9a5-185f-4417-87c2-881a9cd4c226

📥 Commits

Reviewing files that changed from the base of the PR and between ee0d43e and 36b53f6.

📒 Files selected for processing (300)
  • Cargo.toml
  • clippy.toml
  • crates/rginx-agent/Cargo.toml
  • crates/rginx-agent/src/agent_core.rs
  • crates/rginx-agent/src/agent_core/command.rs
  • crates/rginx-agent/src/audit.rs
  • crates/rginx-agent/src/auth.rs
  • crates/rginx-agent/src/auth/keyring.rs
  • crates/rginx-agent/src/circuit_breaker.rs
  • crates/rginx-agent/src/config_history.rs
  • crates/rginx-agent/src/config_history/diff.rs
  • crates/rginx-agent/src/config_validator.rs
  • crates/rginx-agent/src/control_center/model.rs
  • crates/rginx-agent/src/control_center/query.rs
  • crates/rginx-agent/src/control_center/rollout.rs
  • crates/rginx-agent/src/control_center/store.rs
  • crates/rginx-agent/src/control_center/trait_adapter.rs
  • crates/rginx-agent/src/error.rs
  • crates/rginx-agent/src/events.rs
  • crates/rginx-agent/src/gradual_rollout.rs
  • crates/rginx-agent/src/gradual_rollout/status.rs
  • crates/rginx-agent/src/lib.rs
  • crates/rginx-agent/src/metrics.rs
  • crates/rginx-agent/src/model.rs
  • crates/rginx-agent/src/outbound/auth.rs
  • crates/rginx-agent/src/outbound/client.rs
  • crates/rginx-agent/src/outbound/command.rs
  • crates/rginx-agent/src/outbound/model.rs
  • crates/rginx-agent/src/outbound/runner.rs
  • crates/rginx-agent/src/outbound/state.rs
  • crates/rginx-agent/src/outbound/stream.rs
  • crates/rginx-agent/src/outbound/timing.rs
  • crates/rginx-agent/src/rate_limit.rs
  • crates/rginx-agent/src/registry.rs
  • crates/rginx-agent/src/registry/tests.rs
  • crates/rginx-agent/src/server/breaker.rs
  • crates/rginx-agent/src/server/config.rs
  • crates/rginx-agent/src/server/control.rs
  • crates/rginx-agent/src/server/maintenance.rs
  • crates/rginx-agent/src/server/mod.rs
  • crates/rginx-agent/src/server/registry.rs
  • crates/rginx-agent/src/server/request.rs
  • crates/rginx-agent/src/server/request/query.rs
  • crates/rginx-agent/src/server/request/read.rs
  • crates/rginx-agent/src/server/response.rs
  • crates/rginx-agent/src/server/rollout.rs
  • crates/rginx-agent/src/server/write.rs
  • crates/rginx-agent/src/server/write/routing.rs
  • crates/rginx-agent/src/system.rs
  • crates/rginx-agent/src/tests.rs
  • crates/rginx-agent/src/tests/outbound.rs
  • crates/rginx-agent/src/tests/outbound_auth.rs
  • crates/rginx-agent/src/tests/outbound_stream.rs
  • crates/rginx-agent/src/tests/support.rs
  • crates/rginx-agent/src/tests/support/executors.rs
  • crates/rginx-agent/src/tls.rs
  • crates/rginx-agent/src/websocket.rs
  • crates/rginx-app/Cargo.toml
  • crates/rginx-app/src/admin_cli/mod.rs
  • crates/rginx-app/src/admin_cli/status.rs
  • crates/rginx-app/src/admin_cli/traffic.rs
  • crates/rginx-app/src/check/acme.rs
  • crates/rginx-app/src/check/control.rs
  • crates/rginx-app/src/check/routes.rs
  • crates/rginx-app/src/check/summary.rs
  • crates/rginx-app/src/check/tls.rs
  • crates/rginx-app/src/cli.rs
  • crates/rginx-app/src/main.rs
  • crates/rginx-app/src/pid_file.rs
  • crates/rginx-app/tests/access_log.rs
  • crates/rginx-app/tests/active_health.rs
  • crates/rginx-app/tests/admin.rs
  • crates/rginx-app/tests/backup.rs
  • crates/rginx-app/tests/cache.rs
  • crates/rginx-app/tests/cache/benchmarks.rs
  • crates/rginx-app/tests/check.rs
  • crates/rginx-app/tests/check/helpers.rs
  • crates/rginx-app/tests/compression.rs
  • crates/rginx-app/tests/dns_refresh.rs
  • crates/rginx-app/tests/downstream_mtls.rs
  • crates/rginx-app/tests/downstream_mtls/verifier.rs
  • crates/rginx-app/tests/failover.rs
  • crates/rginx-app/tests/grpc_http3.rs
  • crates/rginx-app/tests/grpc_http3/helpers.rs
  • crates/rginx-app/tests/grpc_proxy.rs
  • crates/rginx-app/tests/grpc_proxy/basic.rs
  • crates/rginx-app/tests/grpc_proxy/basic/grpc_web.rs
  • crates/rginx-app/tests/grpc_proxy/basic/routing.rs
  • crates/rginx-app/tests/grpc_proxy/helpers/body.rs
  • crates/rginx-app/tests/grpc_proxy/helpers/grpc_web.rs
  • crates/rginx-app/tests/grpc_proxy/helpers/server.rs
  • crates/rginx-app/tests/grpc_proxy/helpers/tls.rs
  • crates/rginx-app/tests/grpc_proxy/helpers/upstream.rs
  • crates/rginx-app/tests/grpc_proxy/lifecycle.rs
  • crates/rginx-app/tests/grpc_proxy/timeout.rs
  • crates/rginx-app/tests/grpc_proxy/timeout/grpc_web.rs
  • crates/rginx-app/tests/grpc_proxy/timeout/validation.rs
  • crates/rginx-app/tests/hardening.rs
  • crates/rginx-app/tests/http2.rs
  • crates/rginx-app/tests/http3.rs
  • crates/rginx-app/tests/http3/helpers/client.rs
  • crates/rginx-app/tests/http3/helpers/client/tls.rs
  • crates/rginx-app/tests/http3/helpers/fixtures.rs
  • crates/rginx-app/tests/ip_hash.rs
  • crates/rginx-app/tests/least_conn.rs
  • crates/rginx-app/tests/multi_listener.rs
  • crates/rginx-app/tests/nginx_alignment.rs
  • crates/rginx-app/tests/nginx_diff.rs
  • crates/rginx-app/tests/ocsp.rs
  • crates/rginx-app/tests/ocsp/helpers.rs
  • crates/rginx-app/tests/phase1.rs
  • crates/rginx-app/tests/policy.rs
  • crates/rginx-app/tests/proxy_protocol.rs
  • crates/rginx-app/tests/reload.rs
  • crates/rginx-app/tests/reload/cache.rs
  • crates/rginx-app/tests/reload/cache_streaming.rs
  • crates/rginx-app/tests/reload/cli.rs
  • crates/rginx-app/tests/reload/reload_boundary.rs
  • crates/rginx-app/tests/reload/reload_flow.rs
  • crates/rginx-app/tests/reload/restart_flow.rs
  • crates/rginx-app/tests/reload/streaming_flow.rs
  • crates/rginx-app/tests/static_file_streaming.rs
  • crates/rginx-app/tests/streaming_download.rs
  • crates/rginx-app/tests/support/cache/mod.rs
  • crates/rginx-app/tests/support/cache/response.rs
  • crates/rginx-app/tests/support/cache/upstream.rs
  • crates/rginx-app/tests/support/harness.rs
  • crates/rginx-app/tests/support/http.rs
  • crates/rginx-app/tests/support/mod.rs
  • crates/rginx-app/tests/support/nginx.rs
  • crates/rginx-app/tests/support/response.rs
  • crates/rginx-app/tests/support/tls.rs
  • crates/rginx-app/tests/tls_policy.rs
  • crates/rginx-app/tests/upgrade.rs
  • crates/rginx-app/tests/upstream_http2.rs
  • crates/rginx-app/tests/upstream_http3.rs
  • crates/rginx-app/tests/upstream_mtls.rs
  • crates/rginx-app/tests/upstream_server_name.rs
  • crates/rginx-app/tests/vhost.rs
  • crates/rginx-app/tests/weighted_round_robin.rs
  • crates/rginx-app/tests/workers.rs
  • crates/rginx-config/Cargo.toml
  • crates/rginx-config/src/compile/acme.rs
  • crates/rginx-config/src/compile/cache.rs
  • crates/rginx-config/src/compile/mod.rs
  • crates/rginx-config/src/compile/route.rs
  • crates/rginx-config/src/compile/server.rs
  • crates/rginx-config/src/compile/server/fields.rs
  • crates/rginx-config/src/compile/server/listener.rs
  • crates/rginx-config/src/compile/server/listener/vhost_binding.rs
  • crates/rginx-config/src/compile/server/tls.rs
  • crates/rginx-config/src/compile/server/tls/identity.rs
  • crates/rginx-config/src/compile/tests.rs
  • crates/rginx-config/src/compile/tests/acme.rs
  • crates/rginx-config/src/compile/tests/cache.rs
  • crates/rginx-config/src/compile/tests/route.rs
  • crates/rginx-config/src/compile/tests/server_settings.rs
  • crates/rginx-config/src/compile/tests/vhosts.rs
  • crates/rginx-config/src/compile/upstream.rs
  • crates/rginx-config/src/compile/upstream/tls.rs
  • crates/rginx-config/src/compile/vhost.rs
  • crates/rginx-config/src/lib.rs
  • crates/rginx-config/src/listen.rs
  • crates/rginx-config/src/load.rs
  • crates/rginx-config/src/load/env_expand.rs
  • crates/rginx-config/src/load/layout.rs
  • crates/rginx-config/src/load/layout/array_rules.rs
  • crates/rginx-config/src/load/layout/scanner.rs
  • crates/rginx-config/src/load/tests.rs
  • crates/rginx-config/src/managed/mod.rs
  • crates/rginx-config/src/managed/normalize.rs
  • crates/rginx-config/src/managed/paths.rs
  • crates/rginx-config/src/managed/types.rs
  • crates/rginx-config/src/model.rs
  • crates/rginx-config/src/model/acme.rs
  • crates/rginx-config/src/model/agent.rs
  • crates/rginx-config/src/model/cache.rs
  • crates/rginx-config/src/model/control_plane.rs
  • crates/rginx-config/src/model/listener.rs
  • crates/rginx-config/src/model/route.rs
  • crates/rginx-config/src/model/runtime.rs
  • crates/rginx-config/src/model/server.rs
  • crates/rginx-config/src/model/tls.rs
  • crates/rginx-config/src/model/upstream.rs
  • crates/rginx-config/src/model/vhost.rs
  • crates/rginx-config/src/validate.rs
  • crates/rginx-config/src/validate/cache.rs
  • crates/rginx-config/src/validate/cache/predicate.rs
  • crates/rginx-config/src/validate/route.rs
  • crates/rginx-config/src/validate/route/handler.rs
  • crates/rginx-config/src/validate/server.rs
  • crates/rginx-config/src/validate/server/listener.rs
  • crates/rginx-config/src/validate/server/listener/base.rs
  • crates/rginx-config/src/validate/server/listener/listeners.rs
  • crates/rginx-config/src/validate/tests.rs
  • crates/rginx-config/src/validate/tests/control_plane.rs
  • crates/rginx-config/src/validate/tests/vhosts.rs
  • crates/rginx-config/src/validate/upstream.rs
  • crates/rginx-config/src/validate/upstream/basics.rs
  • crates/rginx-config/src/validate/upstream/dns.rs
  • crates/rginx-config/src/validate/upstream/health.rs
  • crates/rginx-config/src/validate/upstream/protocol.rs
  • crates/rginx-config/src/validate/upstream/tls.rs
  • crates/rginx-config/src/validate/upstream/tuning.rs
  • crates/rginx-core/Cargo.toml
  • crates/rginx-core/src/config.rs
  • crates/rginx-core/src/config/access_log.rs
  • crates/rginx-core/src/config/access_log/variables.rs
  • crates/rginx-core/src/config/acme.rs
  • crates/rginx-core/src/config/agent.rs
  • crates/rginx-core/src/config/cache.rs
  • crates/rginx-core/src/config/cache/key_template.rs
  • crates/rginx-core/src/config/cache/predicate.rs
  • crates/rginx-core/src/config/control_plane.rs
  • crates/rginx-core/src/config/listener.rs
  • crates/rginx-core/src/config/route.rs
  • crates/rginx-core/src/config/route/prefix.rs
  • crates/rginx-core/src/config/route/proxy_header.rs
  • crates/rginx-core/src/config/route/regex_matcher.rs
  • crates/rginx-core/src/config/server.rs
  • crates/rginx-core/src/config/server_name.rs
  • crates/rginx-core/src/config/snapshot/linear.rs
  • crates/rginx-core/src/config/snapshot/lookup.rs
  • crates/rginx-core/src/config/snapshot/mod.rs
  • crates/rginx-core/src/config/snapshot/route_selection.rs
  • crates/rginx-core/src/config/snapshot/vhost_selection.rs
  • crates/rginx-core/src/config/tests/core.rs
  • crates/rginx-core/src/config/tests/mod.rs
  • crates/rginx-core/src/config/tls.rs
  • crates/rginx-core/src/config/upstream.rs
  • crates/rginx-core/src/config/upstream/selection.rs
  • crates/rginx-core/src/config/upstream/types.rs
  • crates/rginx-core/src/config/virtual_host.rs
  • crates/rginx-core/src/error.rs
  • crates/rginx-core/src/lib.rs
  • crates/rginx-http/Cargo.toml
  • crates/rginx-http/src/cache/entry.rs
  • crates/rginx-http/src/cache/entry/metadata.rs
  • crates/rginx-http/src/cache/entry/response.rs
  • crates/rginx-http/src/cache/entry/response/body.rs
  • crates/rginx-http/src/cache/entry/signature.rs
  • crates/rginx-http/src/cache/entry/temp.rs
  • crates/rginx-http/src/cache/entry/write.rs
  • crates/rginx-http/src/cache/fill.rs
  • crates/rginx-http/src/cache/fill/external.rs
  • crates/rginx-http/src/cache/fill/local.rs
  • crates/rginx-http/src/cache/fill/persistence.rs
  • crates/rginx-http/src/cache/fill/shared.rs
  • crates/rginx-http/src/cache/fill/shared/access.rs
  • crates/rginx-http/src/cache/index.rs
  • crates/rginx-http/src/cache/io.rs
  • crates/rginx-http/src/cache/load.rs
  • crates/rginx-http/src/cache/lookup.rs
  • crates/rginx-http/src/cache/manager.rs
  • crates/rginx-http/src/cache/manager/bootstrap.rs
  • crates/rginx-http/src/cache/manager/control.rs
  • crates/rginx-http/src/cache/manager/lookup_support.rs
  • crates/rginx-http/src/cache/manager/response.rs
  • crates/rginx-http/src/cache/mod.rs
  • crates/rginx-http/src/cache/policy.rs
  • crates/rginx-http/src/cache/request.rs
  • crates/rginx-http/src/cache/request/render.rs
  • crates/rginx-http/src/cache/runtime.rs
  • crates/rginx-http/src/cache/runtime/context.rs
  • crates/rginx-http/src/cache/runtime/fill_lock.rs
  • crates/rginx-http/src/cache/runtime/support.rs
  • crates/rginx-http/src/cache/runtime/zone.rs
  • crates/rginx-http/src/cache/runtime/zone/compare.rs
  • crates/rginx-http/src/cache/shared.rs
  • crates/rginx-http/src/cache/shared/bootstrap.rs
  • crates/rginx-http/src/cache/shared/delta.rs
  • crates/rginx-http/src/cache/shared/index_file/codec/binary.rs
  • crates/rginx-http/src/cache/shared/index_file/codec/cursor.rs
  • crates/rginx-http/src/cache/shared/index_file/codec/legacy.rs
  • crates/rginx-http/src/cache/shared/index_file/codec/mod.rs
  • crates/rginx-http/src/cache/shared/index_file/memory_backend.rs
  • crates/rginx-http/src/cache/shared/index_file/memory_backend/changes.rs
  • crates/rginx-http/src/cache/shared/index_file/memory_backend/document/codec.rs
  • crates/rginx-http/src/cache/shared/index_file/memory_backend/document/codec/cursor.rs
  • crates/rginx-http/src/cache/shared/index_file/memory_backend/document/mod.rs
  • crates/rginx-http/src/cache/shared/index_file/memory_backend/document/model.rs
  • crates/rginx-http/src/cache/shared/index_file/memory_backend/locks.rs
  • crates/rginx-http/src/cache/shared/index_file/mod.rs
  • crates/rginx-http/src/cache/shared/index_file/store.rs
  • crates/rginx-http/src/cache/shared/memory.rs
  • crates/rginx-http/src/cache/shared/memory/config.rs
  • crates/rginx-http/src/cache/state.rs
  • crates/rginx-http/src/cache/store.rs
  • crates/rginx-http/src/cache/store/helpers.rs
  • crates/rginx-http/src/cache/store/maintenance/index_state.rs
  • crates/rginx-http/src/cache/store/maintenance/mod.rs
  • crates/rginx-http/src/cache/store/maintenance/store_update.rs
  • crates/rginx-http/src/cache/store/range.rs
  • crates/rginx-http/src/cache/store/revalidate.rs
  • crates/rginx-http/src/cache/store/streaming.rs
  • crates/rginx-http/src/cache/store/streaming/body.rs
  • crates/rginx-http/src/cache/store/streaming/finalize.rs
  • crates/rginx-http/src/cache/tests/lookup.rs
  • crates/rginx-http/src/cache/tests/lookup/keys.rs
  • crates/rginx-http/src/cache/tests/mod.rs

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/clippy-strict-lints

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@vansour vansour marked this pull request as ready for review May 17, 2026 06:18
Copilot AI review requested due to automatic review settings May 17, 2026 06:18
@chatgpt-codex-connector
Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review this pull request because it exceeds the maximum number of files (300). Try reducing the number of changed files and requesting a review from Copilot again.

Copy link
Copy Markdown

@amazon-q-developer amazon-q-developer Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary

This PR successfully implements a comprehensive Clippy lint policy upgrade across the workspace, adding clippy::pedantic and carefully selected clippy::restriction lints. The changes are extensive (535 files) but mostly mechanical, focused on addressing lint warnings through:

  • Adding workspace-level lint configuration in Cargo.toml
  • Using saturating_add/saturating_sub for arithmetic operations to prevent overflows
  • Adding #[must_use] attributes to constructors
  • Adding #[expect(...)] suppressions with clear justification
  • Reordering struct fields and enum variants for consistency

Critical Issue Found

1 blocking issue identified that could cause crashes in production:

The current_timestamp() function in crates/rginx-agent/src/circuit_breaker.rs uses unwrap() on SystemTime::now().duration_since(UNIX_EPOCH), which will panic if the system clock is set before the Unix epoch. This needs to be replaced with expect() and a descriptive message, or proper error handling.

Validation

The PR description indicates thorough testing with multiple Clippy configurations and standard test/build commands, which demonstrates proper validation of the changes.


You can now have the agent implement changes and create commits directly on your pull request's source branch. Simply comment with /q followed by your request in natural language to ask the agent to make changes.


⚠️ This PR contains more than 30 files. Amazon Q is better at reviewing smaller PRs, and may miss issues in larger changesets.

Comment thread crates/rginx-agent/src/circuit_breaker.rs Outdated
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces extensive code reorganization, linting improvements, and safety enhancements across the workspace. Key changes include the adoption of stricter Clippy lints, field and method reordering for consistency, and the use of saturating arithmetic and interpolated strings. Feedback suggests extending the use of the #[must_use] attribute to all side-effect-free methods and replacing panicking calls like expect() with fallible parsing when handling potentially untrusted input to improve robustness.

Comment thread crates/rginx-agent/src/agent_core.rs
Comment thread crates/rginx-config/src/load/env_expand.rs Outdated
@vansour vansour force-pushed the codex/clippy-strict-lints branch from 9da8233 to 6eeb0d8 Compare May 17, 2026 06:54
@vansour vansour force-pushed the codex/clippy-strict-lints branch from 6eeb0d8 to 36b53f6 Compare May 17, 2026 06:59
@vansour vansour merged commit 25a7185 into main May 17, 2026
10 checks passed
@vansour vansour deleted the codex/clippy-strict-lints branch May 17, 2026 07:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants