diff --git a/compiler/rustc_lint/messages.ftl b/compiler/rustc_lint/messages.ftl index b0ccbe4b1f1fd..e1658d3ff82b7 100644 --- a/compiler/rustc_lint/messages.ftl +++ b/compiler/rustc_lint/messages.ftl @@ -529,7 +529,7 @@ lint_dropping_copy_types = calls to `std::mem::drop` with a value that implement .label = argument has type `{$arg_ty}` .note = use `let _ = ...` to ignore the expression or result -lint_forget_ref = calls to `std::mem::forget` with a reference instead of an owned value does nothing +lint_forgetting_references = calls to `std::mem::forget` with a reference instead of an owned value 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 b1199096d7c82..ed2b384805e05 100644 --- a/compiler/rustc_lint/src/drop_forget_useless.rs +++ b/compiler/rustc_lint/src/drop_forget_useless.rs @@ -35,7 +35,7 @@ declare_lint! { } declare_lint! { - /// The `forget_ref` lint checks for calls to `std::mem::forget` with a reference + /// The `forgetting_references` lint checks for calls to `std::mem::forget` with a reference /// instead of an owned value. /// /// ### Example @@ -52,7 +52,7 @@ declare_lint! { /// Calling `forget` on a reference will only forget the /// reference itself, which is a no-op. It will not forget the underlying /// referenced value, which is likely what was intended. - pub FORGET_REF, + pub FORGETTING_REFERENCES, Warn, "calls to `std::mem::forget` with a reference instead of an owned value" } @@ -109,7 +109,7 @@ declare_lint! { "calls to `std::mem::forget` with a value that implements Copy" } -declare_lint_pass!(DropForgetUseless => [DROPPING_REFERENCES, FORGET_REF, DROPPING_COPY_TYPES, FORGETTING_COPY_TYPES]); +declare_lint_pass!(DropForgetUseless => [DROPPING_REFERENCES, FORGETTING_REFERENCES, DROPPING_COPY_TYPES, FORGETTING_COPY_TYPES]); impl<'tcx> LateLintPass<'tcx> for DropForgetUseless { fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'tcx>) { @@ -126,7 +126,7 @@ impl<'tcx> LateLintPass<'tcx> for DropForgetUseless { cx.emit_spanned_lint(DROPPING_REFERENCES, expr.span, DropRefDiag { arg_ty, label: arg.span }); }, sym::mem_forget if arg_ty.is_ref() => { - cx.emit_spanned_lint(FORGET_REF, expr.span, ForgetRefDiag { arg_ty, label: arg.span }); + cx.emit_spanned_lint(FORGETTING_REFERENCES, expr.span, ForgetRefDiag { arg_ty, label: arg.span }); }, sym::mem_drop if is_copy && !drop_is_single_call_in_arm => { cx.emit_spanned_lint(DROPPING_COPY_TYPES, expr.span, DropCopyDiag { arg_ty, label: arg.span }); diff --git a/compiler/rustc_lint/src/lints.rs b/compiler/rustc_lint/src/lints.rs index aebfa6f3078cf..de1c2be287576 100644 --- a/compiler/rustc_lint/src/lints.rs +++ b/compiler/rustc_lint/src/lints.rs @@ -682,7 +682,7 @@ pub struct DropCopyDiag<'a> { } #[derive(LintDiagnostic)] -#[diag(lint_forget_ref)] +#[diag(lint_forgetting_references)] #[note] pub struct ForgetRefDiag<'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 00211d65094ee..9c60edb179415 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: dropping_references, dropping_copy_types, forget_ref, forgetting_copy_types + // early return for uplifted lints: dropping_references, dropping_copy_types, forgetting_references, 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 4d1a462d110ca..b0db56bb417ea 100644 --- a/src/tools/clippy/clippy_lints/src/renamed_lints.rs +++ b/src/tools/clippy/clippy_lints/src/renamed_lints.rs @@ -39,7 +39,7 @@ pub static RENAMED_LINTS: &[(&str, &str)] = &[ ("clippy::for_loop_over_result", "for_loops_over_fallibles"), ("clippy::for_loops_over_fallibles", "for_loops_over_fallibles"), ("clippy::forget_copy", "forgetting_copy_types"), - ("clippy::forget_ref", "forget_ref"), + ("clippy::forget_ref", "forgetting_references"), ("clippy::into_iter_on_array", "array_into_iter"), ("clippy::invalid_atomic_ordering", "invalid_atomic_ordering"), ("clippy::invalid_ref", "invalid_value"), diff --git a/src/tools/clippy/tests/ui/rename.fixed b/src/tools/clippy/tests/ui/rename.fixed index a4fb4fbffdfc8..dfe45dec8a745 100644 --- a/src/tools/clippy/tests/ui/rename.fixed +++ b/src/tools/clippy/tests/ui/rename.fixed @@ -34,7 +34,7 @@ #![allow(dropping_references)] #![allow(for_loops_over_fallibles)] #![allow(forgetting_copy_types)] -#![allow(forget_ref)] +#![allow(forgetting_references)] #![allow(array_into_iter)] #![allow(invalid_atomic_ordering)] #![allow(invalid_value)] @@ -83,7 +83,7 @@ #![warn(for_loops_over_fallibles)] #![warn(for_loops_over_fallibles)] #![warn(forgetting_copy_types)] -#![warn(forget_ref)] +#![warn(forgetting_references)] #![warn(array_into_iter)] #![warn(invalid_atomic_ordering)] #![warn(invalid_value)] diff --git a/src/tools/clippy/tests/ui/rename.rs b/src/tools/clippy/tests/ui/rename.rs index bb833c9534688..ce8eca5a3081c 100644 --- a/src/tools/clippy/tests/ui/rename.rs +++ b/src/tools/clippy/tests/ui/rename.rs @@ -34,7 +34,7 @@ #![allow(dropping_references)] #![allow(for_loops_over_fallibles)] #![allow(forgetting_copy_types)] -#![allow(forget_ref)] +#![allow(forgetting_references)] #![allow(array_into_iter)] #![allow(invalid_atomic_ordering)] #![allow(invalid_value)] diff --git a/src/tools/clippy/tests/ui/rename.stderr b/src/tools/clippy/tests/ui/rename.stderr index 8bbd046bbf31b..3fca60aa2ebd3 100644 --- a/src/tools/clippy/tests/ui/rename.stderr +++ b/src/tools/clippy/tests/ui/rename.stderr @@ -222,11 +222,11 @@ error: lint `clippy::forget_copy` has been renamed to `forgetting_copy_types` LL | #![warn(clippy::forget_copy)] | ^^^^^^^^^^^^^^^^^^^ help: use the new name: `forgetting_copy_types` -error: lint `clippy::forget_ref` has been renamed to `forget_ref` +error: lint `clippy::forget_ref` has been renamed to `forgetting_references` --> $DIR/rename.rs:86:9 | LL | #![warn(clippy::forget_ref)] - | ^^^^^^^^^^^^^^^^^^ help: use the new name: `forget_ref` + | ^^^^^^^^^^^^^^^^^^ help: use the new name: `forgetting_references` error: lint `clippy::into_iter_on_array` has been renamed to `array_into_iter` --> $DIR/rename.rs:87:9 diff --git a/tests/ui/lint/forgetting_copy_types.stderr b/tests/ui/lint/forgetting_copy_types.stderr index cf4e1845f5681..36d1ef5c53e93 100644 --- a/tests/ui/lint/forgetting_copy_types.stderr +++ b/tests/ui/lint/forgetting_copy_types.stderr @@ -32,7 +32,7 @@ LL | forget(s3); | argument has type `&SomeStruct` | = note: use `let _ = ...` to ignore the expression or result - = note: `#[warn(forget_ref)]` on by default + = note: `#[warn(forgetting_references)]` on by default warning: calls to `std::mem::forget` with a value that implements `Copy` does nothing --> $DIR/forgetting_copy_types.rs:37:5 diff --git a/tests/ui/lint/forget_ref.rs b/tests/ui/lint/forgetting_references.rs similarity index 97% rename from tests/ui/lint/forget_ref.rs rename to tests/ui/lint/forgetting_references.rs index 13f6d4be3d153..bd51e98003159 100644 --- a/tests/ui/lint/forget_ref.rs +++ b/tests/ui/lint/forgetting_references.rs @@ -1,6 +1,6 @@ // check-pass -#![warn(forget_ref)] +#![warn(forgetting_references)] use std::mem::forget; diff --git a/tests/ui/lint/forget_ref.stderr b/tests/ui/lint/forgetting_references.stderr similarity index 84% rename from tests/ui/lint/forget_ref.stderr rename to tests/ui/lint/forgetting_references.stderr index 63fc779198007..5624b690789f8 100644 --- a/tests/ui/lint/forget_ref.stderr +++ b/tests/ui/lint/forgetting_references.stderr @@ -1,5 +1,5 @@ warning: calls to `std::mem::forget` with a reference instead of an owned value does nothing - --> $DIR/forget_ref.rs:10:5 + --> $DIR/forgetting_references.rs:10:5 | LL | forget(&SomeStruct); | ^^^^^^^-----------^ @@ -8,13 +8,13 @@ LL | forget(&SomeStruct); | = note: use `let _ = ...` to ignore the expression or result note: the lint level is defined here - --> $DIR/forget_ref.rs:3:9 + --> $DIR/forgetting_references.rs:3:9 | -LL | #![warn(forget_ref)] - | ^^^^^^^^^^ +LL | #![warn(forgetting_references)] + | ^^^^^^^^^^^^^^^^^^^^^ warning: calls to `std::mem::forget` with a reference instead of an owned value does nothing - --> $DIR/forget_ref.rs:13:5 + --> $DIR/forgetting_references.rs:13:5 | LL | forget(&owned); | ^^^^^^^------^ @@ -24,7 +24,7 @@ LL | forget(&owned); = 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_ref.rs:14:5 + --> $DIR/forgetting_references.rs:14:5 | LL | forget(&&owned); | ^^^^^^^-------^ @@ -34,7 +34,7 @@ LL | forget(&&owned); = 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_ref.rs:15:5 + --> $DIR/forgetting_references.rs:15:5 | LL | forget(&mut owned); | ^^^^^^^----------^ @@ -44,7 +44,7 @@ LL | forget(&mut owned); = 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_ref.rs:19:5 + --> $DIR/forgetting_references.rs:19:5 | LL | forget(&*reference1); | ^^^^^^^------------^ @@ -54,7 +54,7 @@ LL | forget(&*reference1); = 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_ref.rs:22:5 + --> $DIR/forgetting_references.rs:22:5 | LL | forget(reference2); | ^^^^^^^----------^ @@ -64,7 +64,7 @@ LL | forget(reference2); = 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_ref.rs:25:5 + --> $DIR/forgetting_references.rs:25:5 | LL | forget(reference3); | ^^^^^^^----------^ @@ -74,7 +74,7 @@ LL | forget(reference3); = 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_ref.rs:30:5 + --> $DIR/forgetting_references.rs:30:5 | LL | forget(&val); | ^^^^^^^----^ @@ -84,7 +84,7 @@ LL | forget(&val); = 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_ref.rs:38:5 + --> $DIR/forgetting_references.rs:38:5 | LL | std::mem::forget(&SomeStruct); | ^^^^^^^^^^^^^^^^^-----------^