if-to-let-chain

Crates.ioif-to-let-chain
lib.rsif-to-let-chain
version1.0.0
sourcesrc
created_at2023-11-10 17:28:23.167313
updated_at2023-11-10 17:28:23.167313
descriptionConvert macros from the let_chains crate to if chains
homepage
repositoryhttps://github.com/Alexendoo/if-to-let-chain
max_upload_size
id1031356
size42,434
Alex Macleod (Alexendoo)

documentation

README

if-to-let-chain

Converts usages of the if_chain macro from the if-chain crate to let-chains.

Example input:

if_chain! {
    if let Ok(num) = u16::from_str(s);
    if num < 4000;
    if let Some(e) = v.get(num);
    then {
        println!("{e}");
    }
}

Output:

if let Ok(num) = u16::from_str(s)
    && num < 4000
    && let Some(e) = v.get(num)
{
    println!("{e}");
}

Usage:

if-to-let-chain [Options] PATH...

Options:
    -d, --deindent N    number of chars to deindent by (default 4)
    -v, --verbose       print extra information
    -h, --help          print this help

License

This crate is distributed under the terms of both the MIT license and the Apache License (Version 2.0), at your option.

See LICENSE-APACHE and LICENSE-MIT for details.

License of your contributions

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Commit count: 17

cargo fmt