@@ -511,7 +511,10 @@ declare_clippy_lint! {
511511 /// **Known problems:** None.
512512 ///
513513 /// **Example:**
514- /// ```ignore
514+ /// ```rust
515+ /// # fn foo() {};
516+ /// # fn bar() {};
517+ /// # fn baz() {};
515518 /// if {
516519 /// foo();
517520 /// } == {
@@ -521,7 +524,10 @@ declare_clippy_lint! {
521524 /// }
522525 /// ```
523526 /// is equal to
524- /// ```ignore
527+ /// ```rust
528+ /// # fn foo() {};
529+ /// # fn bar() {};
530+ /// # fn baz() {};
525531 /// {
526532 /// foo();
527533 /// bar();
@@ -850,13 +856,13 @@ declare_clippy_lint! {
850856 ///
851857 /// **Example**
852858 ///
853- /// ```ignore
859+ /// ```rust
854860 /// // Bad
855- /// fn fun() -> i32 {}
861+ /// fn fun() -> i32 { 1 }
856862 /// let a = fun as i64;
857863 ///
858864 /// // Good
859- /// fn fun2() -> i32 {}
865+ /// fn fun2() -> i32 { 1 }
860866 /// let a = fun2 as usize;
861867 /// ```
862868 pub FN_TO_NUMERIC_CAST ,
@@ -1538,9 +1544,11 @@ declare_clippy_lint! {
15381544 /// like `#[cfg(target_pointer_width = "64")] ..` instead.
15391545 ///
15401546 /// **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 {}
15441552 /// ```
15451553 pub ABSURD_EXTREME_COMPARISONS ,
15461554 correctness,
@@ -1963,10 +1971,13 @@ declare_clippy_lint! {
19631971 /// pieces of code, possibly including external crates.
19641972 ///
19651973 /// **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> { }
19681979 ///
1969- /// pub foo(map: &mut HashMap<i32, i32>) { .. }
1980+ /// pub fn foo(map: &mut HashMap<i32, i32>) { }
19701981 /// ```
19711982 pub IMPLICIT_HASHER ,
19721983 style,
@@ -2304,7 +2315,7 @@ declare_clippy_lint! {
23042315 /// **Known problems:** None.
23052316 ///
23062317 /// **Example:**
2307- /// ```ignore
2318+ /// ```rust, ignore
23082319 /// fn x(r: &i32) {
23092320 /// unsafe {
23102321 /// *(r as *const _ as *mut _) += 1;
@@ -2314,7 +2325,9 @@ declare_clippy_lint! {
23142325 ///
23152326 /// Instead consider using interior mutability types.
23162327 ///
2317- /// ```ignore
2328+ /// ```rust
2329+ /// use std::cell::UnsafeCell;
2330+ ///
23182331 /// fn x(r: &UnsafeCell<i32>) {
23192332 /// unsafe {
23202333 /// *r.get() += 1;
0 commit comments