diff options
| author | bors <bors@rust-lang.org> | 2023-07-16 19:56:51 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2023-07-16 19:56:51 +0000 |
| commit | d9c24d1b1ee61f276e550b967409c9f155eac4e3 (patch) | |
| tree | 3d3868b1ab8554f2c8e93496d45e31b687c33755 | |
| parent | 1d334696587ac22b3a9e651e7ac684ac9e0697b2 (diff) | |
| parent | 498db80d5c391dd1206a5ba699b5b18df66f0331 (diff) | |
| download | rust-d9c24d1b1ee61f276e550b967409c9f155eac4e3.tar.gz rust-d9c24d1b1ee61f276e550b967409c9f155eac4e3.zip | |
Auto merge of #11169 - y21:new_lint_unelide_lifetimes, r=xFrednet
don't hide lifetimes for `LateContext` Running `cargo dev new_lint --type methods` creates the lint file with hidden lifetimes for the `LateContext` parameter (i.e. `&LateContext`, when it should be `&LateContext<'_>`). This is already warned on with `#![warn(rust_2018_idioms)]`, so clippy should not use hidden lifetimes changelog: none
| -rw-r--r-- | clippy_dev/src/new_lint.rs | 8 |
1 files changed, 6 insertions, 2 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!(); }} "# |
