rust-analyzer/crates
bors 1e20bf38b2 Auto merge of #13684 - unvalley:extract-expressions-from-format-string, r=Veykril
feat: extract_expressions_from_format_string

closes #13640
- rename to `extract_expressions_from_format_string`
- leave identifier from format string
	- but this is from rustc version 1.65.0
	- Should I add flag or something?

Note: the assist behaves below cases for now. I'll create an issue for these.
```rs
let var = 1 + 1;
// ok
format!("{var} {1+1}");   // → format!("{var} {}", 1+1);
format!("{var:?} {1+1}"); // → format!("{var:?} {}", 1 + 1);
format!("{var} {var} {1+1}"); // → format!("{var} {var} {}", 1 + 1);

// breaks (need to handle minimum width by postfix`$`)
format!("{var:width$} {1+1}"); // → format!("{var:width\$} {}", 1+1);
format!("{var:.prec$} {1+1}"); // → format!("{var:.prec\$} {}", 1+1);
format!("Hello {:1$}! {1+1}", "x" 5); // → format("Hello {:1\$}! {}", "x", 1+1);
format!("Hello {:width$}! {1+1}", "x", width = 5); // → println!("Hello {:width\$}! {}", "x", 1+1);
```

https://user-images.githubusercontent.com/38400669/204344911-f1f8fbd2-706d-414e-b1ab-d309376efb9b.mov
2023-01-09 11:40:48 +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 Auto merge of #13860 - danieleades:clippy, r=lnicola 2023-01-08 17:29:57 +00:00
ide-assists Auto merge of #13684 - unvalley:extract-expressions-from-format-string, r=Veykril 2023-01-09 11:40:48 +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 Auto merge of #13860 - danieleades:clippy, r=lnicola 2023-01-08 17:29:57 +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 remove unnecessary lazy evaluations 2023-01-02 15:02:54 +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