about summary refs log tree commit diff
path: root/clippy_dev
diff options
context:
space:
mode:
authorPhilipp Krones <hello@philkrones.com>2023-07-17 10:19:29 +0200
committerPhilipp Krones <hello@philkrones.com>2023-07-17 10:22:32 +0200
commitd6d530fd0b92ccec4a22e69cdebe6c4c942c8166 (patch)
tree6fd75fcf396b1f88a36558cc3534801083610893 /clippy_dev
parentfdb2e363d33e04aa306041e2c084e13c6ce489e1 (diff)
downloadrust-d6d530fd0b92ccec4a22e69cdebe6c4c942c8166.tar.gz
rust-d6d530fd0b92ccec4a22e69cdebe6c4c942c8166.zip
Merge commit 'd9c24d1b1ee61f276e550b967409c9f155eac4e3' into clippyup
Diffstat (limited to 'clippy_dev')
-rw-r--r--clippy_dev/src/new_lint.rs8
-rw-r--r--clippy_dev/src/setup/intellij.rs2
-rw-r--r--clippy_dev/src/update_lints.rs5
3 files changed, 11 insertions, 4 deletions
diff --git a/clippy_dev/src/new_lint.rs b/clippy_dev/src/new_lint.rs
index f11aa547bd7..f39bc06e6d7 100644
--- a/clippy_dev/src/new_lint.rs
+++ b/clippy_dev/src/new_lint.rs
@@ -358,6 +358,10 @@ fn create_lint_for_ty(lint: &LintData<'_>, enable_msrv: bool, ty: &str) -> io::R
 
     let mod_file_path = ty_dir.join("mod.rs");
     let context_import = setup_mod_file(&mod_file_path, lint)?;
+    let pass_lifetimes = match context_import {
+        "LateContext" => "<'_>",
+        _ => "",
+    };
 
     let name_upper = lint.name.to_uppercase();
     let mut lint_file_contents = String::new();
@@ -372,7 +376,7 @@ fn create_lint_for_ty(lint: &LintData<'_>, enable_msrv: bool, ty: &str) -> io::R
                 use super::{name_upper};
 
                 // TODO: Adjust the parameters as necessary
-                pub(super) fn check(cx: &{context_import}, msrv: &Msrv) {{
+                pub(super) fn check(cx: &{context_import}{pass_lifetimes}, msrv: &Msrv) {{
                     if !msrv.meets(todo!("Add a new entry in `clippy_utils/src/msrvs`")) {{
                         return;
                     }}
@@ -389,7 +393,7 @@ fn create_lint_for_ty(lint: &LintData<'_>, enable_msrv: bool, ty: &str) -> io::R
                 use super::{name_upper};
 
                 // TODO: Adjust the parameters as necessary
-                pub(super) fn check(cx: &{context_import}) {{
+                pub(super) fn check(cx: &{context_import}{pass_lifetimes}) {{
                     todo!();
                 }}
            "#
diff --git a/clippy_dev/src/setup/intellij.rs b/clippy_dev/src/setup/intellij.rs
index efdb158c21e..a7138f36a4e 100644
--- a/clippy_dev/src/setup/intellij.rs
+++ b/clippy_dev/src/setup/intellij.rs
@@ -37,7 +37,7 @@ impl ClippyProjectInfo {
 
 pub fn setup_rustc_src(rustc_path: &str) {
     let Ok(rustc_source_dir) = check_and_get_rustc_dir(rustc_path) else {
-        return
+        return;
     };
 
     for project in CLIPPY_PROJECTS {
diff --git a/clippy_dev/src/update_lints.rs b/clippy_dev/src/update_lints.rs
index 7213c9dfede..7c2e06ea69a 100644
--- a/clippy_dev/src/update_lints.rs
+++ b/clippy_dev/src/update_lints.rs
@@ -340,7 +340,10 @@ pub fn deprecate(name: &str, reason: Option<&String>) {
     let name_upper = name.to_uppercase();
 
     let (mut lints, deprecated_lints, renamed_lints) = gather_all();
-    let Some(lint) = lints.iter().find(|l| l.name == name_lower) else { eprintln!("error: failed to find lint `{name}`"); return; };
+    let Some(lint) = lints.iter().find(|l| l.name == name_lower) else {
+        eprintln!("error: failed to find lint `{name}`");
+        return;
+    };
 
     let mod_path = {
         let mut mod_path = PathBuf::from(format!("clippy_lints/src/{}", lint.module));