Two different modes:
- Serialize the full Config object. This is useful as
`Config::default().to_toml()` to output a rustfmt.toml with defaults
(#317).
- Serialize only the options that have been accessed. This could be
useful to output a minimal rustfmt.toml for a project. (If the
default value of any unused config item changes, you'll then get the
new default when you come to use it).
This commit doesn't expose this anywhere - deciding a sensible CLI is a
bit trickier.
This commit also has very simple error reporting (Result<String,
String>) - once the CLI is decided, a more sensible method of reporting
errors might become obvious.
* Canonicalize file paths within the map of file line ranges
* Forgot to run the tests - and of course, the formatting of the canonicalization change was off, but it's fixed now!
* Move imports to the top of the file, as per @nrc.
* Change `canonicalize_path_string` to return `Option<String>`, `None` indicating an error rather than an empty string
* `format!` is better than string concatenation...
* Change `canonicalize_path_string` to return `Result` rather than `Option`
This commit adds a type to represent lines in files, and adds it to the
`Config` struct. It will be used for restricting formatting to specific
lines.
Refs #434