Skip to content

Commit

Permalink
Corrected doc PR fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ThibsG committed Jun 1, 2020
1 parent 9893254 commit ad0446c
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 8 deletions.
2 changes: 1 addition & 1 deletion clippy_lints/src/drop_bounds.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ declare_clippy_lint! {
/// ```
/// Could be written as:
/// ```rust
/// fn foo() {}
/// fn foo<T>() {}
/// ```
pub DROP_BOUNDS,
correctness,
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/eta_reduction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ declare_clippy_lint! {
/// xs.map(|x| foo(x))
///
/// // Good
/// foo(xs)
/// xs.map(foo)
/// ```
/// where `foo(_)` is a plain function that takes the exact argument type of
/// `x`.
Expand Down
7 changes: 5 additions & 2 deletions clippy_lints/src/eval_order_dependence.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,11 @@ declare_clippy_lint! {
/// // Unclear whether a is 1 or 2.
///
/// // Good
/// x = 1;
/// let a = 1 + x;
/// let tmp = {
/// x = 1;
/// 1
/// };
/// let a = tmp + x;
/// ```
pub EVAL_ORDER_DEPENDENCE,
complexity,
Expand Down
12 changes: 10 additions & 2 deletions clippy_lints/src/fallible_impl_from.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ declare_clippy_lint! {
/// **Known problems:** None.
///
/// **Example:**
/// ```rust,ignore
/// ```rust
/// struct Foo(i32);
///
/// // Bad
Expand All @@ -27,13 +27,21 @@ declare_clippy_lint! {
/// Foo(s.parse().unwrap())
/// }
/// }
/// ```
///
/// ```rust
/// // Good
/// struct Foo(i32);
///
/// use std::convert::TryFrom;
/// impl TryFrom<String> for Foo {
/// type Error = ();
/// fn try_from(s: String) -> Result<Self, Self::Error> {
/// s.parse()
/// if let Ok(parsed) = s.parse() {
/// Ok(Foo(parsed))
/// } else {
/// Err(())
/// }
/// }
/// }
/// ```
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/functions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ declare_clippy_lint! {
/// ```rust
/// fn im_too_long() {
/// println!("");
/// // ... 100 more LoC
/// // ... 100 more LoC
/// println!("");
/// }
/// ```
Expand Down
6 changes: 5 additions & 1 deletion clippy_lints/src/methods/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,11 @@ declare_clippy_lint! {
/// vec.iter().filter(|x| **x == 0).map(|x| *x * 2);
///
/// // Good
/// vec.iter().filter_map(|x| Some(*x * 2));
/// vec.iter().filter_map(|x| if *x == 0 {
/// Some(*x * 2)
/// } else {
/// None
/// });
/// ```
pub FILTER_MAP,
pedantic,
Expand Down

0 comments on commit ad0446c

Please sign in to comment.