Skip to content

Commit

Permalink
fix or ignore failing doc tests
Browse files Browse the repository at this point in the history
  • Loading branch information
euclio committed Mar 5, 2019
1 parent fe96ffe commit a9de64a
Show file tree
Hide file tree
Showing 44 changed files with 137 additions and 127 deletions.
8 changes: 4 additions & 4 deletions clippy_lints/src/assertions_on_constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ declare_clippy_lint! {
/// **Known problems:** None
///
/// **Example:**
/// ```rust
/// assert!(false)
/// ```no_run
/// assert!(false);
/// // or
/// assert!(true)
/// assert!(true);
/// // or
/// const B: bool = false;
/// assert!(B)
/// assert!(B);
/// ```
pub ASSERTIONS_ON_CONSTANTS,
style,
Expand Down
4 changes: 2 additions & 2 deletions clippy_lints/src/assign_ops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ declare_clippy_lint! {
/// implementations that differ from the regular `Op` impl.
///
/// **Example:**
/// ```rust
/// ```ignore
/// let mut a = 5;
/// ...
/// a = a + b;
Expand All @@ -39,7 +39,7 @@ declare_clippy_lint! {
/// written as `a = a op a op b` as it's less confusing.
///
/// **Example:**
/// ```rust
/// ```ignore
/// let mut a = 5;
/// ...
/// a += a + b;
Expand Down
6 changes: 3 additions & 3 deletions clippy_lints/src/attrs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ declare_clippy_lint! {
/// done the measurement.
///
/// **Example:**
/// ```rust
/// ```ignore
/// #[inline(always)]
/// fn not_quite_hot_code(..) { ... }
/// ```
Expand All @@ -57,7 +57,7 @@ declare_clippy_lint! {
/// **Known problems:** None.
///
/// **Example:**
/// ```rust
/// ```ignore
/// // Bad
/// #[deny(dead_code)]
/// extern crate foo;
Expand Down Expand Up @@ -88,7 +88,7 @@ declare_clippy_lint! {
/// **Example:**
/// ```rust
/// #[deprecated(since = "forever")]
/// fn something_else(..) { ... }
/// fn something_else() { /* ... */ }
/// ```
pub DEPRECATED_SEMVER,
correctness,
Expand Down
6 changes: 3 additions & 3 deletions clippy_lints/src/bit_mask.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ declare_clippy_lint! {
/// **Known problems:** None.
///
/// **Example:**
/// ```rust
/// ```ignore
/// if (x & 1 == 2) { … }
/// ```
pub BAD_BIT_MASK,
Expand Down Expand Up @@ -65,7 +65,7 @@ declare_clippy_lint! {
/// uncommon).
///
/// **Example:**
/// ```rust
/// ```ignore
/// if (x | 1 > 3) { … }
/// ```
pub INEFFECTIVE_BIT_MASK,
Expand All @@ -83,7 +83,7 @@ declare_clippy_lint! {
/// **Known problems:** llvm generates better code for `x & 15 == 0` on x86
///
/// **Example:**
/// ```rust
/// ```ignore
/// x & 0x1111 == 0
/// ```
pub VERBOSE_BIT_MASK,
Expand Down
8 changes: 4 additions & 4 deletions clippy_lints/src/block_in_if_condition.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ declare_clippy_lint! {
///
/// **Example:**
/// ```rust
/// if { true } ..
/// if { true } { /* ... */ }
/// ```
pub BLOCK_IN_IF_CONDITION_EXPR,
style,
Expand All @@ -32,10 +32,10 @@ declare_clippy_lint! {
/// **Known problems:** None.
///
/// **Example:**
/// ```rust
/// if { let x = somefunc(); x } ..
/// ```ignore
/// if { let x = somefunc(); x } {}
/// // or
/// if somefunc(|x| { x == 47 }) ..
/// if somefunc(|x| { x == 47 }) {}
/// ```
pub BLOCK_IN_IF_CONDITION_STMT,
style,
Expand Down
4 changes: 2 additions & 2 deletions clippy_lints/src/booleans.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ declare_clippy_lint! {
/// `&&`. Ignores `|`, `&` and `^`.
///
/// **Example:**
/// ```rust
/// ```ignore
/// if a && true // should be: if a
/// if !(a == b) // should be: if a != b
/// ```
Expand All @@ -39,7 +39,7 @@ declare_clippy_lint! {
/// **Known problems:** Ignores short circuiting behavior.
///
/// **Example:**
/// ```rust
/// ```ignore
/// if a && b || a { ... }
/// ```
/// The `b` is unnecessary, the expression is equivalent to `if a`.
Expand Down
4 changes: 2 additions & 2 deletions clippy_lints/src/const_static_lifetime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ declare_clippy_lint! {
/// **Known problems:** None.
///
/// **Example:**
/// ```rust
/// ```ignore
/// const FOO: &'static [(&'static str, &'static str, fn(&Bar) -> bool)] =
/// &[...]
/// ```
/// This code can be rewritten as
/// ```rust
/// ```ignore
/// const FOO: &[(&str, &str, fn(&Bar) -> bool)] = &[...]
/// ```
pub CONST_STATIC_LIFETIME,
Expand Down
6 changes: 3 additions & 3 deletions clippy_lints/src/copies.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ declare_clippy_lint! {
/// **Known problems:** Hopefully none.
///
/// **Example:**
/// ```rust
/// ```ignore
/// if a == b {
/// …
/// } else if a == b {
Expand All @@ -29,7 +29,7 @@ declare_clippy_lint! {
/// Note that this lint ignores all conditions with a function call as it could
/// have side effects:
///
/// ```rust
/// ```ignore
/// if foo() {
/// …
/// } else if foo() { // not linted
Expand All @@ -50,7 +50,7 @@ declare_clippy_lint! {
/// **Known problems:** Hopefully none.
///
/// **Example:**
/// ```rust
/// ```ignore
/// let foo = if … {
/// 42
/// } else {
Expand Down
4 changes: 2 additions & 2 deletions clippy_lints/src/derive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ declare_clippy_lint! {
/// default-generated `Hash` implementation with an explicitly defined
/// `PartialEq`. In particular, the following must hold for any type:
///
/// ```rust
/// ```text
/// k1 == k2 ⇒ hash(k1) == hash(k2)
/// ```
///
/// **Known problems:** None.
///
/// **Example:**
/// ```rust
/// ```ignore
/// #[derive(Hash)]
/// struct Foo;
///
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/drop_forget_ref.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ declare_clippy_lint! {
/// **Known problems:** None.
///
/// **Example:**
/// ```rust
/// ```ignore
/// let mut lock_guard = mutex.lock();
/// std::mem::drop(&lock_guard) // Should have been drop(lock_guard), mutex
/// // still locked
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/enum_variants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ declare_clippy_lint! {
/// **Known problems:** None.
///
/// **Example:**
/// ```rust
/// ```ignore
/// // lib.rs
/// mod foo;
/// // foo.rs
Expand Down
4 changes: 2 additions & 2 deletions clippy_lints/src/eq_op.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ declare_clippy_lint! {
/// calls. We may introduce a whitelist of known pure functions in the future.
///
/// **Example:**
/// ```rust
/// ```ignore
/// x + 1 == x + 1
/// ```
pub EQ_OP,
Expand All @@ -37,7 +37,7 @@ declare_clippy_lint! {
/// **Known problems:** None
///
/// **Example:**
/// ```rust
/// ```ignore
/// &x == y
/// ```
pub OP_REF,
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/erasing_op.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ declare_clippy_lint! {
/// **Known problems:** None.
///
/// **Example:**
/// ```rust
/// ```ignore
/// 0 / x;
/// 0 * x;
/// x & 0
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 @@ -23,7 +23,7 @@ declare_clippy_lint! {
/// details.
///
/// **Example:**
/// ```rust
/// ```ignore
/// xs.map(|x| foo(x))
/// ```
/// where `foo(_)` is a plain function that takes the exact argument type of
Expand Down
3 changes: 2 additions & 1 deletion clippy_lints/src/indexing_slicing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ declare_clippy_lint! {
/// **Known problems:** Hopefully none.
///
/// **Example:**
/// ```rust
/// ```no_run
/// # #![allow(const_err)]
/// let x = [1, 2, 3, 4];
///
/// // Bad
Expand Down
6 changes: 4 additions & 2 deletions clippy_lints/src/infinite_iter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@ declare_clippy_lint! {
/// **Known problems:** None.
///
/// **Example:**
/// ```rust
/// repeat(1_u8).iter().collect::<Vec<_>>()
/// ```no_run
/// use std::iter;
///
/// iter::repeat(1_u8).collect::<Vec<_>>();
/// ```
pub INFINITE_ITER,
correctness,
Expand Down
4 changes: 2 additions & 2 deletions clippy_lints/src/invalid_ref.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ declare_clippy_lint! {
/// **Known problems:** None.
///
/// **Example:**
/// ```rust
/// let bad_ref: &usize = std::mem::zeroed();
/// ```no_run
/// let bad_ref: &usize = unsafe { std::mem::zeroed() };
/// ```
pub INVALID_REF,
correctness,
Expand Down
6 changes: 3 additions & 3 deletions clippy_lints/src/len_zero.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ declare_clippy_lint! {
/// **Known problems:** None.
///
/// **Example:**
/// ```rust
/// ```ignore
/// if x.len() == 0 {
/// ..
/// }
Expand All @@ -31,7 +31,7 @@ declare_clippy_lint! {
/// }
/// ```
/// instead use
/// ```rust
/// ```ignore
/// if x.is_empty() {
/// ..
/// }
Expand All @@ -57,7 +57,7 @@ declare_clippy_lint! {
/// **Known problems:** None.
///
/// **Example:**
/// ```rust
/// ```ignore
/// impl X {
/// pub fn len(&self) -> usize {
/// ..
Expand Down
8 changes: 4 additions & 4 deletions clippy_lints/src/literal_representation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ declare_clippy_lint! {
/// **Example:**
///
/// ```rust
/// 61864918973511
/// let x: u64 = 61864918973511;
/// ```
pub UNREADABLE_LITERAL,
style,
Expand All @@ -40,7 +40,7 @@ declare_clippy_lint! {
/// **Example:**
///
/// ```rust
/// 2_32
/// 2_32;
/// ```
pub MISTYPED_LITERAL_SUFFIXES,
correctness,
Expand All @@ -59,7 +59,7 @@ declare_clippy_lint! {
/// **Example:**
///
/// ```rust
/// 618_64_9189_73_511
/// let x: u64 = 618_64_9189_73_511;
/// ```
pub INCONSISTENT_DIGIT_GROUPING,
style,
Expand All @@ -78,7 +78,7 @@ declare_clippy_lint! {
/// **Example:**
///
/// ```rust
/// 6186491_8973511
/// let x: u64 = 6186491_8973511;
/// ```
pub LARGE_DIGIT_GROUPS,
pedantic,
Expand Down
Loading

0 comments on commit a9de64a

Please sign in to comment.