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

tutorial eschews destructuring-let (favoring match) too much #11569

Closed
pnkfelix opened this issue Jan 15, 2014 · 3 comments
Closed

tutorial eschews destructuring-let (favoring match) too much #11569

pnkfelix opened this issue Jan 15, 2014 · 3 comments

Comments

@pnkfelix
Copy link
Member

The Rust tutorial mentions that you can use let for destructuring patterns, but only in passing.

In particular, the sections that cover struct and tuples (and struct tuples) almost always use match rather than let to destructure their inputs, despite the fact that the patterns in these cases are irrefutable patterns.

I can understand wanting to minimize the number of concepts that are introduced, but let destructuring is so much more lightweight than match, we should try to point it out (a second time) in the struct/tuples section, perhaps immediately after the first instance of a use of match to destructure a struct.

@pnkfelix
Copy link
Member Author

(I'm not saying we need to go whole-hog and attempt to actually define "irrefutable" patterns in the tutorial, since such a definition is more appropriately put into the reference manual. I'm just saying that it would be good for the tutorial to actually use good Rust style when appropriate and reasonable.)

@pnkfelix
Copy link
Member Author

part of #11755

@steveklabnik
Copy link
Member

The tutorial is eventually going away, and the new guide will absolutely 'use good Rust style when appropriate and reasonable.' I'm giving this a close.

flip1995 pushed a commit to flip1995/rust that referenced this issue Sep 28, 2023
…r=llogiq

Describe the type of string in raw_strings lints

changelog: none
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

No branches or pull requests

2 participants