Remove dead code from bun_router

Closed
RO
3mo ago
+33-137

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.

ItemWhy it's dead
RouteConfig::from_loaded_routesZig fromLoadedRoutes; its only caller was the old dev-server config loader which goes through from_api in Rust
Router::get_public_pathsZig getPublicPaths; no Rust caller
Router::route_index_by_hashZig routeIndexByHash; no Rust caller
TinyPtr::to_string_pointerZig toStringPointer; no Rust caller
type RoutePtr = TinyPtrunused alias (Route.Ptr in Zig, moved to module level for the port, never referenced)
Match::params_iteratorZig paramsIterator; Rust filesystem_router.rs builds params via PathnameScanner directly
Match::name_with_basenameZig nameWithBasename; no Rust caller
RouteIndexList::items_public_pathcascade: only caller was get_public_paths
RouteIndexList::items_hashcascade: 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 fieldscascade: write-only once both accessors are gone
Routes.index_id fieldcascade: 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 fieldcascade: 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 importcascade: orphaned by to_string_pointer / params_iterator

Verification

  • rg -w <symbol> across the full repo returns only the definition for each primary item
  • cargo check -p bun_router and cargo check -p bun_bundler pass, including --target x86_64-pc-windows-msvc (a #[cfg(windows)] debug_assert block was touched)
  • bun run rust:check-all: bun_router checks clean on all 10 targets (the bun_jsc build-script failure there is pre-existing on main, unrelated to this change)
  • bun bd builds
  • bun bd test test/js/bun/util/filesystem_router.test.ts: 29 pass
  • bun 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.