@@ -511,7 +511,10 @@ declare_clippy_lint! {
511
511
/// **Known problems:** None.
512
512
///
513
513
/// **Example:**
514
- /// ```ignore
514
+ /// ```rust
515
+ /// # fn foo() {};
516
+ /// # fn bar() {};
517
+ /// # fn baz() {};
515
518
/// if {
516
519
/// foo();
517
520
/// } == {
@@ -521,7 +524,10 @@ declare_clippy_lint! {
521
524
/// }
522
525
/// ```
523
526
/// is equal to
524
- /// ```ignore
527
+ /// ```rust
528
+ /// # fn foo() {};
529
+ /// # fn bar() {};
530
+ /// # fn baz() {};
525
531
/// {
526
532
/// foo();
527
533
/// bar();
@@ -850,13 +856,13 @@ declare_clippy_lint! {
850
856
///
851
857
/// **Example**
852
858
///
853
- /// ```ignore
859
+ /// ```rust
854
860
/// // Bad
855
- /// fn fun() -> i32 {}
861
+ /// fn fun() -> i32 { 1 }
856
862
/// let a = fun as i64;
857
863
///
858
864
/// // Good
859
- /// fn fun2() -> i32 {}
865
+ /// fn fun2() -> i32 { 1 }
860
866
/// let a = fun2 as usize;
861
867
/// ```
862
868
pub FN_TO_NUMERIC_CAST ,
@@ -1538,9 +1544,11 @@ declare_clippy_lint! {
1538
1544
/// like `#[cfg(target_pointer_width = "64")] ..` instead.
1539
1545
///
1540
1546
/// **Example:**
1541
- /// ```rust,ignore
1542
- /// vec.len() <= 0
1543
- /// 100 > std::i32::MAX
1547
+ ///
1548
+ /// ```rust
1549
+ /// let vec: Vec<isize> = vec![];
1550
+ /// if vec.len() <= 0 {}
1551
+ /// if 100 > std::i32::MAX {}
1544
1552
/// ```
1545
1553
pub ABSURD_EXTREME_COMPARISONS ,
1546
1554
correctness,
@@ -1963,10 +1971,13 @@ declare_clippy_lint! {
1963
1971
/// pieces of code, possibly including external crates.
1964
1972
///
1965
1973
/// **Example:**
1966
- /// ```ignore
1967
- /// impl<K: Hash + Eq, V> Serialize for HashMap<K, V> { ... }
1974
+ /// ```rust
1975
+ /// # use std::collections::HashMap;
1976
+ /// # use std::hash::Hash;
1977
+ /// # trait Serialize {};
1978
+ /// impl<K: Hash + Eq, V> Serialize for HashMap<K, V> { }
1968
1979
///
1969
- /// pub foo(map: &mut HashMap<i32, i32>) { .. }
1980
+ /// pub fn foo(map: &mut HashMap<i32, i32>) { }
1970
1981
/// ```
1971
1982
pub IMPLICIT_HASHER ,
1972
1983
style,
@@ -2304,7 +2315,7 @@ declare_clippy_lint! {
2304
2315
/// **Known problems:** None.
2305
2316
///
2306
2317
/// **Example:**
2307
- /// ```ignore
2318
+ /// ```rust, ignore
2308
2319
/// fn x(r: &i32) {
2309
2320
/// unsafe {
2310
2321
/// *(r as *const _ as *mut _) += 1;
@@ -2314,7 +2325,9 @@ declare_clippy_lint! {
2314
2325
///
2315
2326
/// Instead consider using interior mutability types.
2316
2327
///
2317
- /// ```ignore
2328
+ /// ```rust
2329
+ /// use std::cell::UnsafeCell;
2330
+ ///
2318
2331
/// fn x(r: &UnsafeCell<i32>) {
2319
2332
/// unsafe {
2320
2333
/// *r.get() += 1;
0 commit comments