diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-10-14 11:15:51 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2020-10-14 11:15:51 +0100 |
commit | 69f1c8aa6ebc9c3137c77b9ed01d2f14d0f95100 (patch) | |
tree | d1be625f446431c12068bfdbd7ae162737671384 /crates/assists/src/handlers | |
parent | 0fb069c5b02072239891ce564feaa7d1890c6d6f (diff) | |
parent | 03b77b03fefa4dc260b5a63223db253706d41ca8 (diff) |
Merge #6222
6222: Fix stackoverflow in insert_use::recursive_merge r=matklad a=Veykril
Fixes #6221.
#6108 shouldn't be related to this as autocompletion doesn't depend on this code.
Co-authored-by: Lukas Wirth <[email protected]>
Diffstat (limited to 'crates/assists/src/handlers')
-rw-r--r-- | crates/assists/src/handlers/merge_imports.rs | 14 | ||||
-rw-r--r-- | crates/assists/src/handlers/replace_qualified_name_with_use.rs | 17 |
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" | ||
80 | use std::fmt<|>::{Display, Debug}; | ||
81 | use std::fmt::{Display, Debug}; | ||
82 | ", | ||
83 | r" | ||
84 | use 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 | |||
132 | fn main() { | ||
133 | std::f<|>s::Path | ||
134 | }", | ||
135 | r"use std::fs; | ||
136 | |||
137 | fn 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, |