Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Extract into function" misses format string captures #13389

Open
kpreid opened this issue Oct 10, 2022 · 1 comment
Open

"Extract into function" misses format string captures #13389

kpreid opened this issue Oct 10, 2022 · 1 comment
Labels
A-assists C-bug Category: bug

Comments

@kpreid
Copy link
Contributor

kpreid commented Oct 10, 2022

rust-analyzer version: rust-analyzer version: 0.4.1237-standalone (61504c8 2022-10-08)

rustc version: rustc 1.64.0 (a55dd71d5 2022-09-19)

Start with:

pub fn tester() {
    let x = "hello";
    let y = "world";

    println!("{x} {}", y);
}

Run “Extract into function” on the println!. This produces:

pub fn tester() {
    let x = "hello";
    let y = "world";

    fun_name(y);
}

fn fun_name(y: &str) {
    println!("{x} {}", y);
}

Note that x does not become a parameter to the function, even though it must.

@lowr
Copy link
Contributor

lowr commented Oct 25, 2022

format_args_capture hasn't been supported yet afaict. See #11260.

@Veykril Veykril added A-assists C-bug Category: bug labels Feb 9, 2023
@Veykril Veykril assigned Veykril and unassigned Veykril Dec 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-assists C-bug Category: bug
Projects
None yet
Development

No branches or pull requests

3 participants