Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/alexendoo/if-to-let-chain
https://github.com/alexendoo/if-to-let-chain
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/alexendoo/if-to-let-chain
- Owner: Alexendoo
- License: apache-2.0
- Created: 2022-05-18T16:53:10.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2023-11-10T18:00:40.000Z (about 1 year ago)
- Last Synced: 2024-10-06T10:25:41.461Z (3 months ago)
- Language: Rust
- Size: 26.4 KB
- Stars: 4
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE-APACHE
Awesome Lists containing this project
README
# if-to-let-chain
Converts usages of the `if_chain` macro from the
[if-chain crate](https://docs.rs/if_chain/) to `let-chains`.Example input:
```Rust
if_chain! {
if let Ok(num) = u16::from_str(s);
if num < 4000;
if let Some(e) = v.get(num);
then {
println!("{e}");
}
}
```Output:
```Rust
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](LICENSE-APACHE) and [LICENSE-MIT](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.