Skip to content

Clarify final expression return wording in ch09-02#4730

Open
NMJ27 wants to merge 1 commit intorust-lang:mainfrom
NMJ27:clarify-final-expression
Open

Clarify final expression return wording in ch09-02#4730
NMJ27 wants to merge 1 commit intorust-lang:mainfrom
NMJ27:clarify-final-expression

Conversation

@NMJ27
Copy link
Copy Markdown

@NMJ27 NMJ27 commented Apr 22, 2026

The current wording says “this is the last expression in the function,” which may be read as referring to Err(e) in the Err arm rather than to the entire match expression. This change makes that more explicit for learners.

It rewords the sentence to:

However, we don’t need to explicitly say return before the final match, because the entire match expression is the last expression in the function, so its value is returned.

When reading this section, I initially interpreted the earlier Err(e) => return Err(e) as a pattern that also applied to the final match. In that reading, the omitted return can seem unclear, especially for the Ok(username) arm. This change clarifies that the omitted idiomatic return applies to the entire final match, not to an individual arm.

@NMJ27 NMJ27 changed the title Clarify final expression return wording Clarify final expression return wording in ch09-02 Apr 22, 2026
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