#refactoring #automated #variables #extract #rename #snippets #codebase

rust_refactor

A library for automated code refactoring in Rust

3 releases

new 0.1.2 Nov 21, 2024
0.1.1 Nov 10, 2024
0.1.0 Nov 6, 2024

#6 in #refactoring

Download history 99/week @ 2024-11-03 116/week @ 2024-11-10 130/week @ 2024-11-17

345 downloads per month

MIT license

3KB

rust_refactor

A library for automated code refactoring in Rust.

Features

  • Extract functions from code snippets.
  • Rename variables throughout a codebase.

Installation

To use rust_refactor, add the following to your Cargo.toml:

[dependencies]
rust_refactor = "0.1.0"

Usage

use rust_refactor::refactor;

fn main() {
    let code = "let x = 5; x + 1";
    
    let extracted = refactor::extract_function(code, "my_func");
    println!("{}", extracted);
    
    let renamed = refactor::rename_variable(code, "x", "y");
    println!("{}", renamed);
}

License

This project is licensed under the MIT License

Running the Project

  1. Build the project:
    cargo build
    

Author

bensatlantik

No runtime deps