Skip to content

Commit 137a3b4

Browse files
committed
Corrected doc PR fixes
1 parent 9893254 commit 137a3b4

File tree

6 files changed

+23
-8
lines changed

6 files changed

+23
-8
lines changed

clippy_lints/src/drop_bounds.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ declare_clippy_lint! {
2929
/// ```
3030
/// Could be written as:
3131
/// ```rust
32-
/// fn foo() {}
32+
/// fn foo<T>() {}
3333
/// ```
3434
pub DROP_BOUNDS,
3535
correctness,

clippy_lints/src/eta_reduction.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ declare_clippy_lint! {
3030
/// xs.map(|x| foo(x))
3131
///
3232
/// // Good
33-
/// foo(xs)
33+
/// xs.map(foo)
3434
/// ```
3535
/// where `foo(_)` is a plain function that takes the exact argument type of
3636
/// `x`.

clippy_lints/src/eval_order_dependence.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,11 @@ declare_clippy_lint! {
3030
/// // Unclear whether a is 1 or 2.
3131
///
3232
/// // Good
33-
/// x = 1;
34-
/// let a = 1 + x;
33+
/// let tmp = {
34+
/// x = 1;
35+
/// 1
36+
/// };
37+
/// let a = tmp + x;
3538
/// ```
3639
pub EVAL_ORDER_DEPENDENCE,
3740
complexity,

clippy_lints/src/fallible_impl_from.rs

+10-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ declare_clippy_lint! {
1818
/// **Known problems:** None.
1919
///
2020
/// **Example:**
21-
/// ```rust,ignore
21+
/// ```rust
2222
/// struct Foo(i32);
2323
///
2424
/// // Bad
@@ -27,13 +27,21 @@ declare_clippy_lint! {
2727
/// Foo(s.parse().unwrap())
2828
/// }
2929
/// }
30+
/// ```
3031
///
32+
/// ```rust
3133
/// // Good
34+
/// struct Foo(i32);
35+
///
3236
/// use std::convert::TryFrom;
3337
/// impl TryFrom<String> for Foo {
3438
/// type Error = ();
3539
/// fn try_from(s: String) -> Result<Self, Self::Error> {
36-
/// s.parse()
40+
/// if let Ok(parsed) = s.parse() {
41+
/// Ok(Foo(parsed))
42+
/// } else {
43+
/// Err(())
44+
/// }
3745
/// }
3846
/// }
3947
/// ```

clippy_lints/src/functions.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ declare_clippy_lint! {
5252
/// ```rust
5353
/// fn im_too_long() {
5454
/// println!("");
55-
/// // ... 100 more LoC
55+
/// // ... 100 more LoC
5656
/// println!("");
5757
/// }
5858
/// ```

clippy_lints/src/methods/mod.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,11 @@ declare_clippy_lint! {
436436
/// vec.iter().filter(|x| **x == 0).map(|x| *x * 2);
437437
///
438438
/// // Good
439-
/// vec.iter().filter_map(|x| Some(*x * 2));
439+
/// vec.iter().filter_map(|x| if *x == 0 {
440+
/// Some(*x * 2)
441+
/// } else {
442+
/// None
443+
/// });
440444
/// ```
441445
pub FILTER_MAP,
442446
pedantic,

0 commit comments

Comments
 (0)