fix: resolve Clippy errors from Rust 1.97 lint promotions - #497
Conversation
Replace `for (_, v) in map.iter()` with `for v in map.values()` (clippy::for_kv_map) and simplify a match-on-Result to use the `?` operator (clippy::question_mark). Both lints are now denied under `#![deny(clippy::all)]` with Rust 1.97. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Thomas Maas <thomas@webtypes.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThree internal Rust implementations were simplified: rate-limit checking uses an early-return guard, distributed counter retrieval iterates directly over stored values, and an environment helper allows dead-code warnings. Runtime behaviour remains unchanged. ChangesRate limiter cleanup
Estimated code review effort: 1 (Trivial) | ~3 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
|
There are some clippy errors error: function `value_for` is never used
--> limitador-server/src/config.rs:84:8
|
84 | fn value_for(env_key: &'static str) -> Option<&'static str> {
| ^^^^^^^^^
|
= note: `-D dead-code` implied by `-D warnings`
= help: to override `-D warnings` add `#[expect(dead_code)]` or `#[allow(dead_code)]`
error: function `env_option_is_enabled` is never used
--> limitador-server/src/config.rs:91:8
|
91 | fn env_option_is_enabled(env_name: &str) -> bool {
| ^^^^^^^^^^^^^^^^^^^^^
error: could not compile `limitador-server` (bin "limitador-server" test) due to 2 previous errors |
Rust 1.97 flags `value_for` and `env_option_is_enabled` as dead code in test-only compilation targets, even though they are used by lazy_static! initializers. Add #[allow(dead_code)] to suppress. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Thomas Maas <thomas@webtypes.com>
|
Fixed — pushed a second commit that adds |
Summary
for (_, v) in map.iter()withfor v in map.values()(clippy::for_kv_map) inlimitador/src/storage/distributed/mod.rs:188matchonResultto use?operator (clippy::question_mark) inlimitador/src/lib.rs:396Both lints were promoted to
clippy::allin Rust 1.97 and now fail under the crate's#![deny(clippy::all)]. This unblocks the merge queue for #491 and any other pending PRs.Test plan
🤖 Generated with Claude Code
Summary by CodeRabbit