chore(rust/clippy): enable some lints#12363
Conversation
Move the SAFETY rationale out of the EnvGuard doc comment and onto the two env-var unsafe blocks it actually justifies, so every unsafe block in the workspace now carries its own // SAFETY: comment.
Reword a comment in local_tracing that used the // SAFETY: prefix to justify an expect() on safe code; the prefix is reserved for unsafe blocks.
No occurrences in the workspace; the lint keeps stray todo!() markers out of committed code from now on.
No occurrences in the workspace; the lint keeps stray unimplemented!() markers out of committed code from now on.
The one deliberate process exit — dlx propagating the spawned command's exit status, matching pnpm — now carries an #[expect] stating that; any new std::process::exit call site has to justify itself the same way.
No occurrences in the workspace; a loop that can never terminate must return ! from now on.
The overrides test helper leaked its TempDir via mem::forget to keep the fixture on disk; TempDir::keep() is the purpose-built API for that. The two registry-mock forget(mock_instance) calls stay — the leak is how the shared mock-registry process survives the spawning test process — but now carry #[expect] so the intent is machine-checked.
Replace .get(...).unwrap() / .get_mut(...).unwrap() with indexing across the test suites (machine-applicable clippy fixes): the panic is the same, but the intent is clearer and the panic message names the missing key instead of 'unwrap on None'.
Two best-effort calls in tests discarded their Result with .ok(); spell the discard out with let _ = instead, so .ok() is reserved for actually consuming the Option.
resolve_path built its joined path with to_path_buf + push; Path::join expresses the same thing in one allocation-aware call.
The phase-event fixture concatenated string literals at runtime with String + &str; concat! assembles the same fixture at compile time.
No occurrences in the workspace; whole-file reads go through fs::read / fs::read_to_string rather than manual open + read_to_end loops from now on.
Convert every #[allow] in the workspace to #[expect]. The conversion immediately paid for itself by surfacing four suppressions whose lint no longer fires: - resolve_peers: a too_many_arguments expect on a three-argument method (stale since a refactor) - removed. - resolve_peers: two dead_code expects on MissingPeerInfo fields the compiler considers used - removed. - tarball: fetch_and_extract_zip_once stacked two copies of the same too_many_arguments suppression - deduplicated. - ensure_file: a cfg_attr(windows, allow(unused)) on a mode parameter that IS used on Windows (via verify_or_rewrite) - removed. The remaining windows-side cfg_attr suppressions become expect with a reason, and fire correctly there (the parameters are genuinely unused on that cfg).
Every #[expect] in the workspace already carries a reason; the lint locks the convention in.
No occurrences in the workspace; cargo features stay additive (no no-std / not-x style names) from now on.
No occurrences in the workspace; feature names won't restate that they are features (use-x / with-x prefixes and suffixes).
No occurrences in the workspace; every dependency keeps a real version requirement instead of "*".
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (11)
📜 Recent review details⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (7)
🧰 Additional context used📓 Path-based instructions (1)pacquet/**/*.rs📄 CodeRabbit inference engine (pacquet/AGENTS.md)
Files:
🧠 Learnings (6)📚 Learning: 2026-05-20T19:40:55.051ZApplied to files:
📚 Learning: 2026-05-22T00:08:44.646ZApplied to files:
📚 Learning: 2026-05-20T23:07:58.444ZApplied to files:
📚 Learning: 2026-06-06T18:58:37.156ZApplied to files:
📚 Learning: 2026-06-12T20:41:57.558ZApplied to files:
📚 Learning: 2026-06-12T07:04:03.703ZApplied to files:
🔇 Additional comments (11)
📝 WalkthroughWalkthroughThis PR expands the workspace clippy lint configuration and applies corresponding code fixes throughout the codebase. The changes enable stricter linting rules and document or suppress expected lint warnings via ChangesClippy Lint Expansion and Code Compliance
🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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 |
Micro-Benchmark ResultsLinux |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #12363 +/- ##
==========================================
- Coverage 88.17% 88.16% -0.01%
==========================================
Files 295 295
Lines 37769 37767 -2
==========================================
- Hits 33302 33297 -5
- Misses 4467 4470 +3 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Integrated-Benchmark Report (Linux)Each scenario reports direct installs and pnpr installs. Bencher consumes pacquet@HEAD and pnpr@HEAD. Scenario: Isolated linker: fresh restore, cold cache + cold store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 4.206659264,
"stddev": 0.13466556199322915,
"median": 4.1820984967,
"user": 3.9212651999999992,
"system": 3.51467734,
"min": 4.0288661602,
"max": 4.4532068562,
"times": [
4.2779381202,
4.1282065042,
4.248095322199999,
4.094295874199999,
4.1556115952,
4.3789325352,
4.4532068562,
4.0928542742,
4.0288661602,
4.208585398199999
]
},
{
"command": "pacquet@main",
"mean": 4.093697300800001,
"stddev": 0.11165695245266433,
"median": 4.0711546397,
"user": 3.8887774999999998,
"system": 3.4785276400000003,
"min": 3.9492075732000003,
"max": 4.318494149199999,
"times": [
4.1017474642,
4.0289157732,
3.9954076302000003,
4.1532625342,
4.0439517482,
4.0983575312,
3.9492075732000003,
4.221317732199999,
4.0263108722,
4.318494149199999
]
},
{
"command": "pnpr@HEAD",
"mean": 2.1379217923,
"stddev": 0.11981132830882388,
"median": 2.1436857832,
"user": 2.6172109,
"system": 3.0024893399999995,
"min": 1.9558675722,
"max": 2.3275578282000002,
"times": [
2.0037494612,
2.1478541402,
2.0452473142,
2.1186401632000003,
2.1500768212,
2.3153269562000003,
2.1753802402,
2.3275578282000002,
1.9558675722,
2.1395174262
]
},
{
"command": "pnpr@main",
"mean": 2.1389580796,
"stddev": 0.17616649019628183,
"median": 2.0427235692,
"user": 2.6265122999999995,
"system": 2.97852764,
"min": 1.9380704132000002,
"max": 2.4154244942000003,
"times": [
2.3408227862,
1.9961588522000002,
2.0208941072,
2.0389220442,
2.1748310342,
2.0420349062,
1.9380704132000002,
2.0434122322,
2.3790099262,
2.4154244942000003
]
}
]
}Scenario: Isolated linker: fresh restore, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.6146407441599999,
"stddev": 0.01589974528152202,
"median": 0.61464483236,
"user": 0.37648689999999996,
"system": 1.29247844,
"min": 0.59073220586,
"max": 0.63467174186,
"times": [
0.60842020586,
0.63319860386,
0.59073220586,
0.60935184586,
0.62359166186,
0.63467174186,
0.59655040386,
0.61993781886,
0.63007006086,
0.59988289286
]
},
{
"command": "pacquet@main",
"mean": 0.6454237378600001,
"stddev": 0.08658232144910416,
"median": 0.61603097036,
"user": 0.3669718,
"system": 1.3076716400000001,
"min": 0.60533106386,
"max": 0.89025500686,
"times": [
0.60533106386,
0.62880877686,
0.61713245186,
0.60679501186,
0.61403449086,
0.62722053986,
0.61492948886,
0.63622835186,
0.61350219586,
0.89025500686
]
},
{
"command": "pnpr@HEAD",
"mean": 0.73569494796,
"stddev": 0.1454062000813593,
"median": 0.69402949886,
"user": 0.385776,
"system": 1.3595759399999996,
"min": 0.66450754886,
"max": 1.14638181086,
"times": [
0.67377387086,
0.7177168068600001,
0.67464403386,
0.6881002188600001,
0.66450754886,
0.67582238786,
0.70556882186,
0.71047520086,
1.14638181086,
0.69995877886
]
},
{
"command": "pnpr@main",
"mean": 0.70496678026,
"stddev": 0.06603965426907744,
"median": 0.68567840986,
"user": 0.39118319999999995,
"system": 1.3330750400000002,
"min": 0.66380089086,
"max": 0.88606006586,
"times": [
0.67164206486,
0.66612989686,
0.6769855098600001,
0.69437130986,
0.67010883286,
0.66380089086,
0.70337480586,
0.88606006586,
0.70995520186,
0.70723922386
]
}
]
}Scenario: Isolated linker: fresh install, cold cache + cold store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 3.9389935409399994,
"stddev": 0.04978822907641614,
"median": 3.93397456884,
"user": 3.59496634,
"system": 3.3595850999999994,
"min": 3.85970257984,
"max": 4.03192716484,
"times": [
4.03192716484,
3.92057842384,
3.92343502184,
3.9467445848400002,
3.96122318284,
3.92226494984,
3.99426644684,
3.88527893884,
3.94451411584,
3.85970257984
]
},
{
"command": "pacquet@main",
"mean": 3.89390607324,
"stddev": 0.058003187052427095,
"median": 3.8811740943400004,
"user": 3.54955024,
"system": 3.3691649,
"min": 3.81061458384,
"max": 3.98320386784,
"times": [
3.89311783784,
3.96582605084,
3.91589021084,
3.81061458384,
3.84119457184,
3.84550561184,
3.86466048684,
3.86923035084,
3.98320386784,
3.94981715984
]
},
{
"command": "pnpr@HEAD",
"mean": 2.15930548694,
"stddev": 0.12910394416280357,
"median": 2.11191032484,
"user": 2.47797734,
"system": 2.9148541,
"min": 2.00134117784,
"max": 2.3830350028400002,
"times": [
2.10301027284,
2.00134117784,
2.03203846284,
2.07317743784,
2.28413641384,
2.18662151984,
2.12081037684,
2.31918817284,
2.08969603184,
2.3830350028400002
]
},
{
"command": "pnpr@main",
"mean": 2.17713739794,
"stddev": 0.09606454458114096,
"median": 2.17278528984,
"user": 2.48616494,
"system": 2.9136286,
"min": 2.06726290184,
"max": 2.34946645184,
"times": [
2.19900623784,
2.34946645184,
2.08848007784,
2.22114617984,
2.30455704884,
2.19277819884,
2.07154245184,
2.1527923808400002,
2.12434204984,
2.06726290184
]
}
]
}Scenario: Isolated linker: fresh install, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 1.35901169486,
"stddev": 0.012716694800568184,
"median": 1.3595658423599999,
"user": 1.2541795800000002,
"system": 1.9125335200000002,
"min": 1.3349998563599998,
"max": 1.37432801336,
"times": [
1.3349998563599998,
1.34787322636,
1.36232300136,
1.37191159936,
1.35104199236,
1.35362059636,
1.37432801336,
1.35680868336,
1.36306706636,
1.37414291336
]
},
{
"command": "pacquet@main",
"mean": 1.22283882946,
"stddev": 0.10969267490024755,
"median": 1.18852911436,
"user": 1.20024118,
"system": 1.70910652,
"min": 1.16039755936,
"max": 1.5274665643599998,
"times": [
1.16871142336,
1.20051930636,
1.5274665643599998,
1.21667760136,
1.21009905636,
1.22974803936,
1.16039755936,
1.17653892236,
1.17038771636,
1.1678421053599999
]
},
{
"command": "pnpr@HEAD",
"mean": 0.65297397426,
"stddev": 0.02022845769110653,
"median": 0.6444847543600001,
"user": 0.34671848,
"system": 1.2750071200000002,
"min": 0.63274449636,
"max": 0.69786566836,
"times": [
0.63914062236,
0.63963691236,
0.63274449636,
0.64382488936,
0.66777451436,
0.65911449736,
0.63665581136,
0.66783771136,
0.64514461936,
0.69786566836
]
},
{
"command": "pnpr@main",
"mean": 0.66305241456,
"stddev": 0.005706164121433194,
"median": 0.66329747136,
"user": 0.3487119799999999,
"system": 1.29651552,
"min": 0.65630661636,
"max": 0.67441843636,
"times": [
0.65865546036,
0.66370812936,
0.66397814436,
0.66990155336,
0.65707017836,
0.65630661636,
0.66288681336,
0.66423508536,
0.67441843636,
0.65936372836
]
}
]
}Scenario: Isolated linker: fresh install, cold cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 2.6926695725800003,
"stddev": 0.04599162659025576,
"median": 2.6798300943799997,
"user": 1.63707876,
"system": 1.94420922,
"min": 2.65214866988,
"max": 2.78381202988,
"times": [
2.78381202988,
2.72408388888,
2.6525227398799998,
2.69501513688,
2.65535114288,
2.65214866988,
2.67041728488,
2.65510176488,
2.68924290388,
2.74900016388
]
},
{
"command": "pacquet@main",
"mean": 2.64587954018,
"stddev": 0.04332427238030751,
"median": 2.63582807488,
"user": 1.58766536,
"system": 1.9339460199999998,
"min": 2.57854277288,
"max": 2.71466637088,
"times": [
2.71466637088,
2.65137089188,
2.68296917388,
2.6408540078800002,
2.62593040488,
2.57854277288,
2.61018011788,
2.61818993088,
2.63080214188,
2.70528958888
]
},
{
"command": "pnpr@HEAD",
"mean": 0.64081862258,
"stddev": 0.007998076613017765,
"median": 0.6401608748800001,
"user": 0.31944016,
"system": 1.2936641199999999,
"min": 0.62523731388,
"max": 0.65457717588,
"times": [
0.63538267388,
0.62523731388,
0.65457717588,
0.63857051688,
0.63658743888,
0.64175123288,
0.63840095188,
0.64796178988,
0.64424226788,
0.64547486388
]
},
{
"command": "pnpr@main",
"mean": 0.6322127070799999,
"stddev": 0.006967647440846865,
"median": 0.63210250438,
"user": 0.32693406,
"system": 1.2562756199999998,
"min": 0.62110264388,
"max": 0.64101737088,
"times": [
0.62771421588,
0.63424636688,
0.64029376488,
0.62343866588,
0.6384968358800001,
0.6299586418800001,
0.64101737088,
0.63637310688,
0.62110264388,
0.62948545788
]
}
]
} |
|
| Branch | pr/12363 |
| Testbed | pacquet |
Click to view all benchmark results
| Benchmark | Latency | Benchmark Result milliseconds (ms) (Result Δ%) | Upper Boundary milliseconds (ms) (Limit %) |
|---|---|---|---|
| isolated-linker.fresh-install.cold-cache.cold-store | 📈 view plot 🚷 view threshold | 3,938.99 ms(-39.72%)Baseline: 6,534.24 ms | 7,841.09 ms (50.24%) |
| isolated-linker.fresh-install.cold-cache.hot-store | 📈 view plot 🚷 view threshold | 2,692.67 ms(-29.16%)Baseline: 3,800.83 ms | 4,561.00 ms (59.04%) |
| isolated-linker.fresh-install.hot-cache.hot-store | 📈 view plot 🚷 view threshold | 1,359.01 ms(+7.46%)Baseline: 1,264.62 ms | 1,517.55 ms (89.55%) |
| isolated-linker.fresh-restore.cold-cache.cold-store | 📈 view plot 🚷 view threshold | 4,206.66 ms(-41.77%)Baseline: 7,224.30 ms | 8,669.16 ms (48.52%) |
| isolated-linker.fresh-restore.hot-cache.hot-store | 📈 view plot 🚷 view threshold | 614.64 ms(-8.82%)Baseline: 674.08 ms | 808.90 ms (75.98%) |
|
| Branch | pr/12363 |
| Testbed | pnpr |
⚠️ WARNING: No Threshold found!Without a Threshold, no Alerts will ever be generated.
Click here to create a new Threshold
For more information, see the Threshold documentation.
To only post results if a Threshold exists, set the--ci-only-thresholdsflag.
Click to view all benchmark results
| Benchmark | Latency | milliseconds (ms) |
|---|---|---|
| isolated-linker.fresh-install.cold-cache.cold-store | 📈 view plot | 2,159.31 ms |
| isolated-linker.fresh-install.cold-cache.hot-store | 📈 view plot | 640.82 ms |
| isolated-linker.fresh-install.hot-cache.hot-store | 📈 view plot | 652.97 ms |
| isolated-linker.fresh-restore.cold-cache.cold-store | 📈 view plot | 2,137.92 ms |
| isolated-linker.fresh-restore.hot-cache.hot-store | 📈 view plot | 735.69 ms |
…t_reason perfectionist is adding better-targeted replacements for both, so leave the clippy versions off to avoid duplicate diagnostics. The #[expect] conversions they prompted stay — they are valid without the lints and already removed four stale suppressions.
The enabled lints' names already say what they enforce, so the inline notes and per-theme section headers restated the obvious. Drop them to match the convention of the surrounding activations, keeping only the two category headers that carry non-obvious context.
The lint only rewrites `x.get(i).unwrap()` to `x[i]`, erasing the word "unwrap" from panicking call sites and making them harder to grep for. No safety benefit, so revert the enablement and all of its rewrites. This reverts commit f274ad8.
…hanges Undo the #[allow] -> #[expect] conversions from bde9865 and restore the suppressions that conversion dropped. perfectionist is adding a better-targeted replacement; notably it exempts `allow` inside `cfg_attr`, so the #[cfg_attr(windows, allow(unused))] attributes are restored as-is. The clippy lints themselves were already removed. This reverts the code changes of commit bde9865.
Enables a batch of clippy
restriction- andcargo-group lints across the pacquet/pnpr workspace, plus the small code changes needed to comply. These groups aren't covered by thepedantic/nurseryactivations already in[workspace.lints.clippy], so each lint is opted into individually.Lints enabled (all
warn)undocumented_unsafe_blocks,unnecessary_safety_commentexit,infinite_loop,mem_forget,unused_result_oktodo,unimplementedpathbuf_init_then_push,string_add,verbose_file_readsnegative_feature_names,redundant_feature_names,wildcard_dependenciesMost are zero-violation guards. The few with existing hits were fixed: a leaked
TempDir→TempDir::keep(), two.ok()discards →let _ =, aString + &strfixture →concat!,PathBuf::push→Path::join; two deliberate leaks and one process exit (dlx propagating the child's status) now carry#[expect], and a misplaced// SAFETY:was reworded.Deliberately left off
Lints that would be noise or churn rather than improvements — e.g.
dbg_macro(the style guide prescribesdbg!in tests),str_to_string,print_*,unwrap_used,cargo_common_metadata.get_unwrapandallow_attributes/allow_attributes_without_reasonwere trialed and reverted: perfectionist is adding better-targeted replacements (notably exemptingallowinsidecfg_attr), andget_unwraponly hid the greppableunwrapfrom panicking call sites.cargo clippy --workspace --all-targetsis clean.Written by an agent (Claude Code).
Summary by CodeRabbit
Chores
Refactor