Allow merging of multiple selected imports.

The selected imports have to have a common prefix in paths.

Before
```rust
$0use std::fmt::Display;
use std::fmt::Debug;$0
```
After
```rust
use std::fmt::{Display, Debug};
```
This commit is contained in:
iDawer 2022-06-02 23:15:55 +05:00
parent 88024c7ec2
commit ea8899a445
2 changed files with 148 additions and 31 deletions

View file

@ -30,6 +30,8 @@ impl MergeBehavior {
}
}
/// Merge `rhs` into `lhs` keeping both intact.
/// Returned AST is mutable.
pub fn try_merge_imports(
lhs: &ast::Use,
rhs: &ast::Use,
@ -51,6 +53,8 @@ pub fn try_merge_imports(
Some(lhs)
}
/// Merge `rhs` into `lhs` keeping both intact.
/// Returned AST is mutable.
pub fn try_merge_trees(
lhs: &ast::UseTree,
rhs: &ast::UseTree,