diff --git a/clippy_lints/src/visibility.rs b/clippy_lints/src/visibility.rs index 635d0ab9652..43248bccc13 100644 --- a/clippy_lints/src/visibility.rs +++ b/clippy_lints/src/visibility.rs @@ -23,16 +23,18 @@ declare_clippy_lint! { /// ``` #[clippy::version = "1.72.0"] pub NEEDLESS_PUB_SELF, - complexity, + style, "checks for usage of `pub(self)` and `pub(in self)`." } declare_clippy_lint! { /// ### What it does - /// Checks for missing usage of the `pub(in )` shorthand. + /// Checks for usage of `pub()` with `in`. /// /// ### Why is this bad? /// Consistency. Use it or don't, just be consistent about it. /// + /// Also see the `pub_without_shorthand` lint for an alternative. + /// /// ### Example /// ```rust,ignore /// pub(super) type OptBox = Option>; @@ -44,11 +46,11 @@ declare_clippy_lint! { #[clippy::version = "1.72.0"] pub PUB_WITH_SHORTHAND, restriction, - "disallows usage of the `pub()`, suggesting use of the `in` shorthand" + "disallows usage of `pub()`, without `in`" } declare_clippy_lint! { /// ### What it does - /// Checks for usage of the `pub(in )` shorthand. + /// Checks for usage of `pub()` without `in`. /// /// Note: As you cannot write a module's path in `pub()`, this will only trigger on /// `pub(super)` and the like. @@ -56,6 +58,8 @@ declare_clippy_lint! { /// ### Why is this bad? /// Consistency. Use it or don't, just be consistent about it. /// + /// Also see the `pub_with_shorthand` lint for an alternative. + /// /// ### Example /// ```rust,ignore /// pub(in super) type OptBox = Option>; @@ -67,7 +71,7 @@ declare_clippy_lint! { #[clippy::version = "1.72.0"] pub PUB_WITHOUT_SHORTHAND, restriction, - "disallows usage of the `pub(in )` shorthand wherever possible" + "disallows usage of `pub(in )` with `in`" } declare_lint_pass!(Visibility => [NEEDLESS_PUB_SELF, PUB_WITH_SHORTHAND, PUB_WITHOUT_SHORTHAND]); diff --git a/tests/ui/needless_pub_self.fixed b/tests/ui/needless_pub_self.fixed index bf5e70d9a05..672b4c318a8 100644 --- a/tests/ui/needless_pub_self.fixed +++ b/tests/ui/needless_pub_self.fixed @@ -1,5 +1,5 @@ //@run-rustfix -//@aux-build:proc_macros.rs +//@aux-build:proc_macros.rs:proc-macro #![feature(custom_inner_attributes)] #![allow(unused)] #![warn(clippy::needless_pub_self)] diff --git a/tests/ui/needless_pub_self.rs b/tests/ui/needless_pub_self.rs index a49a6658f8b..5ac1edf8e99 100644 --- a/tests/ui/needless_pub_self.rs +++ b/tests/ui/needless_pub_self.rs @@ -1,5 +1,5 @@ //@run-rustfix -//@aux-build:proc_macros.rs +//@aux-build:proc_macros.rs:proc-macro #![feature(custom_inner_attributes)] #![allow(unused)] #![warn(clippy::needless_pub_self)] diff --git a/tests/ui/pub_with_shorthand.fixed b/tests/ui/pub_with_shorthand.fixed index c9487ed7fc3..a774faa0a67 100644 --- a/tests/ui/pub_with_shorthand.fixed +++ b/tests/ui/pub_with_shorthand.fixed @@ -1,5 +1,5 @@ //@run-rustfix -//@aux-build:proc_macros.rs +//@aux-build:proc_macros.rs:proc-macro #![feature(custom_inner_attributes)] #![allow(clippy::needless_pub_self, unused)] #![warn(clippy::pub_with_shorthand)] diff --git a/tests/ui/pub_with_shorthand.rs b/tests/ui/pub_with_shorthand.rs index e47c926520b..4a4bbc18728 100644 --- a/tests/ui/pub_with_shorthand.rs +++ b/tests/ui/pub_with_shorthand.rs @@ -1,5 +1,5 @@ //@run-rustfix -//@aux-build:proc_macros.rs +//@aux-build:proc_macros.rs:proc-macro #![feature(custom_inner_attributes)] #![allow(clippy::needless_pub_self, unused)] #![warn(clippy::pub_with_shorthand)] diff --git a/tests/ui/pub_without_shorthand.fixed b/tests/ui/pub_without_shorthand.fixed index 55159efb5bf..fdb49ac4d90 100644 --- a/tests/ui/pub_without_shorthand.fixed +++ b/tests/ui/pub_without_shorthand.fixed @@ -1,5 +1,5 @@ //@run-rustfix -//@aux-build:proc_macros.rs +//@aux-build:proc_macros.rs:proc-macro #![feature(custom_inner_attributes)] #![allow(clippy::needless_pub_self, unused)] #![warn(clippy::pub_without_shorthand)] diff --git a/tests/ui/pub_without_shorthand.rs b/tests/ui/pub_without_shorthand.rs index 38f4da85a49..1f2ef7ece39 100644 --- a/tests/ui/pub_without_shorthand.rs +++ b/tests/ui/pub_without_shorthand.rs @@ -1,5 +1,5 @@ //@run-rustfix -//@aux-build:proc_macros.rs +//@aux-build:proc_macros.rs:proc-macro #![feature(custom_inner_attributes)] #![allow(clippy::needless_pub_self, unused)] #![warn(clippy::pub_without_shorthand)]