File tree Expand file tree Collapse file tree 6 files changed +23
-8
lines changed Expand file tree Collapse file tree 6 files changed +23
-8
lines changed Original file line number Diff line number Diff 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,
Original file line number Diff line number Diff 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`.
Original file line number Diff line number Diff 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,
Original file line number Diff line number Diff 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 /// ```
Original file line number Diff line number Diff 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 /// ```
Original file line number Diff line number Diff 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,
You can’t perform that action at this time.
0 commit comments