Skip to content

Commit 2f48eff

Browse files
committed
Doctests: Enable running doc tests for nursery lints
1 parent 5c1e30a commit 2f48eff

File tree

5 files changed

+29
-10
lines changed

5 files changed

+29
-10
lines changed

clippy_lints/src/attrs.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -113,19 +113,19 @@ declare_clippy_lint! {
113113
///
114114
/// **Example:**
115115
/// ```rust
116-
/// // Bad
117-
/// #[inline(always)]
118-
///
119-
/// fn not_quite_good_code(..) { ... }
120-
///
121116
/// // Good (as inner attribute)
122117
/// #![inline(always)]
123118
///
124-
/// fn this_is_fine(..) { ... }
119+
/// fn this_is_fine() { }
120+
///
121+
/// // Bad
122+
/// #[inline(always)]
123+
///
124+
/// fn not_quite_good_code() { }
125125
///
126126
/// // Good (as outer attribute)
127127
/// #[inline(always)]
128-
/// fn this_is_fine_too(..) { ... }
128+
/// fn this_is_fine_too() { }
129129
/// ```
130130
pub EMPTY_LINE_AFTER_OUTER_ATTR,
131131
nursery,

clippy_lints/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ macro_rules! declare_clippy_lint {
125125
};
126126
{ $(#[$attr:meta])* pub $name:tt, nursery, $description:tt } => {
127127
declare_tool_lint! {
128-
pub clippy::$name, Allow, $description, report_in_external_macro: true
128+
$(#[$attr])* pub clippy::$name, Allow, $description, report_in_external_macro: true
129129
}
130130
};
131131
{ $(#[$attr:meta])* pub $name:tt, internal, $description:tt } => {

clippy_lints/src/missing_const_for_fn.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,17 +40,27 @@ declare_clippy_lint! {
4040
/// **Example:**
4141
///
4242
/// ```rust
43+
/// # struct Foo {
44+
/// # random_number: usize,
45+
/// # }
46+
/// # impl Foo {
4347
/// fn new() -> Self {
4448
/// Self { random_number: 42 }
4549
/// }
50+
/// # }
4651
/// ```
4752
///
4853
/// Could be a const fn:
4954
///
5055
/// ```rust
56+
/// # struct Foo {
57+
/// # random_number: usize,
58+
/// # }
59+
/// # impl Foo {
5160
/// const fn new() -> Self {
5261
/// Self { random_number: 42 }
5362
/// }
63+
/// # }
5464
/// ```
5565
pub MISSING_CONST_FOR_FN,
5666
nursery,

clippy_lints/src/mutex_atomic.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ declare_clippy_lint! {
4444
///
4545
/// **Example:**
4646
/// ```rust
47+
/// # use std::sync::Mutex;
4748
/// let x = Mutex::new(0usize);
4849
/// ```
4950
pub MUTEX_INTEGER,

clippy_lints/src/redundant_clone.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ declare_clippy_lint! {
4040
/// * False-positive if there is a borrow preventing the value from moving out.
4141
///
4242
/// ```rust
43+
/// # fn foo(x: String) {}
4344
/// let x = String::new();
4445
///
4546
/// let y = &x;
@@ -49,15 +50,22 @@ declare_clippy_lint! {
4950
///
5051
/// **Example:**
5152
/// ```rust
53+
/// # use std::path::Path;
54+
/// # #[derive(Clone)]
55+
/// # struct Foo;
56+
/// # impl Foo {
57+
/// # fn new() -> Self { Foo {} }
58+
/// # }
59+
/// # fn call(x: Foo) {}
5260
/// {
5361
/// let x = Foo::new();
5462
/// call(x.clone());
5563
/// call(x.clone()); // this can just pass `x`
5664
/// }
5765
///
58-
/// ["lorem", "ipsum"].join(" ").to_string()
66+
/// ["lorem", "ipsum"].join(" ").to_string();
5967
///
60-
/// Path::new("/a/b").join("c").to_path_buf()
68+
/// Path::new("/a/b").join("c").to_path_buf();
6169
/// ```
6270
pub REDUNDANT_CLONE,
6371
nursery,

0 commit comments

Comments
 (0)