diff options
author | Laurențiu Nicola <[email protected]> | 2020-06-23 07:41:43 +0100 |
---|---|---|
committer | Laurențiu Nicola <[email protected]> | 2020-06-23 14:51:07 +0100 |
commit | 76ddface089886c88b8b29e3893119f38ef26aab (patch) | |
tree | 9df8e5f774a385d64669f3883a9fef1b6aebb9a2 /crates/ra_assists/src | |
parent | 98c3e4e887dcc5a8242c3e67c04a3cedbb1b9c58 (diff) |
Fix panic in split and merge import assists
Diffstat (limited to 'crates/ra_assists/src')
-rw-r--r-- | crates/ra_assists/src/handlers/merge_imports.rs | 12 | ||||
-rw-r--r-- | crates/ra_assists/src/handlers/split_import.rs | 10 |
2 files changed, 21 insertions, 1 deletions
diff --git a/crates/ra_assists/src/handlers/merge_imports.rs b/crates/ra_assists/src/handlers/merge_imports.rs index 972d16241..ac0b3035c 100644 --- a/crates/ra_assists/src/handlers/merge_imports.rs +++ b/crates/ra_assists/src/handlers/merge_imports.rs | |||
@@ -127,7 +127,7 @@ fn first_path(path: &ast::Path) -> ast::Path { | |||
127 | 127 | ||
128 | #[cfg(test)] | 128 | #[cfg(test)] |
129 | mod tests { | 129 | mod tests { |
130 | use crate::tests::check_assist; | 130 | use crate::tests::{check_assist, check_assist_not_applicable}; |
131 | 131 | ||
132 | use super::*; | 132 | use super::*; |
133 | 133 | ||
@@ -276,4 +276,14 @@ bar::baz}; | |||
276 | ", | 276 | ", |
277 | ) | 277 | ) |
278 | } | 278 | } |
279 | |||
280 | #[test] | ||
281 | fn test_empty_use() { | ||
282 | check_assist_not_applicable( | ||
283 | merge_imports, | ||
284 | r" | ||
285 | use std::<|> | ||
286 | fn main() {}", | ||
287 | ); | ||
288 | } | ||
279 | } | 289 | } |
diff --git a/crates/ra_assists/src/handlers/split_import.rs b/crates/ra_assists/src/handlers/split_import.rs index c7a874480..38aa199a0 100644 --- a/crates/ra_assists/src/handlers/split_import.rs +++ b/crates/ra_assists/src/handlers/split_import.rs | |||
@@ -66,4 +66,14 @@ mod tests { | |||
66 | fn issue4044() { | 66 | fn issue4044() { |
67 | check_assist_not_applicable(split_import, "use crate::<|>:::self;") | 67 | check_assist_not_applicable(split_import, "use crate::<|>:::self;") |
68 | } | 68 | } |
69 | |||
70 | #[test] | ||
71 | fn test_empty_use() { | ||
72 | check_assist_not_applicable( | ||
73 | split_import, | ||
74 | r" | ||
75 | use std::<|> | ||
76 | fn main() {}", | ||
77 | ); | ||
78 | } | ||
69 | } | 79 | } |