rust-lang / rust-lang/rust-clippy
Group imports from the same crate
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 13.5k
- Forks
- 2.2k
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 32
Description
What it does
If two imports from the same crates are done using two different use keywords, clippy should suggest the user to group these using brackets.
Advantage
Make the code cleaner by being able to identify the dependencies from a given crate.
Drawbacks
Using different lines for different modules should be allowed; for instance:
use std::io::Write;
use std::time::Instant;
In this example, using two lines makes sense since io and time are two different modules.
Example
use std::io::Read;
use std::io::Write;
Could be written as:
use std::io::{Read, Write};
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No implementation files or tests are named. Start by locating Clippy's existing import-related lint entry points and tests, then compare them with the separate-module example in this issue. Done means suggesting grouped braces for repeated imports from one crate while leaving imports from different modules separate.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- devtools, tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100