about summary refs log tree commit diff
path: root/src/tools/clippy/tests/ui-internal/check_formulation.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools/clippy/tests/ui-internal/check_formulation.rs')
-rw-r--r--src/tools/clippy/tests/ui-internal/check_formulation.rs54
1 files changed, 54 insertions, 0 deletions
diff --git a/src/tools/clippy/tests/ui-internal/check_formulation.rs b/src/tools/clippy/tests/ui-internal/check_formulation.rs
new file mode 100644
index 00000000000..43fc996033e
--- /dev/null
+++ b/src/tools/clippy/tests/ui-internal/check_formulation.rs
@@ -0,0 +1,54 @@
+#![warn(clippy::almost_standard_lint_formulation)]
+#![feature(rustc_private)]
+
+#[macro_use]
+extern crate rustc_middle;
+#[macro_use]
+extern crate rustc_session;
+extern crate rustc_lint;
+
+declare_tool_lint! {
+    /// # What it does
+    ///
+    /// Checks for usage of correct lint formulations
+    #[clippy::version = "pre 1.29.0"]
+    pub clippy::VALID,
+    Warn,
+    "One",
+    report_in_external_macro: true
+}
+
+declare_tool_lint! {
+    /// # What it does
+    /// Check for lint formulations that are correct
+    #[clippy::version = "pre 1.29.0"]
+    pub clippy::INVALID1,
+    Warn,
+    "One",
+    report_in_external_macro: true
+}
+
+declare_tool_lint! {
+    /// # What it does
+    /// Detects uses of incorrect formulations
+    #[clippy::version = "pre 1.29.0"]
+    pub clippy::INVALID2,
+    Warn,
+    "One",
+    report_in_external_macro: true
+}
+
+declare_tool_lint! {
+    /// # What it does
+    /// Detects uses of incorrect formulations (allowed with attribute)
+    #[allow(clippy::almost_standard_lint_formulation)]
+    #[clippy::version = "pre 1.29.0"]
+    pub clippy::ALLOWED_INVALID,
+    Warn,
+    "One",
+    report_in_external_macro: true
+}
+
+declare_lint_pass!(Pass => [VALID, INVALID1, INVALID2]);
+
+fn main() {}