Skip to content

Put glaring warnings and many capital letters in the docs of option::get() and option::unwrap(). #3606

Closed
@bblum

Description

@bblum

I realised this when replying to @eholk on my blog: http://winningraceconditions.blogspot.com/2012/09/rust-0-index-and-conclusion.html?showComment=1348721405975#c9047445512681989061

Basically, I worry that novices who are familiar with null pointer checks but not familiar with the functional "option" idiom will start learning rust, then pop into the channel or go to their friends asking "How do I get the T out of an Option<T>??", and start using get() or unwrap() indiscriminately, when really they should be learning about match and how to properly handle the None case.

I think a big step here would be to write something like "WARNING: If you are not SURE that the optional value is not None, use a match statement instead and handle the None case explicitly!" in the documentation for these functions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions