Fix edge case for ImportGranularity guessing

This commit is contained in:
Lukas Wirth 2021-06-08 22:14:30 +02:00
parent 590472607c
commit 31aad2528f
3 changed files with 30 additions and 8 deletions

View file

@ -660,6 +660,13 @@ fn guess_item() {
r"
use foo::bar::baz;
use foo::bar::qux;
",
ImportGranularityGuess::Item,
);
check_guess(
r"
use foo::bar::Bar;
use foo::baz;
",
ImportGranularityGuess::Item,
);
@ -679,6 +686,14 @@ use foo::bar::{qux, quux};
r"
use foo::bar::baz;
use foo::{baz::{qux, quux}, bar};
",
ImportGranularityGuess::Module,
);
check_guess(
r"
use foo::bar::Bar;
use foo::baz::Baz;
use foo::{Foo, Qux};
",
ImportGranularityGuess::Module,
);