Rust `Category.Binary` is a dead code
- Dominant language
- Python
- Stars
- 2.5k
- Forks
- 432
- PR merge metrics
- No merged PRs in 30d
Description
I just started reviewing the AI code to check if it is any good, and in the first few minutes I encountered a detail that it didn't do very well.
In the rust code, variable categories include `Binary`:
https://github.com/coin-or/pulp/blob/2fdb947b42944f4d58b136306624076d6ba571a1/pulp/rust/src/types.rs#L33-L40
But in the Python code, `cat=LpBinary` is just a shortcut for `lowBound=0, upBound=1, cat=LpInteger`, and in every Python constructor `LpBinary` is translated this way:
https://github.com/coin-or/pulp/blob/2fdb947b42944f4d58b136306624076d6ba571a1/pulp/core/lp_problem.py#L136-L138
So in particular, `LpBinary` is never passed to Rust. As this value never reaches the Rust code, it should not be declared. It only confuses the developer (and the AI too!) and unnecessarily complicates the code.
Note that I don't know Rust and I will probably catch only obvious errors like this. There are probably more hiding in there. This example really shows how the AI is just a "median of all the existing code" without any deeper understanding on how the particular system behaves.
Contributor guide
Research direction
Start in pulp/rust/src/types.rs at the category definitions, then inspect the Python conversion in pulp/core/lp_problem.py and search for other references to Binary. Run the existing Rust and Python test suites; the work is done when the unused Rust variant and any associated dead-code handling are removed without changing supported category behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, rust
- Domain
- backend
- Issue type
- Refactor
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 70/100