`imports_granularity = "Module"` doesn't work if module path is too long
Open
Nobody has claimed this yet.
C-bug
only-with-option
UO-imports_granularity
- Dominant language
- Rust
- Stars
- 7k
- Forks
- 1.1k
- Avg merge
- 2d 13h
- Merged PRs (30d)
- 24
Description
Repro steps
- Add the following inputs to
tests/source/5131_module.rs. - Execute
cargo test test::system_testsand get output.
case 1. correct
Input:
use foo::{
Foo,
bar::Bar,
};
Output:
use foo::bar::Bar;
use foo::Foo;
case 2. wrong
Input:
use foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo::{
Foo,
bar::Bar,
};
Output:
use foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo::{
Foo,
bar::Bar,
};
Expected:
use foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo::bar::Bar;
use foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo::Foo;
case 3. wrong
Input:
use x::fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo::{
Foo,
bar::Bar,
};
Output:
use x::fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo::{
Foo,
bar::Bar,
};
Expected:
use x::fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo::bar::Bar;
use x::fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo::Foo;
Link: #4991
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
Start with tests/source/5131_module.rs and run cargo test test::system_tests using the three long-module-path cases described here. Done means imports_granularity = "Module" produces separate imports for Foo and bar::Bar in cases 2 and 3, matching the expected output.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100