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

rust_refactor

A library for automated code refactoring in Rust

3 releases

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

#6 in #refactoring

Download history 164/week @ 2024-11-04 53/week @ 2024-11-11 161/week @ 2024-11-18 4/week @ 2024-11-25 6/week @ 2024-12-02

289 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