chore(warnings): sweep mechanical Rust warnings and drop blanket #[allow(unused_imports)] - #6639
Conversation
📝 WalkthroughWalkthroughThis 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. ChangesRepository-wide Rust cleanup
Estimated code review effort: 3 (Moderate) | ~25 minutes Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 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 |
0ef5601 to
902f045
Compare
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.
902f045 to
0b1835a
Compare
There was a problem hiding this comment.
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 winConsolidate 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 bylower_global_builtin_static_value(ctx, "Object", property). You can safely remove this block and simply add"hasOwn"to thematches!list forObjectabove (lines 83-102).Similarly, consider reusing
lower_global_builtin_static_value(if its implementation is generic) or extracting a shared helper forError,ArrayBuffer,Uint8Array,SubtleCrypto, andMathto eliminate the extensive duplicated boilerplate. The same applies to the native module property lookups forconsoleandprocess, 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
📒 Files selected for processing (294)
crates/perry-codegen-wasm/src/emit/compile.rscrates/perry-codegen-wasm/src/emit/mod.rscrates/perry-codegen-wasm/src/emit/runtime_imports.rscrates/perry-codegen-wasm/src/emit/ui_method_map.rscrates/perry-codegen/src/codegen/boxed_locals.rscrates/perry-codegen/src/codegen/closure.rscrates/perry-codegen/src/codegen/closure_collect.rscrates/perry-codegen/src/codegen/func_registry.rscrates/perry-codegen/src/codegen/function.rscrates/perry-codegen/src/codegen/i64_spec.rscrates/perry-codegen/src/codegen/method_registry.rscrates/perry-codegen/src/codegen/mod.rscrates/perry-codegen/src/codegen/module_globals_emit.rscrates/perry-codegen/src/collectors/mod.rscrates/perry-codegen/src/expr/array_methods.rscrates/perry-codegen/src/expr/array_push.rscrates/perry-codegen/src/expr/arrays_finds.rscrates/perry-codegen/src/expr/bigint_set.rscrates/perry-codegen/src/expr/binary.rscrates/perry-codegen/src/expr/buffer_access.rscrates/perry-codegen/src/expr/call_spread.rscrates/perry-codegen/src/expr/calls.rscrates/perry-codegen/src/expr/calls/crypto_hash.rscrates/perry-codegen/src/expr/calls/crypto_kdf.rscrates/perry-codegen/src/expr/calls/crypto_keys.rscrates/perry-codegen/src/expr/calls/crypto_misc.rscrates/perry-codegen/src/expr/calls/fs.rscrates/perry-codegen/src/expr/calls/helpers.rscrates/perry-codegen/src/expr/child_proc.rscrates/perry-codegen/src/expr/closure.rscrates/perry-codegen/src/expr/compare.rscrates/perry-codegen/src/expr/conditional.rscrates/perry-codegen/src/expr/dispatch.rscrates/perry-codegen/src/expr/dyn_extern_i18n.rscrates/perry-codegen/src/expr/env_clones.rscrates/perry-codegen/src/expr/fs_await.rscrates/perry-codegen/src/expr/index_get.rscrates/perry-codegen/src/expr/index_set.rscrates/perry-codegen/src/expr/instance_misc1.rscrates/perry-codegen/src/expr/js_runtime.rscrates/perry-codegen/src/expr/literals_vars.rscrates/perry-codegen/src/expr/logical_collections.rscrates/perry-codegen/src/expr/math_simple.rscrates/perry-codegen/src/expr/misc_methods.rscrates/perry-codegen/src/expr/mod.rscrates/perry-codegen/src/expr/new_dynamic.rscrates/perry-codegen/src/expr/objects_arrays_lit.rscrates/perry-codegen/src/expr/os_uri_dates.rscrates/perry-codegen/src/expr/property_get.rscrates/perry-codegen/src/expr/property_get/generic_dispatch.rscrates/perry-codegen/src/expr/property_get/globalget.rscrates/perry-codegen/src/expr/property_get/helpers.rscrates/perry-codegen/src/expr/property_set.rscrates/perry-codegen/src/expr/proxy_reflect.rscrates/perry-codegen/src/expr/record_value.rscrates/perry-codegen/src/expr/shadow_slot.rscrates/perry-codegen/src/expr/static_field_meta.rscrates/perry-codegen/src/expr/static_method.rscrates/perry-codegen/src/expr/string_regex_proc.rscrates/perry-codegen/src/expr/super_method.rscrates/perry-codegen/src/expr/this_super_call.rscrates/perry-codegen/src/expr/unary.rscrates/perry-codegen/src/expr/url_main.rscrates/perry-codegen/src/lower_call/mod.rscrates/perry-codegen/src/lower_call/new.rscrates/perry-codegen/src/lower_call/omitted_native_params.rscrates/perry-codegen/src/lower_call/property_get.rscrates/perry-codegen/src/lower_call/property_get/dynamic_dispatch.rscrates/perry-codegen/src/lower_call/property_get/fetch_chain.rscrates/perry-codegen/src/lower_call/property_get/helpers.rscrates/perry-codegen/src/lower_call/property_get/map_set.rscrates/perry-codegen/src/lower_call/property_get/number_string.rscrates/perry-codegen/src/lower_call/property_get/promise_chain.rscrates/perry-codegen/src/lower_call/property_get/static_dispatch.rscrates/perry-codegen/src/native_value/verify.rscrates/perry-codegen/src/native_value/verify/abi.rscrates/perry-codegen/src/native_value/verify/layout.rscrates/perry-codegen/src/native_value/verify/raw_f64.rscrates/perry-codegen/src/runtime_decls/stdlib_ffi/data_stores.rscrates/perry-codegen/src/runtime_decls/stdlib_ffi/language_core.rscrates/perry-codegen/src/runtime_decls/stdlib_ffi/net_http.rscrates/perry-codegen/src/runtime_decls/stdlib_ffi/streams_events.rscrates/perry-codegen/src/runtime_decls/stdlib_ffi/third_party.rscrates/perry-codegen/src/runtime_decls/stdlib_ffi/utilities.rscrates/perry-codegen/src/runtime_decls/stdlib_ffi/web.rscrates/perry-codegen/src/type_analysis.rscrates/perry-codegen/src/type_analysis/numeric.rscrates/perry-codegen/src/type_analysis/pod.rscrates/perry-codegen/src/type_analysis/predicates.rscrates/perry-codegen/src/type_analysis/refine.rscrates/perry-codegen/src/type_analysis/strings.rscrates/perry-ext-http/src/lib.rscrates/perry-hir/src/destructuring/mod.rscrates/perry-hir/src/destructuring/var_decl/alias_tracking.rscrates/perry-hir/src/destructuring/var_decl/binding_guards.rscrates/perry-hir/src/destructuring/var_decl/native_fetch.rscrates/perry-hir/src/destructuring/var_decl/native_new.rscrates/perry-hir/src/destructuring/var_decl/type_infer.rscrates/perry-hir/src/lower/closure_analysis.rscrates/perry-hir/src/lower/context.rscrates/perry-hir/src/lower/decorators.rscrates/perry-hir/src/lower/expr_call/intrinsics.rscrates/perry-hir/src/lower/expr_call/intrinsics/apply_call.rscrates/perry-hir/src/lower/expr_call/intrinsics/bare_builtins.rscrates/perry-hir/src/lower/expr_call/intrinsics/eval_strict.rscrates/perry-hir/src/lower/expr_call/intrinsics/namespace_static.rscrates/perry-hir/src/lower/expr_call/intrinsics/native_arena.rscrates/perry-hir/src/lower/expr_call/intrinsics/precompile_wasm.rscrates/perry-hir/src/lower/expr_call/intrinsics/require.rscrates/perry-hir/src/lower/expr_member.rscrates/perry-hir/src/lower/expr_member/native_dispatch.rscrates/perry-hir/src/lower/expr_member/private_guard.rscrates/perry-hir/src/lower/expr_member/process_literals.rscrates/perry-hir/src/lower/expr_member/process_props.rscrates/perry-hir/src/lower/expr_member/stdlib_guard.rscrates/perry-hir/src/lower/expr_new.rscrates/perry-hir/src/lower/expr_new/helpers.rscrates/perry-hir/src/lower/expr_new/member.rscrates/perry-hir/src/lower/expr_new/non_ident.rscrates/perry-hir/src/lower/expr_object.rscrates/perry-hir/src/lower/lower_expr.rscrates/perry-hir/src/lower/lower_expr/arm_bin.rscrates/perry-hir/src/lower/lower_expr/arm_class.rscrates/perry-hir/src/lower/lower_expr/arm_ident.rscrates/perry-hir/src/lower/lower_expr/arm_optchain.rscrates/perry-hir/src/lower/lower_expr/arm_unary.rscrates/perry-hir/src/lower/lower_expr/assignment.rscrates/perry-hir/src/lower/lower_expr/helpers.rscrates/perry-hir/src/lower/lower_expr/reactive_text.rscrates/perry-hir/src/lower/misc.rscrates/perry-hir/src/lower/module_decl.rscrates/perry-hir/src/lower/module_decl/namespace.rscrates/perry-hir/src/lower/module_decl/native_default_import.rscrates/perry-hir/src/lower/pre_scan.rscrates/perry-hir/src/lower/shared_mutable_capture.rscrates/perry-hir/src/lower/stmt.rscrates/perry-hir/src/lower/template.rscrates/perry-hir/src/lower/widget_decl.rscrates/perry-hir/src/lower/widget_decl/reactive_animate.rscrates/perry-hir/src/lower_decl/block.rscrates/perry-hir/src/lower_decl/mod.rscrates/perry-hir/src/lower_types.rscrates/perry-hir/src/lower_types/extract.rscrates/perry-runtime/src/array/from_concat.rscrates/perry-runtime/src/buffer/header.rscrates/perry-runtime/src/buffer/mod.rscrates/perry-runtime/src/buffer/view.rscrates/perry-runtime/src/child_process/builder.rscrates/perry-runtime/src/child_process/emitter.rscrates/perry-runtime/src/child_process/exec.rscrates/perry-runtime/src/child_process/mod.rscrates/perry-runtime/src/child_process/options.rscrates/perry-runtime/src/child_process/output.rscrates/perry-runtime/src/child_process/registry.rscrates/perry-runtime/src/child_process/signals.rscrates/perry-runtime/src/child_process/value_util.rscrates/perry-runtime/src/closure/dispatch/bound.rscrates/perry-runtime/src/closure/dispatch/calln.rscrates/perry-runtime/src/closure/dispatch/errors.rscrates/perry-runtime/src/closure/dispatch/validate.rscrates/perry-runtime/src/closure/dispatch/value_call.rscrates/perry-runtime/src/dgram.rscrates/perry-runtime/src/dgram/ffi.rscrates/perry-runtime/src/dgram/listeners.rscrates/perry-runtime/src/dgram/net.rscrates/perry-runtime/src/dgram/ops.rscrates/perry-runtime/src/dgram/thunks.rscrates/perry-runtime/src/dns.rscrates/perry-runtime/src/dns/ffi.rscrates/perry-runtime/src/dns/records.rscrates/perry-runtime/src/dns/resolve_build.rscrates/perry-runtime/src/fs/dir_glob_watch.rscrates/perry-runtime/src/fs/dir_glob_watch/glob.rscrates/perry-runtime/src/fs/dir_glob_watch/opendir.rscrates/perry-runtime/src/fs/dir_glob_watch/watch.rscrates/perry-runtime/src/fs/errors.rscrates/perry-runtime/src/fs/fd_sync_ops.rscrates/perry-runtime/src/fs/mod.rscrates/perry-runtime/src/gc/copying.rscrates/perry-runtime/src/gc/cycle.rscrates/perry-runtime/src/gc/mod.rscrates/perry-runtime/src/gc/tests/triggers.rscrates/perry-runtime/src/intl.rscrates/perry-runtime/src/intl/date_collator.rscrates/perry-runtime/src/intl/list_relative_plural.rscrates/perry-runtime/src/intl/number_format.rscrates/perry-runtime/src/intl/number_format_options.rscrates/perry-runtime/src/intl/segmenter.rscrates/perry-runtime/src/json/mod.rscrates/perry-runtime/src/json/replacer.rscrates/perry-runtime/src/json/stringify.rscrates/perry-runtime/src/json/stringify_scalars.rscrates/perry-runtime/src/json/stringify_tojson_probe.rscrates/perry-runtime/src/map.rscrates/perry-runtime/src/node_stream_compose_live.rscrates/perry-runtime/src/node_stream_constructors.rscrates/perry-runtime/src/node_stream_constructors/builders.rscrates/perry-runtime/src/node_stream_constructors/introspection.rscrates/perry-runtime/src/node_stream_constructors/pipeline.rscrates/perry-runtime/src/node_stream_constructors/web_adapter.rscrates/perry-runtime/src/node_stream_dispatch.rscrates/perry-runtime/src/node_stream_duplex_methods.rscrates/perry-runtime/src/node_stream_iter_helpers.rscrates/perry-runtime/src/node_stream_json.rscrates/perry-runtime/src/node_stream_keys.rscrates/perry-runtime/src/node_stream_pipeline.rscrates/perry-runtime/src/node_stream_readwrite.rscrates/perry-runtime/src/object/class_meta_registry.rscrates/perry-runtime/src/object/class_registry.rscrates/perry-runtime/src/object/class_registry/class_meta.rscrates/perry-runtime/src/object/class_registry/construct.rscrates/perry-runtime/src/object/class_registry/dispatch.rscrates/perry-runtime/src/object/class_registry/gc_roots.rscrates/perry-runtime/src/object/class_registry/parent_static.rscrates/perry-runtime/src/object/class_registry/prototype_methods.rscrates/perry-runtime/src/object/class_registry/prototype_objects.rscrates/perry-runtime/src/object/class_registry/registration.rscrates/perry-runtime/src/object/class_registry/state.rscrates/perry-runtime/src/object/descriptor_state.rscrates/perry-runtime/src/object/field_get_set.rscrates/perry-runtime/src/object/global_this.rscrates/perry-runtime/src/object/global_this/bigint_promise.rscrates/perry-runtime/src/object/global_this/builtin_thunks.rscrates/perry-runtime/src/object/mod.rscrates/perry-runtime/src/object/native_call_method/collection_methods.rscrates/perry-runtime/src/object/native_call_method/common_methods.rscrates/perry-runtime/src/object/native_call_method/disposal.rscrates/perry-runtime/src/object/native_call_method/handle_methods.rscrates/perry-runtime/src/object/native_call_method/object_proto.rscrates/perry-runtime/src/object/native_call_method/primitive_methods.rscrates/perry-runtime/src/object/native_call_method/proto_dispatch.rscrates/perry-runtime/src/object/native_call_method/string_methods.rscrates/perry-runtime/src/object/native_call_method/typed_array.rscrates/perry-runtime/src/object/native_module.rscrates/perry-runtime/src/object/native_module/callable_export_check.rscrates/perry-runtime/src/object/native_module/callable_exports.rscrates/perry-runtime/src/object/native_module/constants.rscrates/perry-runtime/src/object/native_module/module_keys.rscrates/perry-runtime/src/object/native_module/namespace_builders.rscrates/perry-runtime/src/object/native_module/web_locks.rscrates/perry-runtime/src/object/object_ops.rscrates/perry-runtime/src/object/object_ops/define_properties.rscrates/perry-runtime/src/object/this_binding.rscrates/perry-runtime/src/object/to_string_tag.rscrates/perry-runtime/src/process.rscrates/perry-runtime/src/process/env_misc.rscrates/perry-runtime/src/process/finalization.rscrates/perry-runtime/src/process/node_module.rscrates/perry-runtime/src/process/permission.rscrates/perry-runtime/src/process/report.rscrates/perry-runtime/src/promise/then.rscrates/perry-runtime/src/proxy/reflect_misc.rscrates/perry-runtime/src/regex/exec.rscrates/perry-runtime/src/regex/match_string.rscrates/perry-runtime/src/symbol.rscrates/perry-runtime/src/symbol/constructors.rscrates/perry-runtime/src/symbol/gc_roots.rscrates/perry-runtime/src/symbol/get.rscrates/perry-runtime/src/symbol/iterator.rscrates/perry-runtime/src/symbol/properties.rscrates/perry-runtime/src/temporal/plain_date_time.rscrates/perry-runtime/src/temporal/plain_time.rscrates/perry-runtime/src/temporal/plain_year_month.rscrates/perry-runtime/src/typedarray/access.rscrates/perry-runtime/src/typedarray/construct.rscrates/perry-runtime/src/typedarray/iterate.rscrates/perry-runtime/src/typedarray/mod.rscrates/perry-runtime/src/typedarray/slice_ops.rscrates/perry-runtime/src/typedarray/transform.rscrates/perry-runtime/src/url/node_compat.rscrates/perry-stdlib/src/common/dispatch.rscrates/perry-stdlib/src/common/dispatch/fastify_net_zlib.rscrates/perry-stdlib/src/common/dispatch/init.rscrates/perry-stdlib/src/common/dispatch/sqlite.rscrates/perry-stdlib/src/crypto.rscrates/perry-stdlib/src/events.rscrates/perry-stdlib/src/events/events_on.rscrates/perry-stdlib/src/events/module_helpers.rscrates/perry-stdlib/src/events/once_helpers.rscrates/perry-stdlib/src/framework/multipart.rscrates/perry-stdlib/src/sqlite.rscrates/perry-stdlib/src/sqlite/backup.rscrates/perry-stdlib/src/sqlite/better.rscrates/perry-stdlib/src/sqlite/bind.rscrates/perry-stdlib/src/sqlite/connection.rscrates/perry-stdlib/src/sqlite/dispatch.rscrates/perry-stdlib/src/sqlite/node_db.rscrates/perry-stdlib/src/sqlite/node_stmt_session.rscrates/perry-stdlib/src/sqlite/node_tag_store.rscrates/perry-stdlib/src/sqlite/options.rscrates/perry-stdlib/src/webcrypto.rscrates/perry/src/commands/compile/cjs_wrap/detect.rscrates/perry/src/commands/compile/cjs_wrap/extract_requires.rscrates/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
… 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>
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:
cargo fixmechanical sweep — removes unused imports, unnecessaryunsafeblocks, unusedmut/braces, and unused assignments.cargo fixhandles most of these;unused_unsafeis applied by a span-driven pass because rustc emits that lint without a machine-applicable suggestion (removing an unnecessaryunsafeblock is safe by definition — if it were needed, it would not be flagged).Drop 444 blanket
#[allow(unused_imports)]and prune — these attributes papered over duplicated import preambles in mechanically-split files. Removing them and re-runningcargo fixprunes 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
#[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 staleCompileOptionsfield reference inperry-codegen/tests/perry_builtin_name_collision.rs— is unrelated and already present onmain).Notes
Summary by CodeRabbit