mirror of
https://github.com/Noratrieb/cargo-minimize.git
synced 2026-01-14 16:35:01 +01:00
add what it does
This commit is contained in:
parent
e918248016
commit
5c1170e92e
1 changed files with 20 additions and 1 deletions
19
README.md
19
README.md
|
|
@ -28,3 +28,22 @@ Options:
|
|||
-h, --help Print help information
|
||||
```
|
||||
|
||||
|
||||
## What it does
|
||||
|
||||
`cargo-minimize` is currently fairly simple. It does several passes over the source code. It treats each file in isolation.
|
||||
First, it applies the pass to everything in the file. If that stops the reproduction, it goes down the tree, eventually trying each candidate
|
||||
in isolation. It then repeats the pass until no more changes are made by it.
|
||||
|
||||
The currently implemented passes are the following:
|
||||
- `pub` is replaced by `pub(crate)`. This does not have a real minimization effect on its own.
|
||||
- Bodies are replaced by `loop {}`. This greatly cuts down on the amount of things and makes many functions unused
|
||||
- Unused imports are removed
|
||||
- Unused functions are removed (this relies on the first step, as `pub` items are not marked as `dead_code` by rustc)
|
||||
|
||||
Possible improvements:
|
||||
- Delete more kinds of unused items
|
||||
- Inline small modules
|
||||
- Deal with dependencies (there is experimental code in the repo that inlines them)
|
||||
- Somehow deal with traits
|
||||
- Integrate more fine-grained minimization tools such as `DustMite` or [`perses`](https://github.com/uw-pluverse/perses)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue