Skip to content

Commit

Permalink
Rollup merge of rust-lang#94551 - darnuria:doc-map-backstick, r=dtolnay
Browse files Browse the repository at this point in the history
Doc: Fix use of quote instead of backstick in Adapter::map.

A little commit to fix documentation rendering and semantics in https://doc.rust-lang.org/std/iter/struct.Map.html#notes-about-side-effects `"` where used around an expression instead \`.

Screenshot on doc.rust-lang.org:
![2022-03-03 11-21-43_backstick](https://user-images.githubusercontent.com/2827553/156546536-569b7692-7ac4-4388-8e93-c1628ddc6a0f.png)

Looking forward: Maybe reworking the doc to use assert_eq like the upper paragraph:
```
let v: Vec<i32> = vec![1, 2, 3].into_iter().map(|x| x + 1).rev().collect();

assert_eq!(v, [4, 3, 2]);
```
  • Loading branch information
matthiaskrgr committed Mar 3, 2022
2 parents 770a7ec + 37c1eb0 commit 0c14a12
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion library/core/src/iter/adapters/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ use crate::ops::Try;
/// }
/// ```
///
/// This will print "('a', 1), ('b', 2), ('c', 3)".
/// This will print `('a', 1), ('b', 2), ('c', 3)`.
///
/// Now consider this twist where we add a call to `rev`. This version will
/// print `('c', 1), ('b', 2), ('a', 3)`. Note that the letters are reversed,
Expand Down

0 comments on commit 0c14a12

Please sign in to comment.