Skip to content

Commit

Permalink
Rename forget_ref lint to forgetting_references
Browse files Browse the repository at this point in the history
  • Loading branch information
Urgau committed May 21, 2023
1 parent c93d9c1 commit 6b08a74
Show file tree
Hide file tree
Showing 11 changed files with 27 additions and 27 deletions.
2 changes: 1 addition & 1 deletion compiler/rustc_lint/messages.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions compiler/rustc_lint/src/drop_forget_useless.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"
}
Expand Down Expand Up @@ -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>) {
Expand All @@ -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 });
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_lint/src/lints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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>,
Expand Down
2 changes: 1 addition & 1 deletion src/tools/clippy/clippy_lints/src/drop_forget_ref.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/tools/clippy/clippy_lints/src/renamed_lints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down
4 changes: 2 additions & 2 deletions src/tools/clippy/tests/ui/rename.fixed
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down Expand Up @@ -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)]
Expand Down
2 changes: 1 addition & 1 deletion src/tools/clippy/tests/ui/rename.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down
4 changes: 2 additions & 2 deletions src/tools/clippy/tests/ui/rename.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/lint/forgetting_copy_types.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// check-pass

#![warn(forget_ref)]
#![warn(forgetting_references)]

use std::mem::forget;

Expand Down
Original file line number Diff line number Diff line change
@@ -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);
| ^^^^^^^-----------^
Expand All @@ -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);
| ^^^^^^^------^
Expand All @@ -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);
| ^^^^^^^-------^
Expand All @@ -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);
| ^^^^^^^----------^
Expand All @@ -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);
| ^^^^^^^------------^
Expand All @@ -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);
| ^^^^^^^----------^
Expand All @@ -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);
| ^^^^^^^----------^
Expand All @@ -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);
| ^^^^^^^----^
Expand All @@ -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);
| ^^^^^^^^^^^^^^^^^-----------^
Expand Down

0 comments on commit 6b08a74

Please sign in to comment.