rust/crates
bors 336608aa92 Auto merge of #13810 - tfpk:tfpk/macro-inline, r=Veykril
Add action to expand a declarative macro once, inline. Fixes #13598

This commit adds a new r-a method, `expandMacroInline`, which expands the macro that's currently selected. See  #13598 for the most applicable issue; though I suspect it'll resolve part of #5949 and make #11888 significantly easier).

The macro works like this:

![rust-analyser-feature](https://user-images.githubusercontent.com/10906982/208813167-3123e379-8fd5-4206-a4f4-5af1129565f9.gif)

I have 2 questions before this PR can be merged:

1. **Should we rustfmt the output?** The advantage of doing this is neater code. The disadvantages are we'd have to format the whole expr/stmt/block (since there's no point just formatting one part, especially over multiple lines), and maybe it moves the code around more in weird ways. My suggestion here is to start off by not doing any formatting; and if it appears useful we can decide to do formatting in a later release.
2.   **Is it worth solving the `$crate` hygiene issue now?** -- I think this PR is usable as of right now for some use-cases; but it is annoying that many common macros (i.e. `println!()`, `format!()`) can't be expanded further unless the user guesses the correct `$crate` value. The trouble with solving that issue is that I think it's complicated and imperfect. If we do solve it; we'd also need to either change the existing `expandMacro`/`expandMacroInline` commands; provide some option to allow/disallow `$crate` expanding; or come to some other compromise.
2023-01-09 14:24:41 +00:00
..
base-db Inline all format arguments where possible 2022-12-24 14:36:10 -05:00
cfg Inline all format arguments where possible 2022-12-24 14:36:10 -05:00
flycheck use inline format args 2023-01-02 14:52:32 +00:00
hir Auto merge of #13458 - cameron1024:suggest-checked-wrapping-saturating, r=Veykril 2023-01-09 11:24:44 +00:00
hir-def remove unnecessary lifetimes that can be elided 2023-01-02 15:02:54 +00:00
hir-expand Auto merge of #13860 - danieleades:clippy, r=lnicola 2023-01-08 17:29:57 +00:00
hir-ty Auto merge of #13860 - danieleades:clippy, r=lnicola 2023-01-08 17:29:57 +00:00
ide Add a fixme to remove hacks 2023-01-09 13:37:37 +00:00
ide-assists Auto merge of #13810 - tfpk:tfpk/macro-inline, r=Veykril 2023-01-09 14:24:41 +00:00
ide-completion fix: add_format_like_completions to handle no exprs 2023-01-09 12:23:59 +01:00
ide-db test: fix arg_type test 2023-01-09 12:22:29 +01:00
ide-diagnostics remove needless borrows 2023-01-02 14:52:32 +00:00
ide-ssr Inline all format arguments where possible 2022-12-24 14:36:10 -05:00
limit Inline all format arguments where possible 2022-12-24 14:36:10 -05:00
mbe remove unnecessary lifetimes that can be elided 2023-01-02 15:02:54 +00:00
parser remove useless operations 2023-01-02 15:02:54 +00:00
paths ⬆️ rust-analyzer 2022-11-23 17:24:03 +02:00
proc-macro-api remove useless operations 2023-01-02 15:02:54 +00:00
proc-macro-srv remove needless borrows 2023-01-02 14:52:32 +00:00
proc-macro-srv-cli ⬆️ rust-analyzer 2022-11-23 17:24:03 +02:00
proc-macro-test Moar linting: needless_borrow, let_unit_value, ... 2022-12-25 05:07:47 -05:00
profile remove needless borrows 2023-01-02 14:52:32 +00:00
project-model remove unnecessary lifetimes that can be elided 2023-01-02 15:02:54 +00:00
rust-analyzer Add an option to minimize parentheses for adjustment hints 2023-01-09 13:35:17 +00:00
sourcegen remove needless borrows 2023-01-02 14:52:32 +00:00
stdx remove useless casts 2023-01-02 15:02:54 +00:00
syntax Auto merge of #13891 - bvanjoi:reverse-whitespace-in-assists, r=Veykril 2023-01-09 14:11:40 +00:00
test-utils Auto merge of #13860 - danieleades:clippy, r=lnicola 2023-01-08 17:29:57 +00:00
text-edit ⬆️ rust-analyzer 2022-11-23 17:24:03 +02:00
toolchain Moar linting: needless_borrow, let_unit_value, ... 2022-12-25 05:07:47 -05:00
tt Inline all format arguments where possible 2022-12-24 14:36:10 -05:00
vfs derive 'Hash' 2022-12-30 11:14:15 +00:00
vfs-notify ⬆️ rust-analyzer 2022-11-23 17:24:03 +02:00