chloro
chloro is a minimal Rust code formatter.
Motivation
For when you want to format two source files in a consistent way, as fast as possible.
How it works
Using rowan from the rust-analyzer project, which can give both green and red trees. The latter are notoriously expensive, but a formatter should only need the former.
Proof of concept library/CLI to explore a fast and low memory code formatter [WIP], with use cases of code diffing in mind.
Rustfmt Conformance
Diff 'leaderboard' for how well formatting with chloro matches rustfmt, as tested on rust-analyzer's crates:
| Top 5 Removed Lines | Top 5 Added Lines |
|---|---|
- } × 154- { × 135- }, × 93- ); × 87- /// × 72 |
+} × 75+/// × 75+ }, × 65+ } × 65+}; × 44 |
Top 20 Most Impacted Files
Installation
Add chloro to your Cargo.toml:
[]
= "0.5"
CLI Installation
- pre-built binary:
cargo binstall chloro(requires cargo-binstall), - build from source:
cargo install chloro --features cli
License
This project is licensed under either of:
- Apache License, Version 2.0, (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.