Skip to content

Commit

Permalink
fix docstring code
Browse files Browse the repository at this point in the history
  • Loading branch information
wgreenberg committed Jan 21, 2025
1 parent 9f546d7 commit 3cec4e1
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions lib/src/analysis/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,28 @@
/// Unpacks a pattern, or returns None.
///
/// # Examples
/// Suppose you've got some highly nested enum:
/// You can use `unpack!` to unroll highly nested enums like this:
/// ```
/// use super::util::unpack;
///
/// enum Foo {
/// A(Bar),
/// B,
/// }
///
/// enum Baz {
/// C(Bang)
/// enum Bar {
/// C(Baz)
/// }
///
/// struct Bang;
/// ```
/// struct Baz;
///
/// You can use `unpack!` to unroll it like this:
/// ```
/// fn get_bang(foo: Foo) -> Option<Bang> {
/// fn get_bang(foo: Foo) -> Option<Baz> {
/// unpack!(Foo::A(bar) = foo);
/// unpack!(Baz::C(bang) = bar);
/// bang
/// unpack!(Bar::C(baz) = bar);
/// baz
/// }
/// ```
///
macro_rules! unpack {
($pat:pat = $val:expr) => {
let $pat = $val else { return None; };
Expand Down

0 comments on commit 3cec4e1

Please sign in to comment.