1e20bf38b2
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 |
||
---|---|---|
.. | ||
src | ||
Cargo.toml |