chore: reduce compile warnings (325 → 125)#857
Merged
Conversation
All mechanical lint cleanup, zero behavior change. Verified by
`cargo test --release --workspace --lib` (incl. 250 perry-runtime
tests) and a smoke compile of a TS file exercising arrays, objects,
JSON, Map, Set, and async/await.
Categories addressed:
- 168 × unnecessary `unsafe` block: removed redundant `unsafe { ... }`
wrappers around calls to FFI helpers that are declared
`pub extern "C" fn` (not `unsafe fn`), so the wrapper was a no-op.
- 6 × unused import: HashMap/HashSet/paint/perry_hir::Expr/etc.
- 6 × #[inline] ignored on extern "C": rustc ignores `#[inline]` on
`#[no_mangle] pub extern "C" fn`, so the attribute was misleading.
- 5 × variable does not need to be mutable: dropped redundant `mut`.
- 3 × snake-case naming: `has_user_toString` → `has_user_to_string`
(local variable in lower_call.rs).
- 9 × unused doc comment: converted `///` to `//` for comment blocks
placed before `thread_local!` / macro invocations — rustdoc does
not generate docs for macro outputs.
The remaining 125 warnings need per-site judgment and are tracked
in follow-up issues (unreachable patterns, dead code triage, Rust
2024 compat, _setjmp signature mismatch).
Contributor
|
This is a great one, love it! |
…warnings # Conflicts: # crates/perry-runtime/src/builtins.rs # crates/perry-runtime/src/timer.rs
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
Reduces
cargo build --releasewarnings from 325 → 125 (−62%) across the workspace. All changes are mechanical lint cleanup with zero behavior change. Verified by the full library test suite and a smoke compile.Changes
unnecessary unsafe blockunsafe { ... }wrappers around calls to FFI helpers that are declaredpub extern "C" fn(notunsafe fn), so the wrapper was a no-op.unused importHashMap/HashSet/paint/perry_hir::Expr/ etc.#[inline]ignored onextern "C"#[inline]from#[no_mangle] pub extern "C" fn …— rustc ignores it on externally exported functions, so the attribute was misleading.variable does not need to be mutablemutbindings.has_user_toString→has_user_to_string(local variable inlower_call.rs).unused doc comment///to//for comment blocks placed beforethread_local!/ macro invocations — rustdoc does not generate docs for macro outputs.Out of scope (tracked in follow-up issues)
The remaining 125 warnings need per-site judgment and were carved out:
unreachable pattern/unreachable expression(22 warnings; may hide bugs)#[allow]vs delete)static_mut_refs, deprecatedlibc::mach_host_self)_setjmpdeclared with mismatched signature ingc.rsvspromise.rs(potential UB)Test plan
cargo build --release— 0 errors, 125 warnings (was 325)cargo test --release --workspace --lib(excluding cross-host UI crates) — all pass, including 250 inperry-runtime