rust-analyzer/crates
bors ab62c0186f Auto merge of #15696 - rmehri01:14293_tuple_return_type_to_struct, r=Veykril
feat: implement tuple return type to tuple struct assist

This PR implements the `convert_tuple_return_type_to_struct` assist, for converting the return type of a function or method from a tuple to a tuple struct. Additionally, it moves the `to_camel_case` and `char_has_case` functions from `case_conv` to `stdx` so that they can be used similar to `to_lower_snake_case`.

[tuple_return_type_to_tuple_struct.webm](2803ff58-fde3-4144-9495-7c7c7e139075)

Currently, the assist puts the struct definition above the function, or above the nearest `impl` or `trait` if applicable and only rewrites literal tuples that are returned in the body of the function. Additionally, it only attempts to rewrite simple tuple pattern usages with the corresponding tuple struct pattern but does so across files and modules.

I think that this is sufficient for the majority of use cases but I could be wrong. One thing I'm still not sure how to approach is handling `Self` and generics/lifetimes in the tuple type to be extracted. I was thinking of either manually figuring out what lifetimes and generics are in scope and using them (sort of similar to the `generate_function` assist) or maybe using `ctx.sema.resolve_type` and `generic_params` on `hir::Type` but this seems to not deal with lifetimes.

Closes #14293
2023-10-09 08:14:42 +00:00
..
base-db minor: hover_simple refactor 2023-09-24 22:47:29 +02:00
cfg Fix cfg completions not working 2023-09-08 10:49:15 +02:00
flycheck Don't pass any target directory options to custom flycheck 2023-10-09 02:15:05 -05:00
hir Shrink PatPtr by swapping its AstPtr and Either wrap order 2023-10-06 12:32:37 +02:00
hir-def Auto merge of #15713 - Veykril:flyimport-completions-short, r=Veykril 2023-10-09 07:56:02 +00:00
hir-expand Allocate ast ids for parameters 2023-09-28 13:16:11 +02:00
hir-ty Auto merge of #15696 - rmehri01:14293_tuple_return_type_to_struct, r=Veykril 2023-10-09 08:14:42 +00:00
ide Remove repetitive words 2023-10-05 19:40:41 +08:00
ide-assists Auto merge of #15696 - rmehri01:14293_tuple_return_type_to_struct, r=Veykril 2023-10-09 08:14:42 +00:00
ide-completion Do flyimport completions by prefix search for short paths 2023-10-05 13:21:12 +02:00
ide-db Auto merge of #15713 - Veykril:flyimport-completions-short, r=Veykril 2023-10-09 07:56:02 +00:00
ide-diagnostics Shrink PatPtr by swapping its AstPtr and Either wrap order 2023-10-06 12:32:37 +02:00
ide-ssr Merge commit '9b3d03408c' into sync-from-ra 2023-08-21 12:44:09 +03:00
intern refactor: fix clippy lints 2023-09-15 16:43:21 +09:00
limit Merge commit 'aa9bc86125' into sync-from-ra 2023-06-05 12:04:23 +03:00
load-cargo Merge commit '37f84c101b' into sync-from-ra 2023-07-17 16:49:15 +03:00
mbe Remove repetitive words 2023-10-05 19:40:41 +08:00
parser Recover better on missing parameter in param list 2023-09-29 12:50:16 +02:00
paths Merge commit '37f84c101b' into sync-from-ra 2023-07-17 16:49:15 +03:00
proc-macro-api Upgrade Object and related deps 2023-08-14 23:05:45 +08:00
proc-macro-srv Upgrade Object and related deps 2023-08-14 23:05:45 +08:00
proc-macro-srv-cli Merge commit 'aa9bc86125' into sync-from-ra 2023-06-05 12:04:23 +03:00
proc-macro-test proc-macro-test: Pass target to cargo invocation 2023-08-02 17:57:13 -07:00
profile Merge commit '9b3d03408c' into sync-from-ra 2023-08-21 12:44:09 +03:00
project-model Add dedicated target_dir field to CargoConfig and FlycheckConfig 2023-10-09 02:15:05 -05:00
rust-analyzer Addressed PR style comments 2023-10-09 02:15:05 -05:00
rustc-dependencies Add mock description to rustc-dependencies 2023-10-03 17:32:57 +03:00
sourcegen Merge commit '37f84c101b' into sync-from-ra 2023-07-17 16:49:15 +03:00
stdx move to_camel_case and char_has_case from case_conv to stdx 2023-09-30 08:04:04 -07:00
syntax Shrink PatPtr by swapping its AstPtr and Either wrap order 2023-10-06 12:32:37 +02:00
test-utils Fix unused_variables in tests 2023-09-24 23:45:36 +03:30
text-edit Merge commit 'aa9bc86125' into sync-from-ra 2023-06-05 12:04:23 +03:00
toolchain ⬆️ rust-analyzer 2023-03-13 10:42:24 +02:00
tt Merge commit 'baee6b338b' into sync-from-ra 2023-08-07 12:03:15 +03:00
vfs Ensure resolved hint's file exists 2023-09-02 18:28:36 +03:00
vfs-notify Update notify to 6.1.1 2023-09-04 18:00:12 +02:00