aboutsummaryrefslogtreecommitdiff
path: root/crates/assists/src/handlers
diff options
context:
space:
mode:
authorLukas Wirth <[email protected]>2020-10-14 00:39:58 +0100
committerLukas Wirth <[email protected]>2020-10-14 00:43:56 +0100
commit03b77b03fefa4dc260b5a63223db253706d41ca8 (patch)
treed1be625f446431c12068bfdbd7ae162737671384 /crates/assists/src/handlers
parent0fb069c5b02072239891ce564feaa7d1890c6d6f (diff)
Fix stackoverflow in insert_use::recursive_merge
Diffstat (limited to 'crates/assists/src/handlers')
-rw-r--r--crates/assists/src/handlers/merge_imports.rs14
-rw-r--r--crates/assists/src/handlers/replace_qualified_name_with_use.rs17
2 files changed, 31 insertions, 0 deletions
diff --git a/crates/assists/src/handlers/merge_imports.rs b/crates/assists/src/handlers/merge_imports.rs
index fe33cee53..fd9c9e03c 100644
--- a/crates/assists/src/handlers/merge_imports.rs
+++ b/crates/assists/src/handlers/merge_imports.rs
@@ -73,6 +73,20 @@ mod tests {
73 use super::*; 73 use super::*;
74 74
75 #[test] 75 #[test]
76 fn test_merge_equal() {
77 check_assist(
78 merge_imports,
79 r"
80use std::fmt<|>::{Display, Debug};
81use std::fmt::{Display, Debug};
82",
83 r"
84use std::fmt::{Debug, Display};
85",
86 )
87 }
88
89 #[test]
76 fn test_merge_first() { 90 fn test_merge_first() {
77 check_assist( 91 check_assist(
78 merge_imports, 92 merge_imports,
diff --git a/crates/assists/src/handlers/replace_qualified_name_with_use.rs b/crates/assists/src/handlers/replace_qualified_name_with_use.rs
index e95b971a4..c50bc7604 100644
--- a/crates/assists/src/handlers/replace_qualified_name_with_use.rs
+++ b/crates/assists/src/handlers/replace_qualified_name_with_use.rs
@@ -124,6 +124,23 @@ mod tests {
124 use super::*; 124 use super::*;
125 125
126 #[test] 126 #[test]
127 fn test_replace_already_imported() {
128 check_assist(
129 replace_qualified_name_with_use,
130 r"use std::fs;
131
132fn main() {
133 std::f<|>s::Path
134}",
135 r"use std::fs;
136
137fn main() {
138 fs::Path
139}",
140 )
141 }
142
143 #[test]
127 fn test_replace_add_use_no_anchor() { 144 fn test_replace_add_use_no_anchor() {
128 check_assist( 145 check_assist(
129 replace_qualified_name_with_use, 146 replace_qualified_name_with_use,