diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-04-23 14:37:48 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2021-04-23 14:37:48 +0100 |
commit | 85bab7539a050bb2c0eeae93b029ebde2aa48668 (patch) | |
tree | 3ebc0618f8525327ce83addec3ada6ea120f46be /crates/ide_assists/src/tests | |
parent | 07fb65abb83c1e06fbdb8b3616ede59921d70f8c (diff) | |
parent | 5e765895cf6fea42649a846c0297d95a9aa7b162 (diff) |
Merge #8317
8317: Convert tuple struct to named struct assist r=Veykril a=unexge
Closes https://github.com/rust-analyzer/rust-analyzer/issues/8192
Co-authored-by: unexge <[email protected]>
Diffstat (limited to 'crates/ide_assists/src/tests')
-rw-r--r-- | crates/ide_assists/src/tests/generated.rs | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/crates/ide_assists/src/tests/generated.rs b/crates/ide_assists/src/tests/generated.rs index 41559b43a..59bcef8fb 100644 --- a/crates/ide_assists/src/tests/generated.rs +++ b/crates/ide_assists/src/tests/generated.rs | |||
@@ -292,6 +292,47 @@ fn main() { | |||
292 | } | 292 | } |
293 | 293 | ||
294 | #[test] | 294 | #[test] |
295 | fn doctest_convert_tuple_struct_to_named_struct() { | ||
296 | check_doc_test( | ||
297 | "convert_tuple_struct_to_named_struct", | ||
298 | r#####" | ||
299 | struct Point$0(f32, f32); | ||
300 | |||
301 | impl Point { | ||
302 | pub fn new(x: f32, y: f32) -> Self { | ||
303 | Point(x, y) | ||
304 | } | ||
305 | |||
306 | pub fn x(&self) -> f32 { | ||
307 | self.0 | ||
308 | } | ||
309 | |||
310 | pub fn y(&self) -> f32 { | ||
311 | self.1 | ||
312 | } | ||
313 | } | ||
314 | "#####, | ||
315 | r#####" | ||
316 | struct Point { field1: f32, field2: f32 } | ||
317 | |||
318 | impl Point { | ||
319 | pub fn new(x: f32, y: f32) -> Self { | ||
320 | Point { field1: x, field2: y } | ||
321 | } | ||
322 | |||
323 | pub fn x(&self) -> f32 { | ||
324 | self.field1 | ||
325 | } | ||
326 | |||
327 | pub fn y(&self) -> f32 { | ||
328 | self.field2 | ||
329 | } | ||
330 | } | ||
331 | "#####, | ||
332 | ) | ||
333 | } | ||
334 | |||
335 | #[test] | ||
295 | fn doctest_expand_glob_import() { | 336 | fn doctest_expand_glob_import() { |
296 | check_doc_test( | 337 | check_doc_test( |
297 | "expand_glob_import", | 338 | "expand_glob_import", |