Skip to content

Fix a syntax error in the sample code. #1

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

Closed
wants to merge 1 commit into from
Closed

Conversation

h1g0
Copy link
Owner

@h1g0 h1g0 commented Dec 8, 2021

destructure_structures.mdの中のサンプルコードに

        // `x`に言及していないため、以下はエラーになる。
        //Foo { y } => println!("y = {}", y);

と書かれてコメントアウトされたコードがありますが、このコードはmatch式の中にもかかわらず;で終わっているため、コードの本来の意図とは異なり、xの言及にかかわらずエラーになります。

そのため、コードの意図に添ったエラーとするために、末尾の;,に置き換える修正をおこないました。

※原文のこちらのプルリクと同じ修正になります。


In a sample code of destructure_structures.md, there is a code that is commented out with "// this will give an error: pattern does not mention field x".
But this line ends with a ; even though it is in match, so it gives an error regardless of the mention of x.

So replace the trailing semicolon with a comma.

Note: This will be the same modification as this pull request in the original document.

In a sample code of `destructure_structures.md`, there is a code that is commented out with "// this will give an error: pattern does not mention field `x`".
But this line ends with a `;` even though it is in `match`, so it gives an error regardless of the mention of `x`.

So replace the trailing semicolon with a comma.

Note: This will be the same modification as [this pull request]( rust-lang/rust-by-example#1336 ) in the original document.
@h1g0 h1g0 closed this Dec 8, 2021
@h1g0 h1g0 deleted the h1g0-patch-1 branch December 11, 2021 23:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant