Skip to content

Clean up unused public APIs #105

@GiggleLiu

Description

@GiggleLiu

Summary

Audit identified ~50 unused or test-only public APIs across the codebase. These add maintenance burden, clutter documentation, and inflate the public API surface without providing value.

Tier 0: Completely Dead (0 uses anywhere) — Delete

Kind Item Location
fn MappingResult::print_config() src/rules/unitdiskmapping/ksg/mapping.rs:88
fn MappingResult::print_config_flat() src/rules/unitdiskmapping/ksg/mapping.rs:136
ctor LinearConstraint::new() src/models/optimization/ilp.rs:139 — shadowed by ::le/::ge/::eq (make pub(crate))
ctor MaximumSetPacking::new() src/models/set/maximum_set_packing.rs:63 — only ::with_weights is ever used
ctor MinimumSetCovering::new() src/models/set/minimum_set_covering.rs:70 — only ::with_weights is ever used
fn apply_weighted_gadget_boxed_fn() src/rules/unitdiskmapping/ksg/gadgets.rs:1647 — dead wrapper
fn apply_triangular_simplifier_gadgets() + 4 try_apply_dangling_leg_* helpers src/rules/unitdiskmapping/triangular/mod.rs:1221 — dead reimplementation
type MatchedEntry src/rules/graph.rs:1097 — pub struct in private scope, never named externally
type LegacySourceCell src/rules/unitdiskmapping/triangular/mod.rs:96 — "legacy" enum
type TriangularTapeEntry src/rules/unitdiskmapping/triangular/mod.rs:57 — internal only
type NeighborInfo src/rules/graph.rs:222 — re-exported but 0 consumers
type ReductionChain src/rules/graph.rs:1111 — return type of uncalled method

Tier 1: Test-Only (0 production callers) — Remove or make pub(crate)

Kind Item Location Notes
type+ctor ConfigIterator src/config.rs:7 Superseded by DimsIterator
fn HyperGraph::edges_containing() src/topology/hypergraph.rs:113 1 test use
fn HyperGraph::max_edge_size() src/topology/hypergraph.rs:130 1 test use
fn to_json_compact() src/io.rs:101 1 test use
fn read_file() / write_file() src/io.rs:113,123 1 test use each
type FileFormat + from_extension() src/io.rs:14,23 test-only
ctor ILPSolver::with_time_limit() src/solvers/ilp/solver.rs:43 1 test use; ::new() has 100 uses
ctor SpinGlass::from_graph_without_fields() src/models/optimization/spin_glass.rs:125 1 test use
ctor BicliqueCover::from_matrix() src/models/specialized/biclique_cover.rs:73 1 test use; ::new has 20 uses
ctor BoolVar::new() src/rules/sat_maximumindependentset.rs:29 test-only; production uses ::from_literal
fn VarBounds::non_negative() src/models/optimization/ilp.rs:48 1 test use
fn MaximumMatching::set_weights() src/models/graph/maximum_matching.rs:147 1 test use
fn TravelingSalesman::set_weights() src/models/graph/traveling_salesman.rs:96 1 test use
fn MinimumDominatingSet::closed_neighborhood() src/models/graph/minimum_dominating_set.rs:80 1 test use
fn KingsSubgraph::num_positions() src/topology/kings_subgraph.rs:39 1 test use
fn TriangularSubgraph::num_positions() src/topology/triangular_subgraph.rs:42 1 test use
type GraphTestCase / SatTestCase src/testing/mod.rs:85,145 testing framework never used outside own tests
type ComplexityClass src/registry/info.rs:40 re-exported at crate root, 0 real uses
type ProblemInfo src/registry/info.rs:111 re-exported at crate root, 0 real uses

Tier 2: Weakly Used (2-3 test uses only) — Consider removing

Kind Item Location Notes
fn PaintShop::num_sequence() src/models/specialized/paintshop.rs:123 redundant alias for sequence_len()
fn BicliqueCover::count_covered_edges() src/models/specialized/biclique_cover.rs:187 2 test uses
fn UnitDiskGraph::bounding_box() src/topology/unit_disk_graph.rs:147 2 test uses
fn HyperGraph::to_graph_edges() src/topology/hypergraph.rs:141 2 test uses
fn is_diff_by_const() src/rules/unitdiskmapping/alpha_tensor.rs:211 2 test uses
fn SpinGlass::without_fields() src/models/optimization/spin_glass.rs:90 3 test uses
fn MaxCut::edge_weight_by_index() / edge_weight() src/models/graph/max_cut.rs:120,125 3 test uses each
fn BMF::is_exact() src/models/specialized/bmf.rs:179 3 test uses

Tier 3: Dead modules/subsystems

Module Location Notes
truth_table src/truth_table.rs pub(crate), all 11 methods test-only, no production code path
testing src/testing/mod.rs GraphTestCase, SatTestCase, macros — all unused outside own unit tests
io file ops src/io.rs read_file, write_file, to_json_compact, FileFormat — none used in CLI or examples

Approach

  • Tier 0: Delete dead code, make LinearConstraint::new pub(crate)
  • Tier 1: Remove items or downgrade to pub(crate), update tests accordingly
  • Tier 2: Case-by-case decision — some may be worth keeping for API completeness
  • Tier 3: Evaluate whether entire modules should be removed or kept for future use

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions