Skip to content
Oeiuwq Faith Blog OpenSource Porfolio

lambda-fairy/if_chain

Macro for writing nested `if let` expressions

lambda-fairy/if_chain.json
{
"createdAt": "2016-12-28T22:40:27Z",
"defaultBranch": "main",
"description": "Macro for writing nested `if let` expressions",
"fullName": "lambda-fairy/if_chain",
"homepage": "https://docs.rs/if_chain",
"language": "Rust",
"name": "if_chain",
"pushedAt": "2025-08-29T15:17:09Z",
"stargazersCount": 169,
"topics": [
"macro",
"rust"
],
"updatedAt": "2025-11-18T12:22:55Z",
"url": "https://github.com/lambda-fairy/if_chain"
}

CI Cargo

If you’re using Rust 1.88 or newer, check out if let chains instead. This crate is still available for earlier versions of Rust.

This crate provides a single macro called if_chain!.

if_chain! lets you write long chains of nested if and if let statements without the associated rightward drift. It also supports multiple patterns (e.g. if let Foo(a) | Bar(a) = b) in places where Rust would normally not allow them.

For more information on this crate, see the documentation and associated blog post.