refactor: resolve clippy lints in mock server and example#239
Merged
Conversation
These lints are surfaced by `cargo clippy --all-targets --features mock` (as run by the local pre-commit hook) but are not caught by CI's default-target clippy, so they had accumulated unnoticed. - src/mock/server.rs: replace the manual `instance_counter` with a `(args.start_index..).zip(port_range)` counter (explicit_counter_loop). - examples/library_usage.rs: inline `original_index` / `total_gb` into the format strings (uninlined_format_args). No behavior change. `cargo clippy --all-targets --features mock -- -D warnings` is now clean.
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
Resolves pre-existing clippy lints in the mock server and the library-usage example. These were surfaced by
cargo clippy --all-targets --features mock(run by the local pre-commit hook) but are not caught by CI's default-targetcargo clippy, so they had gone unnoticed. Discovered while working on #238.Changes
src/mock/server.rs—explicit_counter_loop: replace the manuallet mut instance_counter/instance_counter += 1withfor (instance_counter, port) in (args.start_index..).zip(port_range.clone()). Same numbering (starts atargs.start_index, +1 per node), no behavior change.examples/library_usage.rs—uninlined_format_args: inline the simple identifiersoriginal_indexandtotal_gbinto theprintln!format strings. Field-access args (e.g.held_cpu.cpu_model) stay positional since Rust inline format only supports bare identifiers.Verification
cargo clippy --all-targets --features mock -- -D warnings→ clean (exit 0, 0 warnings).cargo fmt --check→ clean.