Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doctests: Enable running doc tests for nursery lints #4330

Merged
merged 1 commit into from
Aug 5, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions clippy_lints/src/attrs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,19 +113,19 @@ declare_clippy_lint! {
///
/// **Example:**
/// ```rust
/// // Bad
/// #[inline(always)]
///
/// fn not_quite_good_code(..) { ... }
///
/// // Good (as inner attribute)
/// #![inline(always)]
///
/// fn this_is_fine(..) { ... }
/// fn this_is_fine() { }
///
/// // Bad
/// #[inline(always)]
///
/// fn not_quite_good_code() { }
///
/// // Good (as outer attribute)
/// #[inline(always)]
/// fn this_is_fine_too(..) { ... }
/// fn this_is_fine_too() { }
/// ```
pub EMPTY_LINE_AFTER_OUTER_ATTR,
nursery,
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ macro_rules! declare_clippy_lint {
};
{ $(#[$attr:meta])* pub $name:tt, nursery, $description:tt } => {
declare_tool_lint! {
pub clippy::$name, Allow, $description, report_in_external_macro: true
$(#[$attr])* pub clippy::$name, Allow, $description, report_in_external_macro: true
}
};
{ $(#[$attr:meta])* pub $name:tt, internal, $description:tt } => {
Expand Down
10 changes: 10 additions & 0 deletions clippy_lints/src/missing_const_for_fn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,17 +40,27 @@ declare_clippy_lint! {
/// **Example:**
///
/// ```rust
/// # struct Foo {
/// # random_number: usize,
/// # }
/// # impl Foo {
/// fn new() -> Self {
/// Self { random_number: 42 }
/// }
/// # }
/// ```
///
/// Could be a const fn:
///
/// ```rust
/// # struct Foo {
/// # random_number: usize,
/// # }
/// # impl Foo {
/// const fn new() -> Self {
/// Self { random_number: 42 }
/// }
/// # }
/// ```
pub MISSING_CONST_FOR_FN,
nursery,
Expand Down
1 change: 1 addition & 0 deletions clippy_lints/src/mutex_atomic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ declare_clippy_lint! {
///
/// **Example:**
/// ```rust
/// # use std::sync::Mutex;
/// let x = Mutex::new(0usize);
/// ```
pub MUTEX_INTEGER,
Expand Down
12 changes: 10 additions & 2 deletions clippy_lints/src/redundant_clone.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ declare_clippy_lint! {
/// * False-positive if there is a borrow preventing the value from moving out.
///
/// ```rust
/// # fn foo(x: String) {}
/// let x = String::new();
///
/// let y = &x;
Expand All @@ -49,15 +50,22 @@ declare_clippy_lint! {
///
/// **Example:**
/// ```rust
/// # use std::path::Path;
/// # #[derive(Clone)]
/// # struct Foo;
/// # impl Foo {
/// # fn new() -> Self { Foo {} }
/// # }
/// # fn call(x: Foo) {}
/// {
/// let x = Foo::new();
/// call(x.clone());
/// call(x.clone()); // this can just pass `x`
/// }
///
/// ["lorem", "ipsum"].join(" ").to_string()
/// ["lorem", "ipsum"].join(" ").to_string();
///
/// Path::new("/a/b").join("c").to_path_buf()
/// Path::new("/a/b").join("c").to_path_buf();
/// ```
pub REDUNDANT_CLONE,
nursery,
Expand Down