Skip to content

Commit 85a1828

Browse files
committed
Rename forget_copy lint to forgetting_copy_types
1 parent 1c7ab18 commit 85a1828

File tree

13 files changed

+28
-28
lines changed

13 files changed

+28
-28
lines changed

compiler/rustc_lint/messages.ftl

+1-1
Original file line numberDiff line numberDiff line change
@@ -533,6 +533,6 @@ lint_forget_ref = calls to `std::mem::forget` with a reference instead of an own
533533
.label = argument has type `{$arg_ty}`
534534
.note = use `let _ = ...` to ignore the expression or result
535535
536-
lint_forget_copy = calls to `std::mem::forget` with a value that implements `Copy` does nothing
536+
lint_forgetting_copy_types = calls to `std::mem::forget` with a value that implements `Copy` does nothing
537537
.label = argument has type `{$arg_ty}`
538538
.note = use `let _ = ...` to ignore the expression or result

compiler/rustc_lint/src/drop_forget_useless.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ declare_lint! {
8282
}
8383

8484
declare_lint! {
85-
/// The `forget_copy` lint checks for calls to `std::mem::forget` with a value
85+
/// The `forgetting_copy_types` lint checks for calls to `std::mem::forget` with a value
8686
/// that derives the Copy trait.
8787
///
8888
/// ### Example
@@ -104,12 +104,12 @@ declare_lint! {
104104
/// An alternative, but also valid, explanation is that Copy types do not
105105
/// implement the Drop trait, which means they have no destructors. Without a
106106
/// destructor, there is nothing for `std::mem::forget` to ignore.
107-
pub FORGET_COPY,
107+
pub FORGETTING_COPY_TYPES,
108108
Warn,
109109
"calls to `std::mem::forget` with a value that implements Copy"
110110
}
111111

112-
declare_lint_pass!(DropForgetUseless => [DROP_REF, FORGET_REF, DROPPING_COPY_TYPES, FORGET_COPY]);
112+
declare_lint_pass!(DropForgetUseless => [DROP_REF, FORGET_REF, DROPPING_COPY_TYPES, FORGETTING_COPY_TYPES]);
113113

114114
impl<'tcx> LateLintPass<'tcx> for DropForgetUseless {
115115
fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'tcx>) {
@@ -132,7 +132,7 @@ impl<'tcx> LateLintPass<'tcx> for DropForgetUseless {
132132
cx.emit_spanned_lint(DROPPING_COPY_TYPES, expr.span, DropCopyDiag { arg_ty, label: arg.span });
133133
}
134134
sym::mem_forget if is_copy => {
135-
cx.emit_spanned_lint(FORGET_COPY, expr.span, ForgetCopyDiag { arg_ty, label: arg.span });
135+
cx.emit_spanned_lint(FORGETTING_COPY_TYPES, expr.span, ForgetCopyDiag { arg_ty, label: arg.span });
136136
}
137137
_ => return,
138138
};

compiler/rustc_lint/src/lints.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -691,7 +691,7 @@ pub struct ForgetRefDiag<'a> {
691691
}
692692

693693
#[derive(LintDiagnostic)]
694-
#[diag(lint_forget_copy)]
694+
#[diag(lint_forgetting_copy_types)]
695695
#[note]
696696
pub struct ForgetCopyDiag<'a> {
697697
pub arg_ty: Ty<'a>,

src/tools/clippy/clippy_lints/src/drop_forget_ref.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ impl<'tcx> LateLintPass<'tcx> for DropForgetRef {
9898
let is_copy = is_copy(cx, arg_ty);
9999
let drop_is_single_call_in_arm = is_single_call_in_arm(cx, arg, expr);
100100
let (lint, msg) = match fn_name {
101-
// early return for uplifted lints: drop_ref, dropping_copy_types, forget_ref, forget_copy
101+
// early return for uplifted lints: drop_ref, dropping_copy_types, forget_ref, forgetting_copy_types
102102
sym::mem_drop if arg_ty.is_ref() && !drop_is_single_call_in_arm => return,
103103
sym::mem_forget if arg_ty.is_ref() => return,
104104
sym::mem_drop if is_copy && !drop_is_single_call_in_arm => return,

src/tools/clippy/clippy_lints/src/renamed_lints.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ pub static RENAMED_LINTS: &[(&str, &str)] = &[
3838
("clippy::for_loop_over_option", "for_loops_over_fallibles"),
3939
("clippy::for_loop_over_result", "for_loops_over_fallibles"),
4040
("clippy::for_loops_over_fallibles", "for_loops_over_fallibles"),
41-
("clippy::forget_copy", "forget_copy"),
41+
("clippy::forget_copy", "forgetting_copy_types"),
4242
("clippy::forget_ref", "forget_ref"),
4343
("clippy::into_iter_on_array", "array_into_iter"),
4444
("clippy::invalid_atomic_ordering", "invalid_atomic_ordering"),

src/tools/clippy/tests/ui/mem_forget.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use std::mem as memstuff;
55
use std::mem::forget as forgetSomething;
66

77
#[warn(clippy::mem_forget)]
8-
#[allow(forget_copy)]
8+
#[allow(forgetting_copy_types)]
99
fn main() {
1010
let five: i32 = 5;
1111
forgetSomething(five);

src/tools/clippy/tests/ui/rename.fixed

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
#![allow(dropping_copy_types)]
3434
#![allow(drop_ref)]
3535
#![allow(for_loops_over_fallibles)]
36-
#![allow(forget_copy)]
36+
#![allow(forgetting_copy_types)]
3737
#![allow(forget_ref)]
3838
#![allow(array_into_iter)]
3939
#![allow(invalid_atomic_ordering)]
@@ -82,7 +82,7 @@
8282
#![warn(for_loops_over_fallibles)]
8383
#![warn(for_loops_over_fallibles)]
8484
#![warn(for_loops_over_fallibles)]
85-
#![warn(forget_copy)]
85+
#![warn(forgetting_copy_types)]
8686
#![warn(forget_ref)]
8787
#![warn(array_into_iter)]
8888
#![warn(invalid_atomic_ordering)]

src/tools/clippy/tests/ui/rename.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
#![allow(dropping_copy_types)]
3434
#![allow(drop_ref)]
3535
#![allow(for_loops_over_fallibles)]
36-
#![allow(forget_copy)]
36+
#![allow(forgetting_copy_types)]
3737
#![allow(forget_ref)]
3838
#![allow(array_into_iter)]
3939
#![allow(invalid_atomic_ordering)]

src/tools/clippy/tests/ui/rename.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -216,11 +216,11 @@ error: lint `clippy::for_loops_over_fallibles` has been renamed to `for_loops_ov
216216
LL | #![warn(clippy::for_loops_over_fallibles)]
217217
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `for_loops_over_fallibles`
218218

219-
error: lint `clippy::forget_copy` has been renamed to `forget_copy`
219+
error: lint `clippy::forget_copy` has been renamed to `forgetting_copy_types`
220220
--> $DIR/rename.rs:85:9
221221
|
222222
LL | #![warn(clippy::forget_copy)]
223-
| ^^^^^^^^^^^^^^^^^^^ help: use the new name: `forget_copy`
223+
| ^^^^^^^^^^^^^^^^^^^ help: use the new name: `forgetting_copy_types`
224224

225225
error: lint `clippy::forget_ref` has been renamed to `forget_ref`
226226
--> $DIR/rename.rs:86:9

tests/ui/consts/const_forget.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// check-pass
22

3-
#![allow(forget_copy)]
3+
#![allow(forgetting_copy_types)]
44

55
use std::mem::forget;
66

tests/ui/consts/issue-104155.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// check-pass
22

3-
#![allow(forget_copy)]
3+
#![allow(forgetting_copy_types)]
44

55
const _: () = core::mem::forget(Box::<u32>::default);
66
const _: () = core::mem::forget(|| Box::<u32>::default());

tests/ui/lint/forget_copy.rs renamed to tests/ui/lint/forgetting_copy_types.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// check-pass
22

3-
#![warn(forget_copy)]
3+
#![warn(forgetting_copy_types)]
44

55
use std::mem::forget;
66
use std::vec::Vec;

tests/ui/lint/forget_copy.stderr renamed to tests/ui/lint/forgetting_copy_types.stderr

+11-11
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
warning: calls to `std::mem::forget` with a value that implements `Copy` does nothing
2-
--> $DIR/forget_copy.rs:34:5
2+
--> $DIR/forgetting_copy_types.rs:34:5
33
|
44
LL | forget(s1);
55
| ^^^^^^^--^
@@ -8,13 +8,13 @@ LL | forget(s1);
88
|
99
= note: use `let _ = ...` to ignore the expression or result
1010
note: the lint level is defined here
11-
--> $DIR/forget_copy.rs:3:9
11+
--> $DIR/forgetting_copy_types.rs:3:9
1212
|
13-
LL | #![warn(forget_copy)]
14-
| ^^^^^^^^^^^
13+
LL | #![warn(forgetting_copy_types)]
14+
| ^^^^^^^^^^^^^^^^^^^^^
1515

1616
warning: calls to `std::mem::forget` with a value that implements `Copy` does nothing
17-
--> $DIR/forget_copy.rs:35:5
17+
--> $DIR/forgetting_copy_types.rs:35:5
1818
|
1919
LL | forget(s2);
2020
| ^^^^^^^--^
@@ -24,7 +24,7 @@ LL | forget(s2);
2424
= note: use `let _ = ...` to ignore the expression or result
2525

2626
warning: calls to `std::mem::forget` with a reference instead of an owned value does nothing
27-
--> $DIR/forget_copy.rs:36:5
27+
--> $DIR/forgetting_copy_types.rs:36:5
2828
|
2929
LL | forget(s3);
3030
| ^^^^^^^--^
@@ -35,7 +35,7 @@ LL | forget(s3);
3535
= note: `#[warn(forget_ref)]` on by default
3636

3737
warning: calls to `std::mem::forget` with a value that implements `Copy` does nothing
38-
--> $DIR/forget_copy.rs:37:5
38+
--> $DIR/forgetting_copy_types.rs:37:5
3939
|
4040
LL | forget(s4);
4141
| ^^^^^^^--^
@@ -45,7 +45,7 @@ LL | forget(s4);
4545
= note: use `let _ = ...` to ignore the expression or result
4646

4747
warning: calls to `std::mem::forget` with a reference instead of an owned value does nothing
48-
--> $DIR/forget_copy.rs:38:5
48+
--> $DIR/forgetting_copy_types.rs:38:5
4949
|
5050
LL | forget(s5);
5151
| ^^^^^^^--^
@@ -55,7 +55,7 @@ LL | forget(s5);
5555
= note: use `let _ = ...` to ignore the expression or result
5656

5757
warning: calls to `std::mem::forget` with a reference instead of an owned value does nothing
58-
--> $DIR/forget_copy.rs:50:5
58+
--> $DIR/forgetting_copy_types.rs:50:5
5959
|
6060
LL | forget(a2);
6161
| ^^^^^^^--^
@@ -65,7 +65,7 @@ LL | forget(a2);
6565
= note: use `let _ = ...` to ignore the expression or result
6666

6767
warning: calls to `std::mem::forget` with a reference instead of an owned value does nothing
68-
--> $DIR/forget_copy.rs:52:5
68+
--> $DIR/forgetting_copy_types.rs:52:5
6969
|
7070
LL | forget(a3);
7171
| ^^^^^^^--^
@@ -75,7 +75,7 @@ LL | forget(a3);
7575
= note: use `let _ = ...` to ignore the expression or result
7676

7777
warning: calls to `std::mem::forget` with a reference instead of an owned value does nothing
78-
--> $DIR/forget_copy.rs:53:5
78+
--> $DIR/forgetting_copy_types.rs:53:5
7979
|
8080
LL | forget(a4);
8181
| ^^^^^^^--^

0 commit comments

Comments
 (0)