Configure `cargo fmt` for consistent formatting of imports
- Dominant language
- Rust
- Stars
- 9.3k
- Forks
- 2.4k
- Avg merge
- 3d 7h
- Merged PRs (30d)
- 344
Description
**Is your feature request related to a problem or challenge? Please describe what you are trying to do.**
Our imports are very inconsistent and are not currently formatted by `cargo fmt` other than reordering within groups.
**Describe the solution you'd like**
I would like to add a `rustfmt.toml` with these settings:
``` toml
merge_imports = true
group_imports = "StdExternalCrate"
```
Here is an example of imports formatted with these settings, using the command `cargo +nightly fmt`:
```rust
use std::{
collections::{HashMap, HashSet},
convert::TryFrom,
fmt::{Display, Formatter},
sync::Arc,
};
use arrow::{
compute::can_cast_types,
datatypes::{DataType, Field, Schema, SchemaRef},
};
use crate::{
error::{DataFusionError, Result, SchemaError},
field_not_found, Column,
};
```
To minimize disruption, we could do this one crate or module at a time.
**Describe alternatives you've considered**
None
**Additional context**
None
Contributor guide
Research direction
Start by reviewing the repository's crate and module layout, then check how `cargo +nightly fmt` formats the existing imports. Add a `rustfmt.toml` with the proposed settings and apply it one crate or module at a time; done means imports are consistently grouped and formatted without unnecessary disruption.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100