about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorblyxyas <blyxyas@gmail.com>2024-09-07 12:13:03 +0200
committerblyxyas <blyxyas@gmail.com>2024-10-19 16:20:51 +0200
commit637d5cc56fcc11afadd4ffaefa237c11f47cdfee (patch)
tree7a7aac9650257f6419d7208b78221db9f74809b6 /src
parent71b4d108c7e71c15c0f61d737ebdc0e1cf559d3c (diff)
downloadrust-637d5cc56fcc11afadd4ffaefa237c11f47cdfee.tar.gz
rust-637d5cc56fcc11afadd4ffaefa237c11f47cdfee.zip
Remove module passes filtering
Diffstat (limited to 'src')
-rw-r--r--src/librustdoc/lint.rs7
-rw-r--r--src/tools/clippy/clippy_lints/src/cognitive_complexity.rs4
-rw-r--r--src/tools/clippy/clippy_lints/src/ctfe.rs51
-rw-r--r--src/tools/clippy/clippy_lints/src/lib.rs2
-rw-r--r--src/tools/clippy/clippy_lints/src/utils/author.rs1
5 files changed, 25 insertions, 40 deletions
diff --git a/src/librustdoc/lint.rs b/src/librustdoc/lint.rs
index 679fc45df76..2afb9e549d9 100644
--- a/src/librustdoc/lint.rs
+++ b/src/librustdoc/lint.rs
@@ -2,7 +2,7 @@ use std::sync::LazyLock as Lazy;
 
 use rustc_data_structures::fx::FxHashMap;
 use rustc_lint::LintStore;
-use rustc_lint_defs::{Lint, LintId, LintPass, declare_tool_lint};
+use rustc_lint_defs::{Lint, LintId, declare_tool_lint};
 use rustc_session::{Session, lint};
 
 /// This function is used to setup the lint initialization. By default, in rustdoc, everything
@@ -31,10 +31,9 @@ where
     allowed_lints.extend(lint_opts.iter().map(|(lint, _)| lint).cloned());
 
     let lints = || {
-        lint::builtin::HardwiredLints::default()
-            .get_lints()
+        lint::builtin::HardwiredLints::lint_vec()
             .into_iter()
-            .chain(rustc_lint::SoftLints::default().get_lints())
+            .chain(rustc_lint::SoftLints::lint_vec())
     };
 
     let lint_opts = lints()
diff --git a/src/tools/clippy/clippy_lints/src/cognitive_complexity.rs b/src/tools/clippy/clippy_lints/src/cognitive_complexity.rs
index b027c289a7f..91cb8b78ba8 100644
--- a/src/tools/clippy/clippy_lints/src/cognitive_complexity.rs
+++ b/src/tools/clippy/clippy_lints/src/cognitive_complexity.rs
@@ -25,7 +25,7 @@ pub static COGNITIVE_COMPLEXITY: &Lint = &Lint {
     future_incompatible: None,
     is_externally_loaded: true,
     crate_level_only: false,
-    loadbearing: true,
+    eval_always: true,
     ..Lint::default_fields_for_macro()
 };
 pub(crate) static COGNITIVE_COMPLEXITY_INFO: &'static LintInfo = &LintInfo {
@@ -44,7 +44,7 @@ Sometimes it's hard to find a way to reduce the complexity.
 ### Example
 You'll see it when you get the warning.",
     version: Some("1.35.0"),
-    location: "#L0",
+    location: "clippy_lints/src/cognitive_complexity.rs#L47",
 };
 
 pub struct CognitiveComplexity {
diff --git a/src/tools/clippy/clippy_lints/src/ctfe.rs b/src/tools/clippy/clippy_lints/src/ctfe.rs
index 7b9f71810a9..ddb4eb82165 100644
--- a/src/tools/clippy/clippy_lints/src/ctfe.rs
+++ b/src/tools/clippy/clippy_lints/src/ctfe.rs
@@ -1,41 +1,28 @@
 use rustc_hir::def_id::LocalDefId;
 use rustc_hir::intravisit::FnKind;
 use rustc_hir::{Body, FnDecl};
-use rustc_lint::{LateContext, LateLintPass};
+use rustc_lint::Level::Deny;
+use rustc_lint::{LateContext, LateLintPass, Lint};
 use rustc_session::declare_lint_pass;
 use rustc_span::Span;
 
-declare_clippy_lint! {
-    /// ### What it does
-    /// Checks for comparisons where one side of the relation is
-    /// either the minimum or maximum value for its type and warns if it involves a
-    /// case that is always true or always false. Only integer and boolean types are
-    /// checked.
-    ///
-    /// ### Why is this bad?
-    /// An expression like `min <= x` may misleadingly imply
-    /// that it is possible for `x` to be less than the minimum. Expressions like
-    /// `max < x` are probably mistakes.
-    ///
-    /// ### Known problems
-    /// For `usize` the size of the current compile target will
-    /// be assumed (e.g., 64 bits on 64 bit systems). This means code that uses such
-    /// a comparison to detect target pointer width will trigger this lint. One can
-    /// use `mem::sizeof` and compare its value or conditional compilation
-    /// attributes
-    /// like `#[cfg(target_pointer_width = "64")] ..` instead.
-    ///
-    /// ### Example
-    /// ```no_run
-    /// let vec: Vec<isize> = Vec::new();
-    /// if vec.len() <= 0 {}
-    /// if 100 > i32::MAX {}
-    /// ```
-    #[clippy::version = "1.82.0"]
-    pub CLIPPY_CTFE,
-    correctness,
-    "a comparison with a maximum or minimum value that is always true or false"
-}
+/// Ensures that Constant-time Function Evaluation is being done (specifically, MIR lint passes).
+/// See rust-lang/rust#125116 for more info.
+#[clippy::version = "1.82.0"]
+pub static CLIPPY_CTFE: &Lint = &Lint {
+    name: &"clippy::CLIPPY_CTFE",
+    default_level: Deny,
+    desc: "Ensure CTFE is being made",
+    edition_lint_opts: None,
+    report_in_external_macro: true,
+    future_incompatible: None,
+    is_externally_loaded: true,
+    crate_level_only: false,
+    eval_always: true,
+    ..Lint::default_fields_for_macro()
+};
+
+// No static CLIPPY_CTFE_INFO because we want this lint to be invisible
 
 declare_lint_pass! { ClippyCtfe => [CLIPPY_CTFE] }
 
diff --git a/src/tools/clippy/clippy_lints/src/lib.rs b/src/tools/clippy/clippy_lints/src/lib.rs
index a5d2f6a4122..88a227f5b6d 100644
--- a/src/tools/clippy/clippy_lints/src/lib.rs
+++ b/src/tools/clippy/clippy_lints/src/lib.rs
@@ -65,7 +65,7 @@ extern crate clippy_utils;
 #[cfg_attr(feature = "internal", allow(clippy::missing_clippy_version_attribute))]
 mod utils;
 
-pub mod ctfe; // VERY important lint (rust#125116)
+pub mod ctfe; // Very important lint (rust#125116)
 pub mod declared_lints;
 pub mod deprecated_lints;
 
diff --git a/src/tools/clippy/clippy_lints/src/utils/author.rs b/src/tools/clippy/clippy_lints/src/utils/author.rs
index f4e166327af..31f9d84f5e4 100644
--- a/src/tools/clippy/clippy_lints/src/utils/author.rs
+++ b/src/tools/clippy/clippy_lints/src/utils/author.rs
@@ -798,4 +798,3 @@ fn path_to_string(path: &QPath<'_>) -> Result<String, ()> {
     inner(&mut s, path)?;
     Ok(s)
 }
-