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

Document if-let guards #1082

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

LeSeulArtichaut
Copy link

@ehuss ehuss added the S-waiting-on-stabilization Waiting for a stabilization PR to be merged in the main Rust repository label Aug 12, 2021
@@ -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.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
`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).

Copy link
Contributor

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.

@ehuss
Copy link
Contributor

ehuss commented Aug 15, 2021

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.

@Fishrock123
Copy link

This text reads well to me.

@ConveyorBusBuilder
Copy link

ConveyorBusBuilder commented Dec 9, 2022

I think we can close this with the documentation we have currently in the reference now at time of writing

>    `if` [_Expression_]
>
> _MatchArmIfLetGuard_:\
> &nbsp;&nbsp; `if` `let` [_Pattern_] `=` _Scrutinee_<sub>_except lazy boolean operator expression_</sub>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
> &nbsp;&nbsp; `if` `let` [_Pattern_] `=` _Scrutinee_<sub>_except lazy boolean operator expression_</sub>
> &nbsp;&nbsp; `if` `let` [_Pattern_] `=` _Scrutinee_

After rust#115371

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-stabilization Waiting for a stabilization PR to be merged in the main Rust repository
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants