Skip to content

clippy: 33 deny lints + fix 2735 violations across workspace#31116

Merged
Jarred-Sumner merged 53 commits into
mainfrom
claude/clippy-deny-sweep
May 20, 2026
Merged

clippy: 33 deny lints + fix 2735 violations across workspace#31116
Jarred-Sumner merged 53 commits into
mainfrom
claude/clippy-deny-sweep

Conversation

@Jarred-Sumner

@Jarred-Sumner Jarred-Sumner commented May 20, 2026

Copy link
Copy Markdown
Collaborator

Adds 45 deny-level clippy lints + dead_code/unused_*/unreachable_* to [workspace.lints], a clippy.toml routing std::{fs,sync,collections,process,env} and println!/eprintln! through bun_* wrappers, and fixes the resulting violations across the workspace. Net −6.2K LOC of dead code.

Lint set

Soundness / leak preventionundocumented_unsafe_blocks, not_unsafe_ptr_arg_deref, mem_forget, cast_ptr_alignment, transmute_ptr_to_ptr, as_ptr_cast_mut, drop_non_drop, uninit_vec

Performanceredundant_clone, unnecessary_to_owned, needless_collect, or_fun_call, assigning_clones, implicit_clone, iter_overeager_cloned, map_clone, trivially_copy_pass_by_ref, large_types_passed_by_value, large_enum_variant, large_stack_frames, vec_init_then_push, format_collect, manual_memcpy, needless_pass_by_value

Clarityunnecessary_unwrap, derive_partial_eq_without_eq, derivable_impls, clone_on_ref_ptr, if_same_then_else, todo, unimplemented, dbg_macro, clone_on_copy, useless_conversion, manual_swap, mem_replace_option_with_none, redundant_locals, manual_c_str_literals, precedence, implicit_saturating_sub, ptr_eq

Disalloweddisallowed_{methods,types,macros} configured in clippy.toml: std::sync::{Mutex,RwLock} + parking_lot::*bun_threading; std::fs::*bun_sys; std::collections::Hash{Map,Set}bun_collections (wyhash); std::process::Commandbun_sys::process; println!/eprintln!bun_core::output; std::env::varbun_core::env; std::thread::spawnbun_threading; std::mem::zeroed banned.

rustcdead_code, unused_imports, unused_variables, unused_mut, unused_assignments, unused_macros, unreachable_code, unreachable_patterns denied workspace-wide. ~505 inline #[allow(unused/dead_code/unreachable_*)] attrs and ~90 crate-level #![allow(unused, ...)] words removed; the items they were hiding deleted or #[cfg]'d to the platform/profile they're live on.

31 default-warn lints explicitly allow'd (Zig-port style).

Notable fixes

  • 1,341 // SAFETY: comments added immediately above unsafe { blocks, each stating the actual invariant.
  • 156 not_unsafe_ptr_arg_deref: safe fn(p: *mut T) that deref punsafe fn with # Safety doc, or param changed to NonNull<T>/&T. generate-host-exports.ts already detected pub unsafe fn and wraps the thunk body — regenerated.
  • 47 mem_forgetManuallyDrop / Box::into_raw / Arc::into_raw / Box::leak. enum_map! (8 sites) replaced with EnumMap::from_fn.
  • 840 signature changes (trivially_copy_pass_by_ref + needless_pass_by_value + large_types_passed_by_value): &CopyCopy, owned-but-only-read → &T. All callers updated.
  • protocol::IsCompatible + calc_protocol_forwarders!: Browsers&Browsers.
  • SinkHandler/JsSinkType/impl_sink_handler!/VTable: data: StreamResult&StreamResult.
  • ParserLike::log(&self) -> &mut Log (mut_from_ref): replaced trait method with log_ptr(&self) -> NonNull<Log>.
  • tick_while_paused: &mut bool*const bool + read_volatile() — C++ writes through an aliased pointer during tick(), so &mut was an aliasing violation, not just a lint.
  • flush_category! (css border): 152KB stack frame → #[inline(never)] helpers.
  • cppbind.ts: &x as *const Tcore::ptr::from_ref; // SAFETY: above generated unsafe { raw::… } calls.
  • Dead-code deletions: ~650 lines of duplicate draft unicode.rs impls; ~500 lines of unused resolver/fs.rs types; ~250 lines shell_parser; ~180 lines package_json reverse-resolution; 256-line dead name_static; dead FFI extern decls (Rust→C++ imports nothing calls).
  • Platform/profile cfg-gating: ~60 files where an item is live only on one target/profile (#[cfg(target_os = ...)] / #[cfg(debug_assertions)]).

CI

  • .github/workflows/clippy.ymlbun run rust:clippy with inline PR annotations via .github/rust-matcher.json.
  • .github/workflows/miri.ymlbun run rust:miri (Tree Borrows) on the FFI-free crate set.

Exceptions (the only #![allow]s added)

  • build.rs: disallowed_{methods,types,macros} — build scripts run on the host before bun_* crates exist.
  • bun_alloc/lib.rs: disallowed_types — T0 foundation crate; bun_threading/bun_collections depend on it.
  • #[allow] inside macro_rules!/quote!{} bodies are preserved — they suppress lints in emitted code that varies per call site.

cargo clippy --workspace --no-deps: 0 errors. bun run rust:check-all: 10/10. bun bd: builds.

Loading
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.

3 participants