Skip to content

Commit c6fb9c8

Browse files
committed
Hide variables in doc-test
1 parent 45fde0f commit c6fb9c8

File tree

1 file changed

+8
-8
lines changed
  • clippy_lints/src/methods

1 file changed

+8
-8
lines changed

clippy_lints/src/methods/mod.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -992,19 +992,19 @@ declare_clippy_lint! {
992992
/// **Example:**
993993
///
994994
/// ```rust
995-
/// let x: u32 = 100;
996-
///
997-
/// let add = x.checked_add(3).unwrap_or(u32::max_value());
998-
/// let sub = x.checked_sub(3).unwrap_or(u32::min_value());
995+
/// # let y: u32 = 0;
996+
/// # let x: u32 = 100;
997+
/// let add = x.checked_add(y).unwrap_or(u32::max_value());
998+
/// let sub = x.checked_sub(y).unwrap_or(u32::min_value());
999999
/// ```
10001000
///
10011001
/// can be written using dedicated methods for saturating addition/subtraction as:
10021002
///
10031003
/// ```rust
1004-
/// let x: u32 = 100;
1005-
///
1006-
/// let add = x.saturating_add(3);
1007-
/// let sub = x.saturating_sub(3);
1004+
/// # let y: u32 = 0;
1005+
/// # let x: u32 = 100;
1006+
/// let add = x.saturating_add(y);
1007+
/// let sub = x.saturating_sub(y);
10081008
/// ```
10091009
pub MANUAL_SATURATING_ARITHMETIC,
10101010
style,

0 commit comments

Comments
 (0)