Skip to content

Feature request: inline a function #6863

@Nadrieril

Description

@Nadrieril

First I want to say this project is absolutely awesome! I didn't know I needed those magic code actions and now I can't live without them ❤️. And it's so fast at spotting my missing semicolons 🤯.

A thing I regularly end up doing when refactoring code is inlining a function that I am in the process of modifying. I'd love a code action that can be triggered on the call site of a function and inlines it at that call site. Might also delete the function if that was the only call site.

fn foo(s: &str, n: u64) {
	println!("A string {}, a squared number {}", s, n*n)
}
fn main() {
	foo|("a string", 1+1)
}

===>

fn main() {
	let n = 1+1; // `n` is a variable here because it's used more than once.
	println!("A string {}, a squared number {}, "a string", n*n)
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-assistsS-actionableSomeone could pick this issue up and work on it right now

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions