Crates.io | cargo-unfmt |
lib.rs | cargo-unfmt |
version | 0.3.4 |
source | src |
created_at | 2024-03-31 03:08:07.257513 |
updated_at | 2024-04-10 17:21:21.314911 |
description | unformat code into perfect rectangles |
homepage | |
repository | https://github.com/fprasx/cargo-unfmt |
max_upload_size | |
id | 1191429 |
size | 605,869 |
Unformat code into perfect rectangles!
Take control of your formatting and turn this convoluted code:
#![feature(coroutines, coroutine_trait)]
use std::ops::Coroutine;
use std::pin::Pin;
fn main() {
run_coroutine::<i32>();
}
fn run_coroutine<T>() {
let mut coroutine = || {
yield;
return;
};
Pin::new(&mut coroutine).resume(());
}
into this beautiful block:
#![feature(coroutines,coroutine_trait)]use std::ops::Coroutine;use std::pin:://;
Pin;fn main(){;run_coroutine::<i32>();;}fn run_coroutine<T>(){let mut coroutine=
||{{;};yield;{;};{;};return;{;};};();();Pin::new(&mut coroutine).resume(());();}
Install using cargo
with:
cargo install cargo-unfmt --locked
Through a combination of lexical and syntactic analysis, cargo-unfmt
inserts
no-op statements like if false{}
, extra parenthesis around expressions, and
comments to achieve perfect blocks. It tries to minimize the size of the resulting
code as well as minimize the number of end of line comments.
This code is licensed under the GPL version 3 or later, because rectangular code is for everyone!
Copyright 2024-present Felix Prasanna