Skip to content

Commit 6b08a74

Browse files
committed
Rename forget_ref lint to forgetting_references
1 parent c93d9c1 commit 6b08a74

File tree

11 files changed

+27
-27
lines changed

11 files changed

+27
-27
lines changed

compiler/rustc_lint/messages.ftl

+1-1
Original file line numberDiff line numberDiff line change
@@ -529,7 +529,7 @@ lint_dropping_copy_types = calls to `std::mem::drop` with a value that implement
529529
.label = argument has type `{$arg_ty}`
530530
.note = use `let _ = ...` to ignore the expression or result
531531
532-
lint_forget_ref = calls to `std::mem::forget` with a reference instead of an owned value does nothing
532+
lint_forgetting_references = calls to `std::mem::forget` with a reference instead of an owned value does nothing
533533
.label = argument has type `{$arg_ty}`
534534
.note = use `let _ = ...` to ignore the expression or result
535535

compiler/rustc_lint/src/drop_forget_useless.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ declare_lint! {
3535
}
3636

3737
declare_lint! {
38-
/// The `forget_ref` lint checks for calls to `std::mem::forget` with a reference
38+
/// The `forgetting_references` lint checks for calls to `std::mem::forget` with a reference
3939
/// instead of an owned value.
4040
///
4141
/// ### Example
@@ -52,7 +52,7 @@ declare_lint! {
5252
/// Calling `forget` on a reference will only forget the
5353
/// reference itself, which is a no-op. It will not forget the underlying
5454
/// referenced value, which is likely what was intended.
55-
pub FORGET_REF,
55+
pub FORGETTING_REFERENCES,
5656
Warn,
5757
"calls to `std::mem::forget` with a reference instead of an owned value"
5858
}
@@ -109,7 +109,7 @@ declare_lint! {
109109
"calls to `std::mem::forget` with a value that implements Copy"
110110
}
111111

112-
declare_lint_pass!(DropForgetUseless => [DROPPING_REFERENCES, FORGET_REF, DROPPING_COPY_TYPES, FORGETTING_COPY_TYPES]);
112+
declare_lint_pass!(DropForgetUseless => [DROPPING_REFERENCES, FORGETTING_REFERENCES, 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>) {
@@ -126,7 +126,7 @@ impl<'tcx> LateLintPass<'tcx> for DropForgetUseless {
126126
cx.emit_spanned_lint(DROPPING_REFERENCES, expr.span, DropRefDiag { arg_ty, label: arg.span });
127127
},
128128
sym::mem_forget if arg_ty.is_ref() => {
129-
cx.emit_spanned_lint(FORGET_REF, expr.span, ForgetRefDiag { arg_ty, label: arg.span });
129+
cx.emit_spanned_lint(FORGETTING_REFERENCES, expr.span, ForgetRefDiag { arg_ty, label: arg.span });
130130
},
131131
sym::mem_drop if is_copy && !drop_is_single_call_in_arm => {
132132
cx.emit_spanned_lint(DROPPING_COPY_TYPES, expr.span, DropCopyDiag { arg_ty, label: arg.span });

compiler/rustc_lint/src/lints.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -682,7 +682,7 @@ pub struct DropCopyDiag<'a> {
682682
}
683683

684684
#[derive(LintDiagnostic)]
685-
#[diag(lint_forget_ref)]
685+
#[diag(lint_forgetting_references)]
686686
#[note]
687687
pub struct ForgetRefDiag<'a> {
688688
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: dropping_references, dropping_copy_types, forget_ref, forgetting_copy_types
101+
// early return for uplifted lints: dropping_references, dropping_copy_types, forgetting_references, 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
@@ -39,7 +39,7 @@ pub static RENAMED_LINTS: &[(&str, &str)] = &[
3939
("clippy::for_loop_over_result", "for_loops_over_fallibles"),
4040
("clippy::for_loops_over_fallibles", "for_loops_over_fallibles"),
4141
("clippy::forget_copy", "forgetting_copy_types"),
42-
("clippy::forget_ref", "forget_ref"),
42+
("clippy::forget_ref", "forgetting_references"),
4343
("clippy::into_iter_on_array", "array_into_iter"),
4444
("clippy::invalid_atomic_ordering", "invalid_atomic_ordering"),
4545
("clippy::invalid_ref", "invalid_value"),

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
#![allow(dropping_references)]
3535
#![allow(for_loops_over_fallibles)]
3636
#![allow(forgetting_copy_types)]
37-
#![allow(forget_ref)]
37+
#![allow(forgetting_references)]
3838
#![allow(array_into_iter)]
3939
#![allow(invalid_atomic_ordering)]
4040
#![allow(invalid_value)]
@@ -83,7 +83,7 @@
8383
#![warn(for_loops_over_fallibles)]
8484
#![warn(for_loops_over_fallibles)]
8585
#![warn(forgetting_copy_types)]
86-
#![warn(forget_ref)]
86+
#![warn(forgetting_references)]
8787
#![warn(array_into_iter)]
8888
#![warn(invalid_atomic_ordering)]
8989
#![warn(invalid_value)]

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
#![allow(dropping_references)]
3535
#![allow(for_loops_over_fallibles)]
3636
#![allow(forgetting_copy_types)]
37-
#![allow(forget_ref)]
37+
#![allow(forgetting_references)]
3838
#![allow(array_into_iter)]
3939
#![allow(invalid_atomic_ordering)]
4040
#![allow(invalid_value)]

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -222,11 +222,11 @@ error: lint `clippy::forget_copy` has been renamed to `forgetting_copy_types`
222222
LL | #![warn(clippy::forget_copy)]
223223
| ^^^^^^^^^^^^^^^^^^^ help: use the new name: `forgetting_copy_types`
224224

225-
error: lint `clippy::forget_ref` has been renamed to `forget_ref`
225+
error: lint `clippy::forget_ref` has been renamed to `forgetting_references`
226226
--> $DIR/rename.rs:86:9
227227
|
228228
LL | #![warn(clippy::forget_ref)]
229-
| ^^^^^^^^^^^^^^^^^^ help: use the new name: `forget_ref`
229+
| ^^^^^^^^^^^^^^^^^^ help: use the new name: `forgetting_references`
230230

231231
error: lint `clippy::into_iter_on_array` has been renamed to `array_into_iter`
232232
--> $DIR/rename.rs:87:9

tests/ui/lint/forgetting_copy_types.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ LL | forget(s3);
3232
| argument has type `&SomeStruct`
3333
|
3434
= note: use `let _ = ...` to ignore the expression or result
35-
= note: `#[warn(forget_ref)]` on by default
35+
= note: `#[warn(forgetting_references)]` on by default
3636

3737
warning: calls to `std::mem::forget` with a value that implements `Copy` does nothing
3838
--> $DIR/forgetting_copy_types.rs:37:5

tests/ui/lint/forget_ref.rs tests/ui/lint/forgetting_references.rs

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

3-
#![warn(forget_ref)]
3+
#![warn(forgetting_references)]
44

55
use std::mem::forget;
66

tests/ui/lint/forget_ref.stderr tests/ui/lint/forgetting_references.stderr

+12-12
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
warning: calls to `std::mem::forget` with a reference instead of an owned value does nothing
2-
--> $DIR/forget_ref.rs:10:5
2+
--> $DIR/forgetting_references.rs:10:5
33
|
44
LL | forget(&SomeStruct);
55
| ^^^^^^^-----------^
@@ -8,13 +8,13 @@ LL | forget(&SomeStruct);
88
|
99
= note: use `let _ = ...` to ignore the expression or result
1010
note: the lint level is defined here
11-
--> $DIR/forget_ref.rs:3:9
11+
--> $DIR/forgetting_references.rs:3:9
1212
|
13-
LL | #![warn(forget_ref)]
14-
| ^^^^^^^^^^
13+
LL | #![warn(forgetting_references)]
14+
| ^^^^^^^^^^^^^^^^^^^^^
1515

1616
warning: calls to `std::mem::forget` with a reference instead of an owned value does nothing
17-
--> $DIR/forget_ref.rs:13:5
17+
--> $DIR/forgetting_references.rs:13:5
1818
|
1919
LL | forget(&owned);
2020
| ^^^^^^^------^
@@ -24,7 +24,7 @@ LL | forget(&owned);
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_ref.rs:14:5
27+
--> $DIR/forgetting_references.rs:14:5
2828
|
2929
LL | forget(&&owned);
3030
| ^^^^^^^-------^
@@ -34,7 +34,7 @@ LL | forget(&&owned);
3434
= note: use `let _ = ...` to ignore the expression or result
3535

3636
warning: calls to `std::mem::forget` with a reference instead of an owned value does nothing
37-
--> $DIR/forget_ref.rs:15:5
37+
--> $DIR/forgetting_references.rs:15:5
3838
|
3939
LL | forget(&mut owned);
4040
| ^^^^^^^----------^
@@ -44,7 +44,7 @@ LL | forget(&mut owned);
4444
= note: use `let _ = ...` to ignore the expression or result
4545

4646
warning: calls to `std::mem::forget` with a reference instead of an owned value does nothing
47-
--> $DIR/forget_ref.rs:19:5
47+
--> $DIR/forgetting_references.rs:19:5
4848
|
4949
LL | forget(&*reference1);
5050
| ^^^^^^^------------^
@@ -54,7 +54,7 @@ LL | forget(&*reference1);
5454
= note: use `let _ = ...` to ignore the expression or result
5555

5656
warning: calls to `std::mem::forget` with a reference instead of an owned value does nothing
57-
--> $DIR/forget_ref.rs:22:5
57+
--> $DIR/forgetting_references.rs:22:5
5858
|
5959
LL | forget(reference2);
6060
| ^^^^^^^----------^
@@ -64,7 +64,7 @@ LL | forget(reference2);
6464
= note: use `let _ = ...` to ignore the expression or result
6565

6666
warning: calls to `std::mem::forget` with a reference instead of an owned value does nothing
67-
--> $DIR/forget_ref.rs:25:5
67+
--> $DIR/forgetting_references.rs:25:5
6868
|
6969
LL | forget(reference3);
7070
| ^^^^^^^----------^
@@ -74,7 +74,7 @@ LL | forget(reference3);
7474
= note: use `let _ = ...` to ignore the expression or result
7575

7676
warning: calls to `std::mem::forget` with a reference instead of an owned value does nothing
77-
--> $DIR/forget_ref.rs:30:5
77+
--> $DIR/forgetting_references.rs:30:5
7878
|
7979
LL | forget(&val);
8080
| ^^^^^^^----^
@@ -84,7 +84,7 @@ LL | forget(&val);
8484
= note: use `let _ = ...` to ignore the expression or result
8585

8686
warning: calls to `std::mem::forget` with a reference instead of an owned value does nothing
87-
--> $DIR/forget_ref.rs:38:5
87+
--> $DIR/forgetting_references.rs:38:5
8888
|
8989
LL | std::mem::forget(&SomeStruct);
9090
| ^^^^^^^^^^^^^^^^^-----------^

0 commit comments

Comments
 (0)