swagger-api / swagger-api/swagger-codegen
[Rust] Lots of unused import warnings
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Description
When building Rust APIs there are a lot of warnings about unused imports. They are noisy and clutter up the build process.
Swagger-codegen version
Any recent.
Swagger declaration file content or url
I have been working from https://esi.evetech.net/latest/swagger.json?datasource=tranquility .
Command line used for generation
Any normal -l rust command line.
Steps to reproduce
Generate the Rust API from above. Run cargo build. Notice the warnings.
Related issues/PRs
None noted.
Suggest a fix/enhancement
The easiest fix, which seems completely harmless in this case, is to stick #![allow(unused)] at the start of the appropriate files: at least api.mustache and model_mod.mustache. Probably also get rid of the unused import of HashMap in model_mod.mustache.
One could try to be more selective about which imports are generated, but it hardly seems worth it.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the Rust templates api.mustache and model_mod.mustache, then reproduce the issue by generating an API with the provided Swagger declaration and running cargo build. Check the generated output for unused import warnings, including the HashMap import in model_mod.mustache. Done means the generated Rust API builds without the reported unused-import warnings.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100