aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_assists/src/doc_tests/generated.rs
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2019-11-15 07:01:19 +0000
committerGitHub <[email protected]>2019-11-15 07:01:19 +0000
commit3ad11973ac7596323f085a9fcb9530e47f021c41 (patch)
tree15d397d8732ddd5511f85f45689fb5b32441e36f /crates/ra_assists/src/doc_tests/generated.rs
parenta6d080608db1bcc2a2f8fc586d8a5d3c85e50763 (diff)
parentcbc6f94573d7f4601b739e001de5d5f71ec9b552 (diff)
Merge #2165
2165: ra_assists: Add add_new assist r=matklad a=rep-nop 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. Not marking this as closing #1644 since there's a part 2 of adding autocompletion for when someone starts typing `[pub ]fn new(...` Co-authored-by: Wesley Norris <[email protected]>
Diffstat (limited to 'crates/ra_assists/src/doc_tests/generated.rs')
-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",