@@ -179,7 +179,8 @@ declare_clippy_lint! {
179179 ///
180180 /// **Example:**
181181 /// ```rust
182- /// x.map(|a| a + 1).unwrap_or(0)
182+ /// # let x = Some(1);
183+ /// x.map(|a| a + 1).unwrap_or(0);
183184 /// ```
184185 pub OPTION_MAP_UNWRAP_OR ,
185186 pedantic,
@@ -196,7 +197,9 @@ declare_clippy_lint! {
196197 ///
197198 /// **Example:**
198199 /// ```rust
199- /// x.map(|a| a + 1).unwrap_or_else(some_function)
200+ /// # let x = Some(1);
201+ /// # fn some_function() -> usize { 1 }
202+ /// x.map(|a| a + 1).unwrap_or_else(some_function);
200203 /// ```
201204 pub OPTION_MAP_UNWRAP_OR_ELSE ,
202205 pedantic,
@@ -213,7 +216,9 @@ declare_clippy_lint! {
213216 ///
214217 /// **Example:**
215218 /// ```rust
216- /// x.map(|a| a + 1).unwrap_or_else(some_function)
219+ /// # let x: Result<usize, ()> = Ok(1);
220+ /// # fn some_function(foo: ()) -> usize { 1 }
221+ /// x.map(|a| a + 1).unwrap_or_else(some_function);
217222 /// ```
218223 pub RESULT_MAP_UNWRAP_OR_ELSE ,
219224 pedantic,
@@ -265,7 +270,8 @@ declare_clippy_lint! {
265270 ///
266271 /// **Example:**
267272 /// ```rust
268- /// iter.map(|x| x.iter()).flatten()
273+ /// let vec = vec![vec![1]];
274+ /// vec.iter().map(|x| x.iter()).flatten();
269275 /// ```
270276 pub MAP_FLATTEN ,
271277 pedantic,
@@ -284,7 +290,8 @@ declare_clippy_lint! {
284290 ///
285291 /// **Example:**
286292 /// ```rust
287- /// iter.filter(|x| x == 0).map(|x| x * 2)
293+ /// let vec = vec![1];
294+ /// vec.iter().filter(|x| **x == 0).map(|x| *x * 2);
288295 /// ```
289296 pub FILTER_MAP ,
290297 pedantic,
@@ -324,7 +331,7 @@ declare_clippy_lint! {
324331 ///
325332 /// **Example:**
326333 /// ```rust
327- /// (0..3).find(|x| x == 2).map(|x| x * 2);
334+ /// (0..3).find(|x| * x == 2).map(|x| x * 2);
328335 /// ```
329336 /// Can be written as
330337 /// ```rust
0 commit comments