Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expanding let $ident:$ty = $expr; #5

Closed
tathanhdinh opened this issue Oct 2, 2018 · 2 comments
Closed

Expanding let $ident:$ty = $expr; #5

tathanhdinh opened this issue Oct 2, 2018 · 2 comments

Comments

@tathanhdinh
Copy link
Contributor

tathanhdinh commented Oct 2, 2018

Hello all,

Currently, if_chain refuses to expand the pattern let $ident:$ty = $expr;, for example this piece of code

if_chain! {
  if false;
  let y: u32 = 4;

  then {
    ...
  } else {
    ...
  }
};

will not compile. I try to add a rule to support this pattern as:

(@expand $other:block let $ident:ident:$ty:ty = $expr:expr; $($tt:tt)+) => {
  let $ident:$ty = $expr;
  __if_chain! { @expand $other $($tt)+ }
};

but I don't know whether there is a better way to do that or if_chain is interested in supporting this pattern.

Many thanks for any comment.

@PayasR
Copy link

PayasR commented May 21, 2019

Can we please have a new release with this fixed?

@lambda-fairy
Copy link
Owner

@PayasR no worries. Released as 1.0.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants