aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_assists/src/doc_tests
diff options
context:
space:
mode:
authorWesley Norris <[email protected]>2019-11-09 15:56:36 +0000
committerWesley Norris <[email protected]>2019-11-09 15:56:36 +0000
commitcbc6f94573d7f4601b739e001de5d5f71ec9b552 (patch)
treeee481bcf679e739dfea13ec36b16fb593607e43a /crates/ra_assists/src/doc_tests
parent9d786ea221b27fbdf7c7f7beea0290db448e0611 (diff)
Add add_new assist
Adds a new assist to autogenerate a new fn based on the selected struct, excluding tuple structs and unions. The fn will inherit the same visibility as the struct and the assist will attempt to reuse any existing impl blocks that exist at the same level of struct.
Diffstat (limited to 'crates/ra_assists/src/doc_tests')
-rw-r--r--crates/ra_assists/src/doc_tests/generated.rs22
1 files changed, 22 insertions, 0 deletions
diff --git a/crates/ra_assists/src/doc_tests/generated.rs b/crates/ra_assists/src/doc_tests/generated.rs
index 1bee76f59..176761efb 100644
--- a/crates/ra_assists/src/doc_tests/generated.rs
+++ b/crates/ra_assists/src/doc_tests/generated.rs
@@ -157,6 +157,28 @@ fn process(map: HashMap<String, String>) {}
157} 157}
158 158
159#[test] 159#[test]
160fn doctest_add_new() {
161 check(
162 "add_new",
163 r#####"
164struct Ctx<T: Clone> {
165 data: T,<|>
166}
167"#####,
168 r#####"
169struct Ctx<T: Clone> {
170 data: T,
171}
172
173impl<T: Clone> Ctx<T> {
174 fn new(data: T) -> Self { Self { data } }
175}
176
177"#####,
178 )
179}
180
181#[test]
160fn doctest_apply_demorgan() { 182fn doctest_apply_demorgan() {
161 check( 183 check(
162 "apply_demorgan", 184 "apply_demorgan",