doc: add an `.as_slice` example to the cheatsheet.

A lot of questions about this on IRC and stackoverflow.
Fix docs for `core::result::Result::map`.

`reader.read_line()` includes trailing newline char, which makes
`from_str` always return `None`.
auto merge of #14578 : huonw/rust/as_slice-cheatsheet, r=sfackler

doc: add an `.as_slice` example to the cheatsheet.

A lot of questions about this on IRC and stackoverflow.
auto merge of #14580 : utkarshkukreti/rust/fix-docs-for-result-map, r=alexcrichton

`reader.read_line()` includes trailing newline char, which makes
`from_str` always return `None`.