From 85a18289431d245437d80b3006ec499c23e62400 Mon Sep 17 00:00:00 2001 From: Urgau Date: Fri, 19 May 2023 11:19:31 +0200 Subject: [PATCH] Rename `forget_copy` lint to `forgetting_copy_types` --- compiler/rustc_lint/messages.ftl | 2 +- .../rustc_lint/src/drop_forget_useless.rs | 8 +++---- compiler/rustc_lint/src/lints.rs | 2 +- .../clippy_lints/src/drop_forget_ref.rs | 2 +- .../clippy/clippy_lints/src/renamed_lints.rs | 2 +- src/tools/clippy/tests/ui/mem_forget.rs | 2 +- src/tools/clippy/tests/ui/rename.fixed | 4 ++-- src/tools/clippy/tests/ui/rename.rs | 2 +- src/tools/clippy/tests/ui/rename.stderr | 4 ++-- tests/ui/consts/const_forget.rs | 2 +- tests/ui/consts/issue-104155.rs | 2 +- ...orget_copy.rs => forgetting_copy_types.rs} | 2 +- ...py.stderr => forgetting_copy_types.stderr} | 22 +++++++++---------- 13 files changed, 28 insertions(+), 28 deletions(-) rename tests/ui/lint/{forget_copy.rs => forgetting_copy_types.rs} (97%) rename tests/ui/lint/{forget_copy.stderr => forgetting_copy_types.stderr} (83%) diff --git a/compiler/rustc_lint/messages.ftl b/compiler/rustc_lint/messages.ftl index 169c1fbe2ac..f60d48e1024 100644 --- a/compiler/rustc_lint/messages.ftl +++ b/compiler/rustc_lint/messages.ftl @@ -533,6 +533,6 @@ lint_forget_ref = calls to `std::mem::forget` with a reference instead of an own .label = argument has type `{$arg_ty}` .note = use `let _ = ...` to ignore the expression or result -lint_forget_copy = calls to `std::mem::forget` with a value that implements `Copy` does nothing +lint_forgetting_copy_types = calls to `std::mem::forget` with a value that implements `Copy` does nothing .label = argument has type `{$arg_ty}` .note = use `let _ = ...` to ignore the expression or result diff --git a/compiler/rustc_lint/src/drop_forget_useless.rs b/compiler/rustc_lint/src/drop_forget_useless.rs index e61adc61e5e..8f3f4914dde 100644 --- a/compiler/rustc_lint/src/drop_forget_useless.rs +++ b/compiler/rustc_lint/src/drop_forget_useless.rs @@ -82,7 +82,7 @@ declare_lint! { } declare_lint! { - /// The `forget_copy` lint checks for calls to `std::mem::forget` with a value + /// The `forgetting_copy_types` lint checks for calls to `std::mem::forget` with a value /// that derives the Copy trait. /// /// ### Example @@ -104,12 +104,12 @@ declare_lint! { /// An alternative, but also valid, explanation is that Copy types do not /// implement the Drop trait, which means they have no destructors. Without a /// destructor, there is nothing for `std::mem::forget` to ignore. - pub FORGET_COPY, + pub FORGETTING_COPY_TYPES, Warn, "calls to `std::mem::forget` with a value that implements Copy" } -declare_lint_pass!(DropForgetUseless => [DROP_REF, FORGET_REF, DROPPING_COPY_TYPES, FORGET_COPY]); +declare_lint_pass!(DropForgetUseless => [DROP_REF, FORGET_REF, DROPPING_COPY_TYPES, FORGETTING_COPY_TYPES]); impl<'tcx> LateLintPass<'tcx> for DropForgetUseless { fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'tcx>) { @@ -132,7 +132,7 @@ impl<'tcx> LateLintPass<'tcx> for DropForgetUseless { cx.emit_spanned_lint(DROPPING_COPY_TYPES, expr.span, DropCopyDiag { arg_ty, label: arg.span }); } sym::mem_forget if is_copy => { - cx.emit_spanned_lint(FORGET_COPY, expr.span, ForgetCopyDiag { arg_ty, label: arg.span }); + cx.emit_spanned_lint(FORGETTING_COPY_TYPES, expr.span, ForgetCopyDiag { arg_ty, label: arg.span }); } _ => return, }; diff --git a/compiler/rustc_lint/src/lints.rs b/compiler/rustc_lint/src/lints.rs index 278c0bc32e9..16c81273ef2 100644 --- a/compiler/rustc_lint/src/lints.rs +++ b/compiler/rustc_lint/src/lints.rs @@ -691,7 +691,7 @@ pub struct ForgetRefDiag<'a> { } #[derive(LintDiagnostic)] -#[diag(lint_forget_copy)] +#[diag(lint_forgetting_copy_types)] #[note] pub struct ForgetCopyDiag<'a> { pub arg_ty: Ty<'a>, diff --git a/src/tools/clippy/clippy_lints/src/drop_forget_ref.rs b/src/tools/clippy/clippy_lints/src/drop_forget_ref.rs index 9a7b39e1544..db1b8494890 100644 --- a/src/tools/clippy/clippy_lints/src/drop_forget_ref.rs +++ b/src/tools/clippy/clippy_lints/src/drop_forget_ref.rs @@ -98,7 +98,7 @@ impl<'tcx> LateLintPass<'tcx> for DropForgetRef { let is_copy = is_copy(cx, arg_ty); let drop_is_single_call_in_arm = is_single_call_in_arm(cx, arg, expr); let (lint, msg) = match fn_name { - // early return for uplifted lints: drop_ref, dropping_copy_types, forget_ref, forget_copy + // early return for uplifted lints: drop_ref, dropping_copy_types, forget_ref, forgetting_copy_types sym::mem_drop if arg_ty.is_ref() && !drop_is_single_call_in_arm => return, sym::mem_forget if arg_ty.is_ref() => return, sym::mem_drop if is_copy && !drop_is_single_call_in_arm => return, diff --git a/src/tools/clippy/clippy_lints/src/renamed_lints.rs b/src/tools/clippy/clippy_lints/src/renamed_lints.rs index 308e40abf6a..a81dbb9b259 100644 --- a/src/tools/clippy/clippy_lints/src/renamed_lints.rs +++ b/src/tools/clippy/clippy_lints/src/renamed_lints.rs @@ -38,7 +38,7 @@ pub static RENAMED_LINTS: &[(&str, &str)] = &[ ("clippy::for_loop_over_option", "for_loops_over_fallibles"), ("clippy::for_loop_over_result", "for_loops_over_fallibles"), ("clippy::for_loops_over_fallibles", "for_loops_over_fallibles"), - ("clippy::forget_copy", "forget_copy"), + ("clippy::forget_copy", "forgetting_copy_types"), ("clippy::forget_ref", "forget_ref"), ("clippy::into_iter_on_array", "array_into_iter"), ("clippy::invalid_atomic_ordering", "invalid_atomic_ordering"), diff --git a/src/tools/clippy/tests/ui/mem_forget.rs b/src/tools/clippy/tests/ui/mem_forget.rs index 5137448a6d4..edb9d87d032 100644 --- a/src/tools/clippy/tests/ui/mem_forget.rs +++ b/src/tools/clippy/tests/ui/mem_forget.rs @@ -5,7 +5,7 @@ use std::mem as memstuff; use std::mem::forget as forgetSomething; #[warn(clippy::mem_forget)] -#[allow(forget_copy)] +#[allow(forgetting_copy_types)] fn main() { let five: i32 = 5; forgetSomething(five); diff --git a/src/tools/clippy/tests/ui/rename.fixed b/src/tools/clippy/tests/ui/rename.fixed index 8633e422805..8df63fd9b23 100644 --- a/src/tools/clippy/tests/ui/rename.fixed +++ b/src/tools/clippy/tests/ui/rename.fixed @@ -33,7 +33,7 @@ #![allow(dropping_copy_types)] #![allow(drop_ref)] #![allow(for_loops_over_fallibles)] -#![allow(forget_copy)] +#![allow(forgetting_copy_types)] #![allow(forget_ref)] #![allow(array_into_iter)] #![allow(invalid_atomic_ordering)] @@ -82,7 +82,7 @@ #![warn(for_loops_over_fallibles)] #![warn(for_loops_over_fallibles)] #![warn(for_loops_over_fallibles)] -#![warn(forget_copy)] +#![warn(forgetting_copy_types)] #![warn(forget_ref)] #![warn(array_into_iter)] #![warn(invalid_atomic_ordering)] diff --git a/src/tools/clippy/tests/ui/rename.rs b/src/tools/clippy/tests/ui/rename.rs index 07b33b4da95..7206e19f1e0 100644 --- a/src/tools/clippy/tests/ui/rename.rs +++ b/src/tools/clippy/tests/ui/rename.rs @@ -33,7 +33,7 @@ #![allow(dropping_copy_types)] #![allow(drop_ref)] #![allow(for_loops_over_fallibles)] -#![allow(forget_copy)] +#![allow(forgetting_copy_types)] #![allow(forget_ref)] #![allow(array_into_iter)] #![allow(invalid_atomic_ordering)] diff --git a/src/tools/clippy/tests/ui/rename.stderr b/src/tools/clippy/tests/ui/rename.stderr index 20e7d96b720..c2a7c0dd7eb 100644 --- a/src/tools/clippy/tests/ui/rename.stderr +++ b/src/tools/clippy/tests/ui/rename.stderr @@ -216,11 +216,11 @@ error: lint `clippy::for_loops_over_fallibles` has been renamed to `for_loops_ov LL | #![warn(clippy::for_loops_over_fallibles)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `for_loops_over_fallibles` -error: lint `clippy::forget_copy` has been renamed to `forget_copy` +error: lint `clippy::forget_copy` has been renamed to `forgetting_copy_types` --> $DIR/rename.rs:85:9 | LL | #![warn(clippy::forget_copy)] - | ^^^^^^^^^^^^^^^^^^^ help: use the new name: `forget_copy` + | ^^^^^^^^^^^^^^^^^^^ help: use the new name: `forgetting_copy_types` error: lint `clippy::forget_ref` has been renamed to `forget_ref` --> $DIR/rename.rs:86:9 diff --git a/tests/ui/consts/const_forget.rs b/tests/ui/consts/const_forget.rs index acdd6a54cf4..f06149f2cb9 100644 --- a/tests/ui/consts/const_forget.rs +++ b/tests/ui/consts/const_forget.rs @@ -1,6 +1,6 @@ // check-pass -#![allow(forget_copy)] +#![allow(forgetting_copy_types)] use std::mem::forget; diff --git a/tests/ui/consts/issue-104155.rs b/tests/ui/consts/issue-104155.rs index b3821f467b6..7b375dc0566 100644 --- a/tests/ui/consts/issue-104155.rs +++ b/tests/ui/consts/issue-104155.rs @@ -1,6 +1,6 @@ // check-pass -#![allow(forget_copy)] +#![allow(forgetting_copy_types)] const _: () = core::mem::forget(Box::::default); const _: () = core::mem::forget(|| Box::::default()); diff --git a/tests/ui/lint/forget_copy.rs b/tests/ui/lint/forgetting_copy_types.rs similarity index 97% rename from tests/ui/lint/forget_copy.rs rename to tests/ui/lint/forgetting_copy_types.rs index a6b17b76971..224c7bcd5f6 100644 --- a/tests/ui/lint/forget_copy.rs +++ b/tests/ui/lint/forgetting_copy_types.rs @@ -1,6 +1,6 @@ // check-pass -#![warn(forget_copy)] +#![warn(forgetting_copy_types)] use std::mem::forget; use std::vec::Vec; diff --git a/tests/ui/lint/forget_copy.stderr b/tests/ui/lint/forgetting_copy_types.stderr similarity index 83% rename from tests/ui/lint/forget_copy.stderr rename to tests/ui/lint/forgetting_copy_types.stderr index 37bc8a8854e..cf4e1845f56 100644 --- a/tests/ui/lint/forget_copy.stderr +++ b/tests/ui/lint/forgetting_copy_types.stderr @@ -1,5 +1,5 @@ warning: calls to `std::mem::forget` with a value that implements `Copy` does nothing - --> $DIR/forget_copy.rs:34:5 + --> $DIR/forgetting_copy_types.rs:34:5 | LL | forget(s1); | ^^^^^^^--^ @@ -8,13 +8,13 @@ LL | forget(s1); | = note: use `let _ = ...` to ignore the expression or result note: the lint level is defined here - --> $DIR/forget_copy.rs:3:9 + --> $DIR/forgetting_copy_types.rs:3:9 | -LL | #![warn(forget_copy)] - | ^^^^^^^^^^^ +LL | #![warn(forgetting_copy_types)] + | ^^^^^^^^^^^^^^^^^^^^^ warning: calls to `std::mem::forget` with a value that implements `Copy` does nothing - --> $DIR/forget_copy.rs:35:5 + --> $DIR/forgetting_copy_types.rs:35:5 | LL | forget(s2); | ^^^^^^^--^ @@ -24,7 +24,7 @@ LL | forget(s2); = note: use `let _ = ...` to ignore the expression or result warning: calls to `std::mem::forget` with a reference instead of an owned value does nothing - --> $DIR/forget_copy.rs:36:5 + --> $DIR/forgetting_copy_types.rs:36:5 | LL | forget(s3); | ^^^^^^^--^ @@ -35,7 +35,7 @@ LL | forget(s3); = note: `#[warn(forget_ref)]` on by default warning: calls to `std::mem::forget` with a value that implements `Copy` does nothing - --> $DIR/forget_copy.rs:37:5 + --> $DIR/forgetting_copy_types.rs:37:5 | LL | forget(s4); | ^^^^^^^--^ @@ -45,7 +45,7 @@ LL | forget(s4); = note: use `let _ = ...` to ignore the expression or result warning: calls to `std::mem::forget` with a reference instead of an owned value does nothing - --> $DIR/forget_copy.rs:38:5 + --> $DIR/forgetting_copy_types.rs:38:5 | LL | forget(s5); | ^^^^^^^--^ @@ -55,7 +55,7 @@ LL | forget(s5); = note: use `let _ = ...` to ignore the expression or result warning: calls to `std::mem::forget` with a reference instead of an owned value does nothing - --> $DIR/forget_copy.rs:50:5 + --> $DIR/forgetting_copy_types.rs:50:5 | LL | forget(a2); | ^^^^^^^--^ @@ -65,7 +65,7 @@ LL | forget(a2); = note: use `let _ = ...` to ignore the expression or result warning: calls to `std::mem::forget` with a reference instead of an owned value does nothing - --> $DIR/forget_copy.rs:52:5 + --> $DIR/forgetting_copy_types.rs:52:5 | LL | forget(a3); | ^^^^^^^--^ @@ -75,7 +75,7 @@ LL | forget(a3); = note: use `let _ = ...` to ignore the expression or result warning: calls to `std::mem::forget` with a reference instead of an owned value does nothing - --> $DIR/forget_copy.rs:53:5 + --> $DIR/forgetting_copy_types.rs:53:5 | LL | forget(a4); | ^^^^^^^--^