Remove dead code from bun_router
Closed
RO
3mo ago+33+33+01234567890123456789-137-137-012345678901234567890123456789
Dead-code sweep of src/router/lib.rs. Each removed item has zero references across src/, build/debug/codegen/, src/codegen/, src/js/, and packages/ (verified with rg -w). None are #[no_mangle]/extern "C", none appear in any .classes.ts, and none are referenced by string name.
| Item | Why it's dead |
|---|---|
RouteConfig::from_loaded_routes | Zig fromLoadedRoutes; its only caller was the old dev-server config loader which goes through from_api in Rust |
Router::get_public_paths | Zig getPublicPaths; no Rust caller |
Router::route_index_by_hash | Zig routeIndexByHash; no Rust caller |
TinyPtr::to_string_pointer | Zig toStringPointer; no Rust caller |
type RoutePtr = TinyPtr | unused alias (Route.Ptr in Zig, moved to module level for the port, never referenced) |
Match::params_iterator | Zig paramsIterator; Rust filesystem_router.rs builds params via PathnameScanner directly |
Match::name_with_basename | Zig nameWithBasename; no Rust caller |
RouteIndexList::items_public_path | cascade: only caller was get_public_paths |
RouteIndexList::items_hash | cascade: only caller was route_index_by_hash (the other items_hash hits in the tree are on the watcher's unrelated SoA types) |
RouteIndexList.public_path / .hash columns, RouteIndex.public_path / .hash fields | cascade: write-only once both accessors are gone |
Routes.index_id field | cascade: only reader was route_index_by_hash's INDEX_ROUTE_HASH fast path (the load_all local of the same name stays; it feeds dynamic_len) |
Route.public_path field | cascade: only reader was the RouteIndex push in load_all; the index-route arm's DirnameStore append existed only to populate it |
api::StringPointer re-export, PathnameScanner import | cascade: orphaned by to_string_pointer / params_iterator |
Verification
rg -w <symbol>across the full repo returns only the definition for each primary itemcargo check -p bun_routerandcargo check -p bun_bundlerpass, including--target x86_64-pc-windows-msvc(a#[cfg(windows)]debug_assert block was touched)bun run rust:check-all:bun_routerchecks clean on all 10 targets (thebun_jscbuild-script failure there is pre-existing on main, unrelated to this change)bun bdbuildsbun bd test test/js/bun/util/filesystem_router.test.ts: 29 passbun bd test test/bake/framework-router.test.ts: 35 pass
No test added: this is pure dead-code removal with no observable behavior change, so there is no fail-before case a regression test could cover. The existing router suites above exercise every surviving code path.
Net: -102 lines.