Skip to content

Commit e8904f9

Browse files
committed
Change the example string to something arbitrary
The choice of string is arbitrary, so all references to a number in the string were removed. The string is now the standard "Hello world!".
1 parent bbd64b2 commit e8904f9

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/libcore/option.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -233,11 +233,12 @@ impl<T> Option<T> {
233233
/// [`usize`]: ../../std/primitive.usize.html
234234
///
235235
/// ```
236-
/// let num_as_str: Option<String> = Some("12".to_string());
236+
/// let text: Option<String> = Some("Hello, world!".to_string());
237237
/// // First, cast `Option<String>` to `Option<&String>` with `as_ref`,
238-
/// // then consume *that* with `map`, leaving `num_as_str` on the stack.
239-
/// let num_length: Option<usize> = num_as_str.as_ref().map(|n| n.len());
240-
/// println!("still can print num_as_str: {:?}", num_as_str);
238+
/// // then consume *that* with `map`, leaving `text` on the stack.
239+
/// let text_length: Option<usize> = text.as_ref().map(|s| s.len());
240+
/// println!("text length: {}", text_length);
241+
/// println!("still can print text: {:?}", text);
241242
/// ```
242243
#[inline]
243244
#[stable(feature = "rust1", since = "1.0.0")]

0 commit comments

Comments
 (0)