about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorPhlosioneer <mattmdrr2@gmail.com>2018-02-24 11:37:38 -0500
committerPhlosioneer <mattmdrr2@gmail.com>2018-02-24 11:37:38 -0500
commitbbd64b256320013d02734504c744cd3c0b180ebf (patch)
tree8239c218d97b7b5a86163f09f2201de73b996dd2 /src/libstd
parent6070d3e47e5e9f15575a3bd33583358b52bc6eda (diff)
downloadrust-bbd64b256320013d02734504c744cd3c0b180ebf.tar.gz
rust-bbd64b256320013d02734504c744cd3c0b180ebf.zip
Slight modification to the as_ref example of std::option::Option
A user in a reddit thread was confused by the name of the variable
"num_as_int"; they thought the example was trying to convert the
string "10" as if it were binary 2 by calling str::len(). In reality,
the example is simply demonstrating how to take an immutable reference
to the value of an Option. The confusion comes from the coincidence
that the length of the string "10" is also its binary representation,
and the implication from the variable names that a conversion was
occuring ("num_as_str" to "num_as_int").

This PR changes the example number to 12 instead of 10, and changes
the variable name from "num_as_int" to "num_length" to better
communicate what the example is doing.

The reddit thread:
https://www.reddit.com/r/rust/comments/7zpvev/notyetawesome_rust_what_use_cases_would_you_like/dur39xw/
Diffstat (limited to 'src/libstd')
0 files changed, 0 insertions, 0 deletions