Skip to content

Commit

Permalink
Change category and update to ui_test
Browse files Browse the repository at this point in the history
  • Loading branch information
Centri3 committed Jun 28, 2023
1 parent 8296a33 commit 46aa8ab
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 11 deletions.
14 changes: 9 additions & 5 deletions clippy_lints/src/visibility.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 <loc>)` shorthand.
/// Checks for usage of `pub(<loc>)` 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<T> = Option<Box<T>>;
Expand All @@ -44,18 +46,20 @@ declare_clippy_lint! {
#[clippy::version = "1.72.0"]
pub PUB_WITH_SHORTHAND,
restriction,
"disallows usage of the `pub(<loc>)`, suggesting use of the `in` shorthand"
"disallows usage of `pub(<loc>)`, without `in`"
}
declare_clippy_lint! {
/// ### What it does
/// Checks for usage of the `pub(in <loc>)` shorthand.
/// Checks for usage of `pub(<loc>)` without `in`.
///
/// Note: As you cannot write a module's path in `pub(<loc>)`, this will only trigger on
/// `pub(super)` and the like.
///
/// ### 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<T> = Option<Box<T>>;
Expand All @@ -67,7 +71,7 @@ declare_clippy_lint! {
#[clippy::version = "1.72.0"]
pub PUB_WITHOUT_SHORTHAND,
restriction,
"disallows usage of the `pub(in <loc>)` shorthand wherever possible"
"disallows usage of `pub(in <loc>)` with `in`"
}
declare_lint_pass!(Visibility => [NEEDLESS_PUB_SELF, PUB_WITH_SHORTHAND, PUB_WITHOUT_SHORTHAND]);

Expand Down
2 changes: 1 addition & 1 deletion tests/ui/needless_pub_self.fixed
Original file line number Diff line number Diff line change
@@ -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)]
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/needless_pub_self.rs
Original file line number Diff line number Diff line change
@@ -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)]
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/pub_with_shorthand.fixed
Original file line number Diff line number Diff line change
@@ -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)]
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/pub_with_shorthand.rs
Original file line number Diff line number Diff line change
@@ -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)]
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/pub_without_shorthand.fixed
Original file line number Diff line number Diff line change
@@ -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)]
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/pub_without_shorthand.rs
Original file line number Diff line number Diff line change
@@ -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)]
Expand Down

0 comments on commit 46aa8ab

Please sign in to comment.