This commit is contained in:
nora 2023-04-11 12:32:44 +02:00
parent e5c5f6082e
commit 8d06708e6c

View file

@ -54,19 +54,20 @@ First, it applies the pass to everything in the file. If that stops the reproduc
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)
# Cookbook
## Normal project with ICE on `cargo build`
@ -88,6 +89,7 @@ Possible improvements:
## Use a full script
`script.sh`
```sh
#!/usr/bin/env bash
@ -108,3 +110,18 @@ fi
```
`cargo minimize --script-path ./script.sh`
## License
Licensed under either of
- Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or https://www.apache.org/licenses/LICENSE-2.0)
- MIT license ([LICENSE-MIT](LICENSE-MIT) or https://opensource.org/licenses/MIT)
at your option.
### Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the
work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any
additional terms or conditions.