From f016d8b900792c8ae4fce268920edea3035b6559 Mon Sep 17 00:00:00 2001 From: Piotr Szpetkowski Date: Fri, 27 Mar 2020 17:28:25 +0100 Subject: Fix merge-imports assist for wildcard imports --- crates/ra_assists/src/handlers/merge_imports.rs | 28 +++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'crates/ra_assists/src') diff --git a/crates/ra_assists/src/handlers/merge_imports.rs b/crates/ra_assists/src/handlers/merge_imports.rs index 9c57d1e30..5d4b74e56 100644 --- a/crates/ra_assists/src/handlers/merge_imports.rs +++ b/crates/ra_assists/src/handlers/merge_imports.rs @@ -170,6 +170,34 @@ use std::{fmt::<|>{Display, Debug}}; ); } + #[test] + fn test_merge_single_wildcard_diff_prefixes() { + check_assist( + merge_imports, + r" +use std<|>::cell::*; +use std::str; +", + r" +use std<|>::{cell::*, str}; +", + ) + } + + #[test] + fn test_merge_both_wildcard_diff_prefixes() { + check_assist( + merge_imports, + r" +use std<|>::cell::*; +use std::str::*; +", + r" +use std<|>::{cell::*, str::*}; +", + ) + } + #[test] fn removes_just_enough_whitespace() { check_assist( -- cgit v1.2.3