-
Notifications
You must be signed in to change notification settings - Fork 512
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
Document if-let guards #1082
base: master
Are you sure you want to change the base?
Document if-let guards #1082
Conversation
@@ -102,6 +111,21 @@ let message = match maybe_digit { | |||
}; | |||
``` | |||
|
|||
`if let` guards are introduced by the `if let` keywords and are composed of a pattern, an `=` and a scrutinee expression. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
`if let` guards are introduced by the `if let` keywords and are composed of a pattern, an `=` and a scrutinee expression. | |
`if let` guards are composed following [The Rust Reference `if let` keywords syntax](https://doc.rust-lang.org/stable/reference/expressions/if-expr.html#if-let-expressions). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kw-fn, I think the original is correct here, as it is just describing the syntax, and is a style used throughout the reference as a way to anchor the description of what the text is talking about. Also, we do not use external links, or refer to the reference by name within itself.
Thanks @LeSeulArtichaut, this looks good to me! It will need to wait for it to be stabilized on nightly, though happy to discuss any feedback from the lang team in the meantime. |
This text reads well to me. |
I think we can close this with the documentation we have currently in the reference now at time of writing |
> `if` [_Expression_] | ||
> | ||
> _MatchArmIfLetGuard_:\ | ||
> `if` `let` [_Pattern_] `=` _Scrutinee_<sub>_except lazy boolean operator expression_</sub> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
> `if` `let` [_Pattern_] `=` _Scrutinee_<sub>_except lazy boolean operator expression_</sub> | |
> `if` `let` [_Pattern_] `=` _Scrutinee_ |
After rust#115371
☔ The latest upstream changes (possibly 4249fb4) made this pull request unmergeable. Please resolve the merge conflicts. |
cc @pnkfelix rust-lang/rfcs#2294 rust-lang/rust#51114