Skip to content

chore(warnings): sweep mechanical Rust warnings and drop blanket #[allow(unused_imports)] - #6639

Merged
proggeramlug merged 1 commit into
mainfrom
chore/warnings-mechanical-sweep
Jul 21, 2026
Merged

chore(warnings): sweep mechanical Rust warnings and drop blanket #[allow(unused_imports)]#6639
proggeramlug merged 1 commit into
mainfrom
chore/warnings-mechanical-sweep

Conversation

@TheHypnoo

@TheHypnoo TheHypnoo commented Jul 18, 2026

Copy link
Copy Markdown
Member

Summary

Mechanical Rust warning cleanup across the workspace — no behavioral change. This is the first, zero-risk slice of a larger warning-elimination effort (the workspace currently emits ~1338 warnings on a clean cargo check); it clears the fully mechanical categories and the blanket import-suppression debt.

Two commits:

  1. cargo fix mechanical sweep — removes unused imports, unnecessary unsafe blocks, unused mut/braces, and unused assignments. cargo fix handles most of these; unused_unsafe is applied by a span-driven pass because rustc emits that lint without a machine-applicable suggestion (removing an unnecessary unsafe block is safe by definition — if it were needed, it would not be flagged).

  2. Drop 444 blanket #[allow(unused_imports)] and prune — these attributes papered over duplicated import preambles in mechanically-split files. Removing them and re-running cargo fix prunes the now-visible unused imports. The warning count does not rise afterward, confirming the suppressed imports were all genuinely removable. Two documented, intentional allows remain.

Impact

  • Workspace warning count: 1338 → 281 (this branch covers the mechanical + import-suppression share).
  • #[allow(unused_imports)]: 444 → 2 (both remaining are documented and deliberate).

Validation

  • cargo check --workspace (excluding cross-host UI crates): 0 errors.
  • cargo fmt --all --check: clean.
  • cargo check --workspace --tests: no new errors from this change (the one pre-existing failure — a stale CompileOptions field reference in perry-codegen/tests/perry_builtin_name_collision.rs — is unrelated and already present on main).

Notes

  • No version bump or CHANGELOG entry — left for the maintainer to fold in at merge, per the repo's contributor convention.
  • Remaining 281 warnings need per-item judgment (dead_code, clashing extern declarations, unreachable patterns, etc.) and are handled in follow-up PRs.

Summary by CodeRabbit

  • Bug Fixes
    • Improved native-call handling when optional parameters are omitted, supplying appropriate default values for more reliable execution.
  • Refactor
    • Streamlined internal module wiring and removed redundant imports across compilation, runtime, standard-library, and analysis components.
    • Consolidated selected compilation and runtime helpers without changing supported APIs or normal behavior.
  • Maintenance
    • Reduced warning suppressions and clarified internal dependencies, improving build cleanliness and long-term maintainability.

@coderabbitai

coderabbitai Bot commented Jul 18, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

This PR removes unused imports and warning suppressions, narrows internal re-exports, simplifies several local bindings, and adds focused helpers for method-name registration, global-property lowering, and omitted native-parameter padding.

Changes

Repository-wide Rust cleanup

Layer / File(s) Summary
WASM emitter cleanup
crates/perry-codegen-wasm/src/emit/*
Removes an unused local binding and replaces an unused-import suppression with an explicit retained import.
Codegen cleanup and helper extraction
crates/perry-codegen/src/codegen/*, crates/perry-codegen/src/expr/*, crates/perry-codegen/src/lower_call/*, crates/perry-codegen/src/type_analysis*
Narrowed imports and re-exports across codegen modules; adds method-name registration, global-property lowering, and omitted native-parameter padding helpers.
HIR cleanup
crates/perry-hir/src/destructuring/*, crates/perry-hir/src/lower*, crates/perry-hir/src/lower_decl/*, crates/perry-hir/src/lower_types*
Removes unused imports and reduces internal re-export surfaces without changing the described lowering behavior.
Runtime cleanup
crates/perry-runtime/src/*
Narrowed imports, wildcard scopes, internal re-exports, and unused bindings across runtime subsystems.
Standard-library and CLI cleanup
crates/perry-stdlib/src/*, crates/perry/src/commands/compile/cjs_wrap/*, crates/perry-ext-http/src/lib.rs
Removes unused imports and warning suppressions, narrows sibling imports, and preserves existing dispatch and test logic.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Possibly related PRs

  • PerryTS/perry#5423: Similar mechanical cleanup of imports and internal re-exports in HIR lowering modules.

Suggested labels: ready

Suggested reviewers: proggeramlug

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description is informative, but it does not follow the template sections for Changes, Related issue, Test plan, or Checklist. Add the missing template sections: a Changes bullet list, Related issue (or n/a), a checkbox-style Test plan, and the checklist items.
Docstring Coverage ⚠️ Warning Docstring coverage is 11.11% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly matches the main change: a mechanical warning cleanup and removal of blanket unused-import allowances.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/warnings-mechanical-sweep

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.

@TheHypnoo
TheHypnoo force-pushed the chore/warnings-mechanical-sweep branch 2 times, most recently from 0ef5601 to 902f045 Compare July 21, 2026 08:59
Drop 445 blanket #[allow(unused_imports)] across 86 host-buildable
crates, prune the exposed dead imports with `cargo fix --all-targets`,
and delete four dead bindings cargo fix could only underscore. Parent
imports used solely by #[cfg(test)] sibling modules via `super::` are
restored #[cfg(test)]-gated.
@TheHypnoo
TheHypnoo force-pushed the chore/warnings-mechanical-sweep branch from 902f045 to 0b1835a Compare July 21, 2026 10:02

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
crates/perry-codegen/src/expr/property_get/globalget.rs (1)

83-133: 📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win

Consolidate duplicated lowering logic for built-in statics and native modules.

The manual lowering block for "hasOwn" (lines 112-133) is identical to the logic performed by lower_global_builtin_static_value(ctx, "Object", property). You can safely remove this block and simply add "hasOwn" to the matches! list for Object above (lines 83-102).

Similarly, consider reusing lower_global_builtin_static_value (if its implementation is generic) or extracting a shared helper for Error, ArrayBuffer, Uint8Array, SubtleCrypto, and Math to eliminate the extensive duplicated boilerplate. The same applies to the native module property lookups for console and process, which share identical emission logic.

♻️ Proposed fix to consolidate `"hasOwn"`
@@ -97,7 +97,8 @@
             | "getOwnPropertyNames"
             | "getOwnPropertySymbols"
             | "getOwnPropertyDescriptors"
-            | "defineProperties"
+            | "defineProperties"
+            | "hasOwn"
     ) {
         return Ok(lower_global_builtin_static_value(ctx, "Object", property));
     }
-    // `#3527`: `Object.hasOwn` read as a VALUE (not a direct call) —
-    // e.g. iconv-lite's merge-exports does
-    // `var hasOwn = typeof Object.hasOwn === "undefined" ? … :
-    // Object.hasOwn` then `hasOwn(obj, key)`. The ternary defeats
-    // the const-alias call-fold, so the value must be a real
-    // callable. Mirror the `Error.captureStackTrace` shape above:
-    // resolve the reified `Object` constructor closure and read the
-    // `hasOwn` static (installed by `install_builtin_constructor_statics`)
-    // off it, instead of falling through to the `0.0` sentinel.
-    if property == "hasOwn" {
-        let object_idx = ctx.strings.intern("Object");
-        let object_bytes_global = format!("@{}", ctx.strings.entry(object_idx).bytes_global);
-        let object_len = "Object".len().to_string();
-        let object_ctor = ctx.block().call(
-            DOUBLE,
-            "js_get_global_this_builtin_value",
-            &[(PTR, &object_bytes_global), (I64, &object_len)],
-        );
-        let key_idx = ctx.strings.intern(property);
-        let key_handle_global = format!("@{}", ctx.strings.entry(key_idx).handle_global);
-        let blk = ctx.block();
-        let ctor_handle = unbox_to_i64(blk, &object_ctor);
-        let key_box = blk.load(DOUBLE, &key_handle_global);
-        let key_bits = blk.bitcast_double_to_i64(&key_box);
-        let key_raw = blk.and(I64, &key_bits, POINTER_MASK_I64);
-        return Ok(blk.call(
-            DOUBLE,
-            "js_object_get_field_by_name_f64",
-            &[(I64, &ctor_handle), (I64, &key_raw)],
-        ));
-    }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@crates/perry-codegen/src/expr/property_get/globalget.rs` around lines 83 -
133, Consolidate the Object.hasOwn lowering by adding "hasOwn" to the existing
Object static-property matches! list and removing the manual block that resolves
the constructor and field. Reuse lower_global_builtin_static_value for this
path, preserving the existing behavior while eliminating duplicated emission
logic.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@crates/perry-codegen/src/expr/property_get/globalget.rs`:
- Around line 83-133: Consolidate the Object.hasOwn lowering by adding "hasOwn"
to the existing Object static-property matches! list and removing the manual
block that resolves the constructor and field. Reuse
lower_global_builtin_static_value for this path, preserving the existing
behavior while eliminating duplicated emission logic.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 84b76afc-8e5c-489f-9c0f-595ef665f3e6

📥 Commits

Reviewing files that changed from the base of the PR and between 0adf0d2 and 0b1835a.

📒 Files selected for processing (294)
  • crates/perry-codegen-wasm/src/emit/compile.rs
  • crates/perry-codegen-wasm/src/emit/mod.rs
  • crates/perry-codegen-wasm/src/emit/runtime_imports.rs
  • crates/perry-codegen-wasm/src/emit/ui_method_map.rs
  • crates/perry-codegen/src/codegen/boxed_locals.rs
  • crates/perry-codegen/src/codegen/closure.rs
  • crates/perry-codegen/src/codegen/closure_collect.rs
  • crates/perry-codegen/src/codegen/func_registry.rs
  • crates/perry-codegen/src/codegen/function.rs
  • crates/perry-codegen/src/codegen/i64_spec.rs
  • crates/perry-codegen/src/codegen/method_registry.rs
  • crates/perry-codegen/src/codegen/mod.rs
  • crates/perry-codegen/src/codegen/module_globals_emit.rs
  • crates/perry-codegen/src/collectors/mod.rs
  • crates/perry-codegen/src/expr/array_methods.rs
  • crates/perry-codegen/src/expr/array_push.rs
  • crates/perry-codegen/src/expr/arrays_finds.rs
  • crates/perry-codegen/src/expr/bigint_set.rs
  • crates/perry-codegen/src/expr/binary.rs
  • crates/perry-codegen/src/expr/buffer_access.rs
  • crates/perry-codegen/src/expr/call_spread.rs
  • crates/perry-codegen/src/expr/calls.rs
  • crates/perry-codegen/src/expr/calls/crypto_hash.rs
  • crates/perry-codegen/src/expr/calls/crypto_kdf.rs
  • crates/perry-codegen/src/expr/calls/crypto_keys.rs
  • crates/perry-codegen/src/expr/calls/crypto_misc.rs
  • crates/perry-codegen/src/expr/calls/fs.rs
  • crates/perry-codegen/src/expr/calls/helpers.rs
  • crates/perry-codegen/src/expr/child_proc.rs
  • crates/perry-codegen/src/expr/closure.rs
  • crates/perry-codegen/src/expr/compare.rs
  • crates/perry-codegen/src/expr/conditional.rs
  • crates/perry-codegen/src/expr/dispatch.rs
  • crates/perry-codegen/src/expr/dyn_extern_i18n.rs
  • crates/perry-codegen/src/expr/env_clones.rs
  • crates/perry-codegen/src/expr/fs_await.rs
  • crates/perry-codegen/src/expr/index_get.rs
  • crates/perry-codegen/src/expr/index_set.rs
  • crates/perry-codegen/src/expr/instance_misc1.rs
  • crates/perry-codegen/src/expr/js_runtime.rs
  • crates/perry-codegen/src/expr/literals_vars.rs
  • crates/perry-codegen/src/expr/logical_collections.rs
  • crates/perry-codegen/src/expr/math_simple.rs
  • crates/perry-codegen/src/expr/misc_methods.rs
  • crates/perry-codegen/src/expr/mod.rs
  • crates/perry-codegen/src/expr/new_dynamic.rs
  • crates/perry-codegen/src/expr/objects_arrays_lit.rs
  • crates/perry-codegen/src/expr/os_uri_dates.rs
  • crates/perry-codegen/src/expr/property_get.rs
  • crates/perry-codegen/src/expr/property_get/generic_dispatch.rs
  • crates/perry-codegen/src/expr/property_get/globalget.rs
  • crates/perry-codegen/src/expr/property_get/helpers.rs
  • crates/perry-codegen/src/expr/property_set.rs
  • crates/perry-codegen/src/expr/proxy_reflect.rs
  • crates/perry-codegen/src/expr/record_value.rs
  • crates/perry-codegen/src/expr/shadow_slot.rs
  • crates/perry-codegen/src/expr/static_field_meta.rs
  • crates/perry-codegen/src/expr/static_method.rs
  • crates/perry-codegen/src/expr/string_regex_proc.rs
  • crates/perry-codegen/src/expr/super_method.rs
  • crates/perry-codegen/src/expr/this_super_call.rs
  • crates/perry-codegen/src/expr/unary.rs
  • crates/perry-codegen/src/expr/url_main.rs
  • crates/perry-codegen/src/lower_call/mod.rs
  • crates/perry-codegen/src/lower_call/new.rs
  • crates/perry-codegen/src/lower_call/omitted_native_params.rs
  • crates/perry-codegen/src/lower_call/property_get.rs
  • crates/perry-codegen/src/lower_call/property_get/dynamic_dispatch.rs
  • crates/perry-codegen/src/lower_call/property_get/fetch_chain.rs
  • crates/perry-codegen/src/lower_call/property_get/helpers.rs
  • crates/perry-codegen/src/lower_call/property_get/map_set.rs
  • crates/perry-codegen/src/lower_call/property_get/number_string.rs
  • crates/perry-codegen/src/lower_call/property_get/promise_chain.rs
  • crates/perry-codegen/src/lower_call/property_get/static_dispatch.rs
  • crates/perry-codegen/src/native_value/verify.rs
  • crates/perry-codegen/src/native_value/verify/abi.rs
  • crates/perry-codegen/src/native_value/verify/layout.rs
  • crates/perry-codegen/src/native_value/verify/raw_f64.rs
  • crates/perry-codegen/src/runtime_decls/stdlib_ffi/data_stores.rs
  • crates/perry-codegen/src/runtime_decls/stdlib_ffi/language_core.rs
  • crates/perry-codegen/src/runtime_decls/stdlib_ffi/net_http.rs
  • crates/perry-codegen/src/runtime_decls/stdlib_ffi/streams_events.rs
  • crates/perry-codegen/src/runtime_decls/stdlib_ffi/third_party.rs
  • crates/perry-codegen/src/runtime_decls/stdlib_ffi/utilities.rs
  • crates/perry-codegen/src/runtime_decls/stdlib_ffi/web.rs
  • crates/perry-codegen/src/type_analysis.rs
  • crates/perry-codegen/src/type_analysis/numeric.rs
  • crates/perry-codegen/src/type_analysis/pod.rs
  • crates/perry-codegen/src/type_analysis/predicates.rs
  • crates/perry-codegen/src/type_analysis/refine.rs
  • crates/perry-codegen/src/type_analysis/strings.rs
  • crates/perry-ext-http/src/lib.rs
  • crates/perry-hir/src/destructuring/mod.rs
  • crates/perry-hir/src/destructuring/var_decl/alias_tracking.rs
  • crates/perry-hir/src/destructuring/var_decl/binding_guards.rs
  • crates/perry-hir/src/destructuring/var_decl/native_fetch.rs
  • crates/perry-hir/src/destructuring/var_decl/native_new.rs
  • crates/perry-hir/src/destructuring/var_decl/type_infer.rs
  • crates/perry-hir/src/lower/closure_analysis.rs
  • crates/perry-hir/src/lower/context.rs
  • crates/perry-hir/src/lower/decorators.rs
  • crates/perry-hir/src/lower/expr_call/intrinsics.rs
  • crates/perry-hir/src/lower/expr_call/intrinsics/apply_call.rs
  • crates/perry-hir/src/lower/expr_call/intrinsics/bare_builtins.rs
  • crates/perry-hir/src/lower/expr_call/intrinsics/eval_strict.rs
  • crates/perry-hir/src/lower/expr_call/intrinsics/namespace_static.rs
  • crates/perry-hir/src/lower/expr_call/intrinsics/native_arena.rs
  • crates/perry-hir/src/lower/expr_call/intrinsics/precompile_wasm.rs
  • crates/perry-hir/src/lower/expr_call/intrinsics/require.rs
  • crates/perry-hir/src/lower/expr_member.rs
  • crates/perry-hir/src/lower/expr_member/native_dispatch.rs
  • crates/perry-hir/src/lower/expr_member/private_guard.rs
  • crates/perry-hir/src/lower/expr_member/process_literals.rs
  • crates/perry-hir/src/lower/expr_member/process_props.rs
  • crates/perry-hir/src/lower/expr_member/stdlib_guard.rs
  • crates/perry-hir/src/lower/expr_new.rs
  • crates/perry-hir/src/lower/expr_new/helpers.rs
  • crates/perry-hir/src/lower/expr_new/member.rs
  • crates/perry-hir/src/lower/expr_new/non_ident.rs
  • crates/perry-hir/src/lower/expr_object.rs
  • crates/perry-hir/src/lower/lower_expr.rs
  • crates/perry-hir/src/lower/lower_expr/arm_bin.rs
  • crates/perry-hir/src/lower/lower_expr/arm_class.rs
  • crates/perry-hir/src/lower/lower_expr/arm_ident.rs
  • crates/perry-hir/src/lower/lower_expr/arm_optchain.rs
  • crates/perry-hir/src/lower/lower_expr/arm_unary.rs
  • crates/perry-hir/src/lower/lower_expr/assignment.rs
  • crates/perry-hir/src/lower/lower_expr/helpers.rs
  • crates/perry-hir/src/lower/lower_expr/reactive_text.rs
  • crates/perry-hir/src/lower/misc.rs
  • crates/perry-hir/src/lower/module_decl.rs
  • crates/perry-hir/src/lower/module_decl/namespace.rs
  • crates/perry-hir/src/lower/module_decl/native_default_import.rs
  • crates/perry-hir/src/lower/pre_scan.rs
  • crates/perry-hir/src/lower/shared_mutable_capture.rs
  • crates/perry-hir/src/lower/stmt.rs
  • crates/perry-hir/src/lower/template.rs
  • crates/perry-hir/src/lower/widget_decl.rs
  • crates/perry-hir/src/lower/widget_decl/reactive_animate.rs
  • crates/perry-hir/src/lower_decl/block.rs
  • crates/perry-hir/src/lower_decl/mod.rs
  • crates/perry-hir/src/lower_types.rs
  • crates/perry-hir/src/lower_types/extract.rs
  • crates/perry-runtime/src/array/from_concat.rs
  • crates/perry-runtime/src/buffer/header.rs
  • crates/perry-runtime/src/buffer/mod.rs
  • crates/perry-runtime/src/buffer/view.rs
  • crates/perry-runtime/src/child_process/builder.rs
  • crates/perry-runtime/src/child_process/emitter.rs
  • crates/perry-runtime/src/child_process/exec.rs
  • crates/perry-runtime/src/child_process/mod.rs
  • crates/perry-runtime/src/child_process/options.rs
  • crates/perry-runtime/src/child_process/output.rs
  • crates/perry-runtime/src/child_process/registry.rs
  • crates/perry-runtime/src/child_process/signals.rs
  • crates/perry-runtime/src/child_process/value_util.rs
  • crates/perry-runtime/src/closure/dispatch/bound.rs
  • crates/perry-runtime/src/closure/dispatch/calln.rs
  • crates/perry-runtime/src/closure/dispatch/errors.rs
  • crates/perry-runtime/src/closure/dispatch/validate.rs
  • crates/perry-runtime/src/closure/dispatch/value_call.rs
  • crates/perry-runtime/src/dgram.rs
  • crates/perry-runtime/src/dgram/ffi.rs
  • crates/perry-runtime/src/dgram/listeners.rs
  • crates/perry-runtime/src/dgram/net.rs
  • crates/perry-runtime/src/dgram/ops.rs
  • crates/perry-runtime/src/dgram/thunks.rs
  • crates/perry-runtime/src/dns.rs
  • crates/perry-runtime/src/dns/ffi.rs
  • crates/perry-runtime/src/dns/records.rs
  • crates/perry-runtime/src/dns/resolve_build.rs
  • crates/perry-runtime/src/fs/dir_glob_watch.rs
  • crates/perry-runtime/src/fs/dir_glob_watch/glob.rs
  • crates/perry-runtime/src/fs/dir_glob_watch/opendir.rs
  • crates/perry-runtime/src/fs/dir_glob_watch/watch.rs
  • crates/perry-runtime/src/fs/errors.rs
  • crates/perry-runtime/src/fs/fd_sync_ops.rs
  • crates/perry-runtime/src/fs/mod.rs
  • crates/perry-runtime/src/gc/copying.rs
  • crates/perry-runtime/src/gc/cycle.rs
  • crates/perry-runtime/src/gc/mod.rs
  • crates/perry-runtime/src/gc/tests/triggers.rs
  • crates/perry-runtime/src/intl.rs
  • crates/perry-runtime/src/intl/date_collator.rs
  • crates/perry-runtime/src/intl/list_relative_plural.rs
  • crates/perry-runtime/src/intl/number_format.rs
  • crates/perry-runtime/src/intl/number_format_options.rs
  • crates/perry-runtime/src/intl/segmenter.rs
  • crates/perry-runtime/src/json/mod.rs
  • crates/perry-runtime/src/json/replacer.rs
  • crates/perry-runtime/src/json/stringify.rs
  • crates/perry-runtime/src/json/stringify_scalars.rs
  • crates/perry-runtime/src/json/stringify_tojson_probe.rs
  • crates/perry-runtime/src/map.rs
  • crates/perry-runtime/src/node_stream_compose_live.rs
  • crates/perry-runtime/src/node_stream_constructors.rs
  • crates/perry-runtime/src/node_stream_constructors/builders.rs
  • crates/perry-runtime/src/node_stream_constructors/introspection.rs
  • crates/perry-runtime/src/node_stream_constructors/pipeline.rs
  • crates/perry-runtime/src/node_stream_constructors/web_adapter.rs
  • crates/perry-runtime/src/node_stream_dispatch.rs
  • crates/perry-runtime/src/node_stream_duplex_methods.rs
  • crates/perry-runtime/src/node_stream_iter_helpers.rs
  • crates/perry-runtime/src/node_stream_json.rs
  • crates/perry-runtime/src/node_stream_keys.rs
  • crates/perry-runtime/src/node_stream_pipeline.rs
  • crates/perry-runtime/src/node_stream_readwrite.rs
  • crates/perry-runtime/src/object/class_meta_registry.rs
  • crates/perry-runtime/src/object/class_registry.rs
  • crates/perry-runtime/src/object/class_registry/class_meta.rs
  • crates/perry-runtime/src/object/class_registry/construct.rs
  • crates/perry-runtime/src/object/class_registry/dispatch.rs
  • crates/perry-runtime/src/object/class_registry/gc_roots.rs
  • crates/perry-runtime/src/object/class_registry/parent_static.rs
  • crates/perry-runtime/src/object/class_registry/prototype_methods.rs
  • crates/perry-runtime/src/object/class_registry/prototype_objects.rs
  • crates/perry-runtime/src/object/class_registry/registration.rs
  • crates/perry-runtime/src/object/class_registry/state.rs
  • crates/perry-runtime/src/object/descriptor_state.rs
  • crates/perry-runtime/src/object/field_get_set.rs
  • crates/perry-runtime/src/object/global_this.rs
  • crates/perry-runtime/src/object/global_this/bigint_promise.rs
  • crates/perry-runtime/src/object/global_this/builtin_thunks.rs
  • crates/perry-runtime/src/object/mod.rs
  • crates/perry-runtime/src/object/native_call_method/collection_methods.rs
  • crates/perry-runtime/src/object/native_call_method/common_methods.rs
  • crates/perry-runtime/src/object/native_call_method/disposal.rs
  • crates/perry-runtime/src/object/native_call_method/handle_methods.rs
  • crates/perry-runtime/src/object/native_call_method/object_proto.rs
  • crates/perry-runtime/src/object/native_call_method/primitive_methods.rs
  • crates/perry-runtime/src/object/native_call_method/proto_dispatch.rs
  • crates/perry-runtime/src/object/native_call_method/string_methods.rs
  • crates/perry-runtime/src/object/native_call_method/typed_array.rs
  • crates/perry-runtime/src/object/native_module.rs
  • crates/perry-runtime/src/object/native_module/callable_export_check.rs
  • crates/perry-runtime/src/object/native_module/callable_exports.rs
  • crates/perry-runtime/src/object/native_module/constants.rs
  • crates/perry-runtime/src/object/native_module/module_keys.rs
  • crates/perry-runtime/src/object/native_module/namespace_builders.rs
  • crates/perry-runtime/src/object/native_module/web_locks.rs
  • crates/perry-runtime/src/object/object_ops.rs
  • crates/perry-runtime/src/object/object_ops/define_properties.rs
  • crates/perry-runtime/src/object/this_binding.rs
  • crates/perry-runtime/src/object/to_string_tag.rs
  • crates/perry-runtime/src/process.rs
  • crates/perry-runtime/src/process/env_misc.rs
  • crates/perry-runtime/src/process/finalization.rs
  • crates/perry-runtime/src/process/node_module.rs
  • crates/perry-runtime/src/process/permission.rs
  • crates/perry-runtime/src/process/report.rs
  • crates/perry-runtime/src/promise/then.rs
  • crates/perry-runtime/src/proxy/reflect_misc.rs
  • crates/perry-runtime/src/regex/exec.rs
  • crates/perry-runtime/src/regex/match_string.rs
  • crates/perry-runtime/src/symbol.rs
  • crates/perry-runtime/src/symbol/constructors.rs
  • crates/perry-runtime/src/symbol/gc_roots.rs
  • crates/perry-runtime/src/symbol/get.rs
  • crates/perry-runtime/src/symbol/iterator.rs
  • crates/perry-runtime/src/symbol/properties.rs
  • crates/perry-runtime/src/temporal/plain_date_time.rs
  • crates/perry-runtime/src/temporal/plain_time.rs
  • crates/perry-runtime/src/temporal/plain_year_month.rs
  • crates/perry-runtime/src/typedarray/access.rs
  • crates/perry-runtime/src/typedarray/construct.rs
  • crates/perry-runtime/src/typedarray/iterate.rs
  • crates/perry-runtime/src/typedarray/mod.rs
  • crates/perry-runtime/src/typedarray/slice_ops.rs
  • crates/perry-runtime/src/typedarray/transform.rs
  • crates/perry-runtime/src/url/node_compat.rs
  • crates/perry-stdlib/src/common/dispatch.rs
  • crates/perry-stdlib/src/common/dispatch/fastify_net_zlib.rs
  • crates/perry-stdlib/src/common/dispatch/init.rs
  • crates/perry-stdlib/src/common/dispatch/sqlite.rs
  • crates/perry-stdlib/src/crypto.rs
  • crates/perry-stdlib/src/events.rs
  • crates/perry-stdlib/src/events/events_on.rs
  • crates/perry-stdlib/src/events/module_helpers.rs
  • crates/perry-stdlib/src/events/once_helpers.rs
  • crates/perry-stdlib/src/framework/multipart.rs
  • crates/perry-stdlib/src/sqlite.rs
  • crates/perry-stdlib/src/sqlite/backup.rs
  • crates/perry-stdlib/src/sqlite/better.rs
  • crates/perry-stdlib/src/sqlite/bind.rs
  • crates/perry-stdlib/src/sqlite/connection.rs
  • crates/perry-stdlib/src/sqlite/dispatch.rs
  • crates/perry-stdlib/src/sqlite/node_db.rs
  • crates/perry-stdlib/src/sqlite/node_stmt_session.rs
  • crates/perry-stdlib/src/sqlite/node_tag_store.rs
  • crates/perry-stdlib/src/sqlite/options.rs
  • crates/perry-stdlib/src/webcrypto.rs
  • crates/perry/src/commands/compile/cjs_wrap/detect.rs
  • crates/perry/src/commands/compile/cjs_wrap/extract_requires.rs
  • crates/perry/src/commands/compile/cjs_wrap/hoist_classes.rs
💤 Files with no reviewable changes (91)
  • crates/perry-codegen-wasm/src/emit/runtime_imports.rs
  • crates/perry-codegen/src/codegen/i64_spec.rs
  • crates/perry-codegen/src/codegen/boxed_locals.rs
  • crates/perry-runtime/src/fs/errors.rs
  • crates/perry-runtime/src/object/native_call_method/common_methods.rs
  • crates/perry-codegen-wasm/src/emit/ui_method_map.rs
  • crates/perry-stdlib/src/common/dispatch/sqlite.rs
  • crates/perry-codegen/src/codegen/closure.rs
  • crates/perry-runtime/src/closure/dispatch/validate.rs
  • crates/perry-runtime/src/typedarray/slice_ops.rs
  • crates/perry-runtime/src/buffer/header.rs
  • crates/perry-hir/src/lower/expr_member/stdlib_guard.rs
  • crates/perry-runtime/src/node_stream_duplex_methods.rs
  • crates/perry-runtime/src/typedarray/transform.rs
  • crates/perry-runtime/src/object/native_module/web_locks.rs
  • crates/perry-runtime/src/closure/dispatch/bound.rs
  • crates/perry-runtime/src/closure/dispatch/calln.rs
  • crates/perry-runtime/src/object/native_call_method/handle_methods.rs
  • crates/perry-runtime/src/object/class_registry/prototype_methods.rs
  • crates/perry-runtime/src/object/native_call_method/string_methods.rs
  • crates/perry-runtime/src/object/native_call_method/proto_dispatch.rs
  • crates/perry-stdlib/src/common/dispatch/fastify_net_zlib.rs
  • crates/perry-runtime/src/node_stream_compose_live.rs
  • crates/perry-runtime/src/closure/dispatch/errors.rs
  • crates/perry-hir/src/lower/expr_member/process_literals.rs
  • crates/perry-runtime/src/node_stream_json.rs
  • crates/perry-runtime/src/buffer/view.rs
  • crates/perry-runtime/src/typedarray/mod.rs
  • crates/perry-runtime/src/object/native_call_method/primitive_methods.rs
  • crates/perry/src/commands/compile/cjs_wrap/extract_requires.rs
  • crates/perry-codegen/src/codegen/func_registry.rs
  • crates/perry-runtime/src/object/native_call_method/object_proto.rs
  • crates/perry-runtime/src/process/env_misc.rs
  • crates/perry-runtime/src/node_stream_constructors.rs
  • crates/perry-runtime/src/object/class_registry/state.rs
  • crates/perry-runtime/src/object/native_call_method/collection_methods.rs
  • crates/perry-runtime/src/object/global_this/builtin_thunks.rs
  • crates/perry-runtime/src/regex/exec.rs
  • crates/perry-runtime/src/symbol/gc_roots.rs
  • crates/perry-stdlib/src/common/dispatch/init.rs
  • crates/perry-runtime/src/node_stream_keys.rs
  • crates/perry-runtime/src/object/class_registry/class_meta.rs
  • crates/perry-runtime/src/typedarray/iterate.rs
  • crates/perry-runtime/src/json/stringify_scalars.rs
  • crates/perry-hir/src/lower_decl/mod.rs
  • crates/perry-stdlib/src/common/dispatch.rs
  • crates/perry-runtime/src/object/class_registry/gc_roots.rs
  • crates/perry-runtime/src/object/native_call_method/typed_array.rs
  • crates/perry-runtime/src/fs/dir_glob_watch/watch.rs
  • crates/perry-runtime/src/json/stringify.rs
  • crates/perry-runtime/src/child_process/signals.rs
  • crates/perry-codegen-wasm/src/emit/mod.rs
  • crates/perry-hir/src/lower/lower_expr/assignment.rs
  • crates/perry-runtime/src/proxy/reflect_misc.rs
  • crates/perry-runtime/src/closure/dispatch/value_call.rs
  • crates/perry-runtime/src/process.rs
  • crates/perry-runtime/src/buffer/mod.rs
  • crates/perry-hir/src/lower/lower_expr/reactive_text.rs
  • crates/perry-runtime/src/object/class_meta_registry.rs
  • crates/perry/src/commands/compile/cjs_wrap/detect.rs
  • crates/perry-hir/src/lower/expr_member/native_dispatch.rs
  • crates/perry-runtime/src/process/permission.rs
  • crates/perry-runtime/src/object/global_this/bigint_promise.rs
  • crates/perry/src/commands/compile/cjs_wrap/hoist_classes.rs
  • crates/perry-runtime/src/process/report.rs
  • crates/perry-runtime/src/object/native_module/callable_export_check.rs
  • crates/perry-runtime/src/regex/match_string.rs
  • crates/perry-codegen-wasm/src/emit/compile.rs
  • crates/perry-runtime/src/object/native_call_method/disposal.rs
  • crates/perry-hir/src/lower/pre_scan.rs
  • crates/perry-hir/src/lower/lower_expr/arm_bin.rs
  • crates/perry-runtime/src/typedarray/construct.rs
  • crates/perry-runtime/src/map.rs
  • crates/perry-codegen/src/type_analysis/numeric.rs
  • crates/perry-runtime/src/promise/then.rs
  • crates/perry-hir/src/lower/expr_member.rs
  • crates/perry-hir/src/lower/widget_decl.rs
  • crates/perry-runtime/src/object/object_ops/define_properties.rs
  • crates/perry-runtime/src/symbol/iterator.rs
  • crates/perry-runtime/src/dgram/ffi.rs
  • crates/perry-runtime/src/object/to_string_tag.rs
  • crates/perry-runtime/src/fs/dir_glob_watch/opendir.rs
  • crates/perry-runtime/src/gc/tests/triggers.rs
  • crates/perry-ext-http/src/lib.rs
  • crates/perry-runtime/src/typedarray/access.rs
  • crates/perry-runtime/src/object/native_module/module_keys.rs
  • crates/perry-hir/src/lower/module_decl/native_default_import.rs
  • crates/perry-runtime/src/json/replacer.rs
  • crates/perry-runtime/src/process/finalization.rs
  • crates/perry-hir/src/lower/expr_call/intrinsics.rs
  • crates/perry-hir/src/lower/expr_new/non_ident.rs

@proggeramlug
proggeramlug merged commit c5b6100 into main Jul 21, 2026
27 checks passed
@proggeramlug
proggeramlug deleted the chore/warnings-mechanical-sweep branch July 21, 2026 11:16
proggeramlug pushed a commit that referenced this pull request Jul 30, 2026
… gate it (#6837)

* chore(warnings): sweep machine-fixable warnings via cargo fix --all-targets

Run `cargo fix --workspace --all-targets` now that the workspace test
targets compile again, so test-only imports are seen instead of pruned.

Clears 87 warnings: 74 unused_imports, 11 function_casts_as_integer (new
in rustc 1.95 — casting a function item straight to an integer), plus one
each of unused_mut and unused_variables.

Two things the tool could not do on its own:
- optimized_libs/tests.rs reached build_missing_prebuilt_ext_lib through
  `super::*`, so cargo fix pruned the re-export it needed. The test now
  imports the function from no_auto directly.
- 49 of the pruned imports were duplicate preambles introduced when
  commands/compile.rs was split into submodules after #6639.

* chore(warnings): drop 150 redundant `unsafe` blocks

rustc reports these as `unused_unsafe`: the block wraps code that needs no
unsafe context, so the marker hides the sites that do. rustc gives no
machine-applicable fix, so this was scripted off the diagnostic byte spans.

Where the block only held expressions or statements, the block goes with the
keyword. Where it held a top-level `let`, `use`, or item, only the keyword
goes and the braces stay — splicing those into the enclosing scope would
widen the binding and could silently re-resolve a later name. 106 blocks
removed, 44 kept as plain scoping blocks.

* chore(warnings): delete two self-declared extern "C" HTTP symbols

handle_dispatch.rs declares `js_node_http_res_write` and
`js_node_http_res_end` in an `extern "C"` block, but perry-ext-http-server
defines both itself (response.rs:1136 and response.rs:1393). Nothing calls
the declarations, so rustc reports them as dead functions.

Both signatures matched their definitions, so the deletion is a no-op at
link time. The other ~62 declarations in that block are used and stay for
now; they carry the same hazard — a local declaration of a symbol you also
define is never checked against the definition, which is how #6646 shipped
an ABI mismatch on `len: i64` vs `u32`. Tracked separately.

* chore(warnings): clear 101 dead_code warnings

Deletes refactor leftovers — helpers, thunks, fields and constants nothing
calls any more. Keeps, with a justified `#[allow(dead_code)]`, the GC
verifiers, the `#[cfg(test)]`-only helpers and the FFI keepalives that exist
to be reachable from generated code rather than from Rust.

No `#[no_mangle]` function is deleted, so no symbol the compiler emits calls
to can go missing at link time. The 11 deleted `extern "C"` items are
Rust-internal closure thunks addressed by function pointer, which rustc
tracks precisely.

Rebased from the triage done on 2026-07-18, so three sites needed fixing
against current main:
- `path::resolve_win32_str` is no longer dead — url/node_compat.rs calls it.
  Restored.
- `class_field_inline_guard_enabled` and `test_reset_class_field_inline_guard`
  arrived after that triage (#6802). Kept.
- The CGContext* declarations in widgets/chart.rs were already removed by
  #6646. Kept removed.

* chore(warnings): clear naming, visibility, unreachable and must-use warnings

Four triaged families, rebased onto current main:

- non_snake_case: the generated `thunk_<module>_<jsName>` wrappers keep the
  JS spelling on purpose, so the allow sits on the three thunk macros and the
  node_submodule thunks rather than on each site. Real Rust names renamed.
- private_interfaces / private_bounds: widen the leaked types to `pub(crate)`
  so the signature matches what callers can already reach.
- unreachable_patterns: 32 duplicate match arms. Each was checked against the
  arm that shadows it — all are literal repeats, none had a different body
  that the first arm was swallowing.
- unreachable_code: two `return js_throw(..)` where `js_throw` returns `!`.
- sqlite `Connection::set_limit` returned a discarded `Result`: propagated
  with `?` in connection.rs, and `let _` in dispatch.rs where the limit id is
  already validated.
- unused_doc_comments: 8 `///` comments on statements, which rustdoc drops.
- Four dead bindings whose right-hand side is pure, so the binding goes
  instead of getting an underscore.

Conflicts against main resolved in favour of main: perry-hir switched to
`crate::types::Type`, and object/mod.rs moved the transition cache into
`RuntimeState`.

* chore(warnings): clear the last 65 warnings — host scope is now clean

- objc2 deprecations: 17 `msg_send!` invocations were missing the comma
  between arguments, plus one `Retained::cast` swapped for the
  `cast_unchecked` the sibling widgets already use.
- Vacuous glob re-exports: `pub use child::*` where every item in the child
  is `pub(super)` re-exports nothing, which is what rustc was reporting.
  Narrowed each to the visibility it actually has — two to `pub(crate)`, six
  to a plain `use` — instead of silencing the lint.
- `native_proof_*` integration tests share one HIR builder toolkit and each
  file drives a subset, so the allow sits on the file with that reason.
- issue_4914_cluster_port_sharing.rs: its only test is gated to non-macOS
  unix; the helpers and imports now carry the same gate.
- `duplex_allow_half_open_defaults_true_and_honors_false_option` had no
  `#[test]`, so it had never run. Added.
- `test_seed_class_parent_closure_root` existed twice, both writing the same
  `CLASS_PARENT_CLOSURES` static. Deleted the unreachable copy.
- `WIDE_KEY_INDEX_CAPACITY` is a leftover of the 4-entry LRU that #6759 C1
  replaced with shape records.
- crash_log.rs took a shared reference to a `static mut` inside a signal
  handler; now `&raw const`.
- Two dead stores removed (`idx`, `adjusted_args_storage`). The third,
  `done` in publish, is kept with a comment: rustc is right that the store
  is never read, and that means the reconnect guard it feeds can never fire
  — a protocol question, not a lint one.
- Four test names de-camel-cased, one duplicated `#[test]` removed.

`cargo check --workspace --all-targets` now reports zero warnings for the
host-compatible scope. The cross-host UI crates (ios/tvos/watchos/visionos/
android/windows/gtk4) cannot be checked from macOS and are untouched.

* chore(warnings): clean the reduced-feature scope too

`perry` depends on perry-runtime with `default-features = false`, so
`cargo clippy -p perry --bins` — the product leg in CI — compiles a runtime
where regex-engine, diagnostics and temporal are off. Eleven items are live
under the workspace feature set and dead under that one, and the workspace
check never saw them.

Each is now gated at the item rather than silenced:
- `array_named_props_install_fresh` and `regex::utf16::utf16_index_to_byte`
  are called only from regex-engine modules; both, and the array re-export,
  carry that feature (the cross-gate shape regex/utf16.rs already documents).
- Four `fs::dir_glob_watch::glob` imports serve regex-engine-gated code and
  now match the `PathBuf` import next to them.
- The two `AllocatorMaintenance*` enums and `TemporalLocaleCtx` are built
  from `diagnostics` and `temporal` code respectively, so the allow applies
  only when that feature is off.
- publish's `done` allow moved to the function: a statement-level attribute
  does not affect `unused_assignments`.

Four scopes now report zero warnings: `--workspace --all-targets`,
`-p perry --bins`, `-p perry-runtime --no-default-features`, and
`-p perry-runtime -p perry-stdlib -p perry-runtime-static -p perry-stdlib-static`.

* ci: gate rustc warnings with -D warnings

Nothing stopped a PR from adding a warning: `lint` runs only
`cargo fmt --check`, and `clippy` exits non-zero only on the deny-level lints
in `[workspace.lints]`. The 96 unused imports this branch removed include 49
that reappeared within four days of #6639, from a file split that copied whole
import preambles into each new submodule — the gate is what stops that.

Two legs, because they compile different code. `perry` depends on
perry-runtime with `default-features = false`, so the product leg sees a
runtime with regex-engine, diagnostics and temporal off. The workspace leg
passes `--all-targets` so test and bench targets count.

Separate from the clippy job on purpose: clippy's warn-level lints stay
informational, rustc's do not. perry-ui-macos sits in the excluded scope
(this runs on ubuntu), so its warnings are not gated here.

* docs(changelog): key the warnings-sweep fragment to #6837

* chore(warnings): fix float_literal_f32_fallback under rustc 1.97.1

CI runs `dtolnay/rust-toolchain@stable`, which is 1.97.1 on the runners; the
local default stable here is 1.97.1's predecessor, 1.95.0, which does not have
this lint yet. `length(1.0)` in the TUI layout pass inferred `f32` by fallback
rather than by the `From<f64>` bound, which rustc is phasing out
(rust-lang/rust#154024). Spelling the literal `1.0_f32` says what was already
meant.

It was the only occurrence. All four scopes re-checked under 1.97.1 report
zero warnings.

* chore(warnings): silence the four warnings that only appear on Linux

The macOS host cannot see these; the first CI run on this branch found them.

`commands::sandbox_profile` is the #506 MVP, macOS-only by design — its only
caller is inside `#[cfg(target_os = "macos")]`, so off macOS all three of its
functions are unreachable. The module declaration now carries the same gate as
its caller instead of compiling into a build that can never call it. Verified
by flipping both cfgs to a target this host is not, and checking: no errors, no
warnings.

The Linux linker branch in `platform_cmd.rs` binds `let mut c`, but only the
`#[cfg(not(target_os = "linux"))]` cross-compile block mutates it, so building
on Linux the `mut` is dead. Scoped allow on the binding, which does apply to
`unused_mut` — verified by flipping the target and watching the warning
disappear.

* fix(runtime): restore `use std::path::Path` on non-unix targets

The import block read:

    #[cfg(unix)]
    use std::os::unix::fs::{MetadataExt, PermissionsExt};
    #[cfg(unix)]
    use std::os::unix::io::AsRawFd;
    use std::path::Path;

`cargo fix` deleted the unused `AsRawFd` line and left its `#[cfg(unix)]`
behind, which then applied to the `Path` import below it. Every unix host still
compiled; Windows failed with four `cannot find type Path` errors.

Swept the whole diff for the same shape — an attribute that outlived the item
it was written for — and this was the only one. The other new cfg/import
adjacencies are deliberate.

* fix: address warnings sweep review

* fix(warnings): clean regressions after main sync

* fix(workspace): restore container compose default build

* fix(gc): poll after allocating loop controls

* fix(warnings): remove redundant iterator unsafe block

* fix(warnings): remove redundant iterator unsafe block

---------

Co-authored-by: Ralph Küpper <ralph@skelpo.com>
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