1
Fork 0

Rename drop_ref lint to dropping_references

This commit is contained in:
Urgau 2023-05-19 11:25:35 +02:00
parent 85a1828943
commit c93d9c1794
30 changed files with 50 additions and 50 deletions

View file

@ -521,7 +521,7 @@ lint_opaque_hidden_inferred_bound = opaque type `{$ty}` does not satisfy its ass
lint_opaque_hidden_inferred_bound_sugg = add this bound lint_opaque_hidden_inferred_bound_sugg = add this bound
lint_drop_ref = calls to `std::mem::drop` with a reference instead of an owned value does nothing lint_dropping_references = calls to `std::mem::drop` with a reference instead of an owned value does nothing
.label = argument has type `{$arg_ty}` .label = argument has type `{$arg_ty}`
.note = use `let _ = ...` to ignore the expression or result .note = use `let _ = ...` to ignore the expression or result

View file

@ -7,7 +7,7 @@ use crate::{
}; };
declare_lint! { declare_lint! {
/// The `drop_ref` lint checks for calls to `std::mem::drop` with a reference /// The `dropping_references` lint checks for calls to `std::mem::drop` with a reference
/// instead of an owned value. /// instead of an owned value.
/// ///
/// ### Example /// ### Example
@ -29,7 +29,7 @@ declare_lint! {
/// reference itself, which is a no-op. It will not call the `drop` method (from /// reference itself, which is a no-op. It will not call the `drop` method (from
/// the `Drop` trait implementation) on the underlying referenced value, which /// the `Drop` trait implementation) on the underlying referenced value, which
/// is likely what was intended. /// is likely what was intended.
pub DROP_REF, pub DROPPING_REFERENCES,
Warn, Warn,
"calls to `std::mem::drop` with a reference instead of an owned value" "calls to `std::mem::drop` 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" "calls to `std::mem::forget` with a value that implements Copy"
} }
declare_lint_pass!(DropForgetUseless => [DROP_REF, FORGET_REF, DROPPING_COPY_TYPES, FORGETTING_COPY_TYPES]); declare_lint_pass!(DropForgetUseless => [DROPPING_REFERENCES, FORGET_REF, DROPPING_COPY_TYPES, FORGETTING_COPY_TYPES]);
impl<'tcx> LateLintPass<'tcx> for DropForgetUseless { impl<'tcx> LateLintPass<'tcx> for DropForgetUseless {
fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'tcx>) { fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'tcx>) {
@ -123,7 +123,7 @@ impl<'tcx> LateLintPass<'tcx> for DropForgetUseless {
let drop_is_single_call_in_arm = is_single_call_in_arm(cx, arg, expr); let drop_is_single_call_in_arm = is_single_call_in_arm(cx, arg, expr);
match fn_name { match fn_name {
sym::mem_drop if arg_ty.is_ref() && !drop_is_single_call_in_arm => { sym::mem_drop if arg_ty.is_ref() && !drop_is_single_call_in_arm => {
cx.emit_spanned_lint(DROP_REF, expr.span, DropRefDiag { arg_ty, label: arg.span }); cx.emit_spanned_lint(DROPPING_REFERENCES, expr.span, DropRefDiag { arg_ty, label: arg.span });
}, },
sym::mem_forget if arg_ty.is_ref() => { 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(FORGET_REF, expr.span, ForgetRefDiag { arg_ty, label: arg.span });

View file

@ -662,9 +662,9 @@ pub struct ForLoopsOverFalliblesSuggestion<'a> {
pub end_span: Span, pub end_span: Span,
} }
// drop_ref.rs // drop_forget_useless.rs
#[derive(LintDiagnostic)] #[derive(LintDiagnostic)]
#[diag(lint_drop_ref)] #[diag(lint_dropping_references)]
#[note] #[note]
pub struct DropRefDiag<'a> { pub struct DropRefDiag<'a> {
pub arg_ty: Ty<'a>, pub arg_ty: Ty<'a>,

View file

@ -98,7 +98,7 @@ impl<'tcx> LateLintPass<'tcx> for DropForgetRef {
let is_copy = is_copy(cx, arg_ty); let is_copy = is_copy(cx, arg_ty);
let drop_is_single_call_in_arm = is_single_call_in_arm(cx, arg, expr); let drop_is_single_call_in_arm = is_single_call_in_arm(cx, arg, expr);
let (lint, msg) = match fn_name { let (lint, msg) = match fn_name {
// early return for uplifted lints: drop_ref, dropping_copy_types, forget_ref, forgetting_copy_types // early return for uplifted lints: dropping_references, 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_drop if arg_ty.is_ref() && !drop_is_single_call_in_arm => return,
sym::mem_forget if arg_ty.is_ref() => return, sym::mem_forget if arg_ty.is_ref() => return,
sym::mem_drop if is_copy && !drop_is_single_call_in_arm => return, sym::mem_drop if is_copy && !drop_is_single_call_in_arm => return,

View file

@ -34,7 +34,7 @@ pub static RENAMED_LINTS: &[(&str, &str)] = &[
("clippy::clone_double_ref", "suspicious_double_ref_op"), ("clippy::clone_double_ref", "suspicious_double_ref_op"),
("clippy::drop_bounds", "drop_bounds"), ("clippy::drop_bounds", "drop_bounds"),
("clippy::drop_copy", "dropping_copy_types"), ("clippy::drop_copy", "dropping_copy_types"),
("clippy::drop_ref", "drop_ref"), ("clippy::drop_ref", "dropping_references"),
("clippy::for_loop_over_option", "for_loops_over_fallibles"), ("clippy::for_loop_over_option", "for_loops_over_fallibles"),
("clippy::for_loop_over_result", "for_loops_over_fallibles"), ("clippy::for_loop_over_result", "for_loops_over_fallibles"),
("clippy::for_loops_over_fallibles", "for_loops_over_fallibles"), ("clippy::for_loops_over_fallibles", "for_loops_over_fallibles"),

View file

@ -31,7 +31,7 @@
#![allow(suspicious_double_ref_op)] #![allow(suspicious_double_ref_op)]
#![allow(drop_bounds)] #![allow(drop_bounds)]
#![allow(dropping_copy_types)] #![allow(dropping_copy_types)]
#![allow(drop_ref)] #![allow(dropping_references)]
#![allow(for_loops_over_fallibles)] #![allow(for_loops_over_fallibles)]
#![allow(forgetting_copy_types)] #![allow(forgetting_copy_types)]
#![allow(forget_ref)] #![allow(forget_ref)]
@ -78,7 +78,7 @@
#![warn(suspicious_double_ref_op)] #![warn(suspicious_double_ref_op)]
#![warn(drop_bounds)] #![warn(drop_bounds)]
#![warn(dropping_copy_types)] #![warn(dropping_copy_types)]
#![warn(drop_ref)] #![warn(dropping_references)]
#![warn(for_loops_over_fallibles)] #![warn(for_loops_over_fallibles)]
#![warn(for_loops_over_fallibles)] #![warn(for_loops_over_fallibles)]
#![warn(for_loops_over_fallibles)] #![warn(for_loops_over_fallibles)]

View file

@ -31,7 +31,7 @@
#![allow(suspicious_double_ref_op)] #![allow(suspicious_double_ref_op)]
#![allow(drop_bounds)] #![allow(drop_bounds)]
#![allow(dropping_copy_types)] #![allow(dropping_copy_types)]
#![allow(drop_ref)] #![allow(dropping_references)]
#![allow(for_loops_over_fallibles)] #![allow(for_loops_over_fallibles)]
#![allow(forgetting_copy_types)] #![allow(forgetting_copy_types)]
#![allow(forget_ref)] #![allow(forget_ref)]

View file

@ -192,11 +192,11 @@ error: lint `clippy::drop_copy` has been renamed to `dropping_copy_types`
LL | #![warn(clippy::drop_copy)] LL | #![warn(clippy::drop_copy)]
| ^^^^^^^^^^^^^^^^^ help: use the new name: `dropping_copy_types` | ^^^^^^^^^^^^^^^^^ help: use the new name: `dropping_copy_types`
error: lint `clippy::drop_ref` has been renamed to `drop_ref` error: lint `clippy::drop_ref` has been renamed to `dropping_references`
--> $DIR/rename.rs:81:9 --> $DIR/rename.rs:81:9
| |
LL | #![warn(clippy::drop_ref)] LL | #![warn(clippy::drop_ref)]
| ^^^^^^^^^^^^^^^^ help: use the new name: `drop_ref` | ^^^^^^^^^^^^^^^^ help: use the new name: `dropping_references`
error: lint `clippy::for_loop_over_option` has been renamed to `for_loops_over_fallibles` error: lint `clippy::for_loop_over_option` has been renamed to `for_loops_over_fallibles`
--> $DIR/rename.rs:82:9 --> $DIR/rename.rs:82:9

View file

@ -1,4 +1,4 @@
#![allow(drop_ref)] #![allow(dropping_references)]
fn main() { fn main() {
let target = &mut 42; let target = &mut 42;

View file

@ -1,7 +1,7 @@
// Check that closure captures for slice patterns are inferred correctly // Check that closure captures for slice patterns are inferred correctly
#![allow(unused_variables)] #![allow(unused_variables)]
#![allow(drop_ref)] #![allow(dropping_references)]
// run-pass // run-pass

View file

@ -1,7 +1,7 @@
// run-pass // run-pass
#![warn(rust_2021_incompatible_closure_captures)] #![warn(rust_2021_incompatible_closure_captures)]
#![allow(drop_ref, dropping_copy_types)] #![allow(dropping_references, dropping_copy_types)]
fn main() { fn main() {
if let a = "" { if let a = "" {

View file

@ -3,7 +3,7 @@
#![allow(unused)] #![allow(unused)]
#![allow(dead_code)] #![allow(dead_code)]
#![allow(drop_ref)] #![allow(dropping_references)]
struct Int(i32); struct Int(i32);
struct B<'a>(&'a i32); struct B<'a>(&'a i32);

View file

@ -2,7 +2,7 @@
// check-pass // check-pass
#![feature(rustc_attrs)] #![feature(rustc_attrs)]
#![allow(drop_ref)] #![allow(dropping_references)]
fn main() { fn main() {
let mut x = 1; let mut x = 1;

View file

@ -1,7 +1,7 @@
// run-pass // run-pass
// needs-unwind // needs-unwind
#![allow(drop_ref, dropping_copy_types)] #![allow(dropping_references, dropping_copy_types)]
static mut CHECK: usize = 0; static mut CHECK: usize = 0;

View file

@ -1,6 +1,6 @@
// run-rustfix // run-rustfix
#![allow(drop_ref)] #![allow(dropping_references)]
struct Foo { struct Foo {
x: isize x: isize

View file

@ -1,6 +1,6 @@
// run-rustfix // run-rustfix
#![allow(drop_ref)] #![allow(dropping_references)]
struct Foo { struct Foo {
x: isize x: isize

View file

@ -5,7 +5,7 @@
// [drop_tracking_mir] build-pass // [drop_tracking_mir] build-pass
#![feature(generators, negative_impls)] #![feature(generators, negative_impls)]
#![allow(drop_ref, dropping_copy_types)] #![allow(dropping_references, dropping_copy_types)]
macro_rules! type_combinations { macro_rules! type_combinations {
( (

View file

@ -1,6 +1,6 @@
// run-rustfix // run-rustfix
#![allow(drop_ref)] #![allow(dropping_references)]
struct Foo; struct Foo;

View file

@ -1,6 +1,6 @@
// run-rustfix // run-rustfix
#![allow(drop_ref)] #![allow(dropping_references)]
struct Foo; struct Foo;

View file

@ -32,7 +32,7 @@ LL | drop(s3);
| argument has type `&SomeStruct` | argument has type `&SomeStruct`
| |
= note: use `let _ = ...` to ignore the expression or result = note: use `let _ = ...` to ignore the expression or result
= note: `#[warn(drop_ref)]` on by default = note: `#[warn(dropping_references)]` on by default
warning: calls to `std::mem::drop` with a value that implements `Copy` does nothing warning: calls to `std::mem::drop` with a value that implements `Copy` does nothing
--> $DIR/dropping_copy_types.rs:37:5 --> $DIR/dropping_copy_types.rs:37:5

View file

@ -1,6 +1,6 @@
// check-pass // check-pass
#![warn(drop_ref)] #![warn(dropping_references)]
struct SomeStruct; struct SomeStruct;

View file

@ -1,5 +1,5 @@
warning: calls to `std::mem::drop` with a reference instead of an owned value does nothing warning: calls to `std::mem::drop` with a reference instead of an owned value does nothing
--> $DIR/drop_ref.rs:8:5 --> $DIR/dropping_references.rs:8:5
| |
LL | drop(&SomeStruct); LL | drop(&SomeStruct);
| ^^^^^-----------^ | ^^^^^-----------^
@ -8,13 +8,13 @@ LL | drop(&SomeStruct);
| |
= note: use `let _ = ...` to ignore the expression or result = note: use `let _ = ...` to ignore the expression or result
note: the lint level is defined here note: the lint level is defined here
--> $DIR/drop_ref.rs:3:9 --> $DIR/dropping_references.rs:3:9
| |
LL | #![warn(drop_ref)] LL | #![warn(dropping_references)]
| ^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^
warning: calls to `std::mem::drop` with a reference instead of an owned value does nothing warning: calls to `std::mem::drop` with a reference instead of an owned value does nothing
--> $DIR/drop_ref.rs:11:5 --> $DIR/dropping_references.rs:11:5
| |
LL | drop(&owned1); LL | drop(&owned1);
| ^^^^^-------^ | ^^^^^-------^
@ -24,7 +24,7 @@ LL | drop(&owned1);
= note: use `let _ = ...` to ignore the expression or result = note: use `let _ = ...` to ignore the expression or result
warning: calls to `std::mem::drop` with a reference instead of an owned value does nothing warning: calls to `std::mem::drop` with a reference instead of an owned value does nothing
--> $DIR/drop_ref.rs:12:5 --> $DIR/dropping_references.rs:12:5
| |
LL | drop(&&owned1); LL | drop(&&owned1);
| ^^^^^--------^ | ^^^^^--------^
@ -34,7 +34,7 @@ LL | drop(&&owned1);
= note: use `let _ = ...` to ignore the expression or result = note: use `let _ = ...` to ignore the expression or result
warning: calls to `std::mem::drop` with a reference instead of an owned value does nothing warning: calls to `std::mem::drop` with a reference instead of an owned value does nothing
--> $DIR/drop_ref.rs:13:5 --> $DIR/dropping_references.rs:13:5
| |
LL | drop(&mut owned1); LL | drop(&mut owned1);
| ^^^^^-----------^ | ^^^^^-----------^
@ -44,7 +44,7 @@ LL | drop(&mut owned1);
= note: use `let _ = ...` to ignore the expression or result = note: use `let _ = ...` to ignore the expression or result
warning: calls to `std::mem::drop` with a reference instead of an owned value does nothing warning: calls to `std::mem::drop` with a reference instead of an owned value does nothing
--> $DIR/drop_ref.rs:17:5 --> $DIR/dropping_references.rs:17:5
| |
LL | drop(reference1); LL | drop(reference1);
| ^^^^^----------^ | ^^^^^----------^
@ -54,7 +54,7 @@ LL | drop(reference1);
= note: use `let _ = ...` to ignore the expression or result = note: use `let _ = ...` to ignore the expression or result
warning: calls to `std::mem::drop` with a reference instead of an owned value does nothing warning: calls to `std::mem::drop` with a reference instead of an owned value does nothing
--> $DIR/drop_ref.rs:20:5 --> $DIR/dropping_references.rs:20:5
| |
LL | drop(reference2); LL | drop(reference2);
| ^^^^^----------^ | ^^^^^----------^
@ -64,7 +64,7 @@ LL | drop(reference2);
= note: use `let _ = ...` to ignore the expression or result = note: use `let _ = ...` to ignore the expression or result
warning: calls to `std::mem::drop` with a reference instead of an owned value does nothing warning: calls to `std::mem::drop` with a reference instead of an owned value does nothing
--> $DIR/drop_ref.rs:23:5 --> $DIR/dropping_references.rs:23:5
| |
LL | drop(reference3); LL | drop(reference3);
| ^^^^^----------^ | ^^^^^----------^
@ -74,7 +74,7 @@ LL | drop(reference3);
= note: use `let _ = ...` to ignore the expression or result = note: use `let _ = ...` to ignore the expression or result
warning: calls to `std::mem::drop` with a reference instead of an owned value does nothing warning: calls to `std::mem::drop` with a reference instead of an owned value does nothing
--> $DIR/drop_ref.rs:28:5 --> $DIR/dropping_references.rs:28:5
| |
LL | drop(&val); LL | drop(&val);
| ^^^^^----^ | ^^^^^----^
@ -84,7 +84,7 @@ LL | drop(&val);
= note: use `let _ = ...` to ignore the expression or result = note: use `let _ = ...` to ignore the expression or result
warning: calls to `std::mem::drop` with a reference instead of an owned value does nothing warning: calls to `std::mem::drop` with a reference instead of an owned value does nothing
--> $DIR/drop_ref.rs:36:5 --> $DIR/dropping_references.rs:36:5
| |
LL | std::mem::drop(&SomeStruct); LL | std::mem::drop(&SomeStruct);
| ^^^^^^^^^^^^^^^-----------^ | ^^^^^^^^^^^^^^^-----------^
@ -94,7 +94,7 @@ LL | std::mem::drop(&SomeStruct);
= note: use `let _ = ...` to ignore the expression or result = note: use `let _ = ...` to ignore the expression or result
warning: calls to `std::mem::drop` with a reference instead of an owned value does nothing warning: calls to `std::mem::drop` with a reference instead of an owned value does nothing
--> $DIR/drop_ref.rs:91:13 --> $DIR/dropping_references.rs:91:13
| |
LL | drop(println_and(&13)); LL | drop(println_and(&13));
| ^^^^^----------------^ | ^^^^^----------------^
@ -104,7 +104,7 @@ LL | drop(println_and(&13));
= note: use `let _ = ...` to ignore the expression or result = note: use `let _ = ...` to ignore the expression or result
warning: calls to `std::mem::drop` with a reference instead of an owned value does nothing warning: calls to `std::mem::drop` with a reference instead of an owned value does nothing
--> $DIR/drop_ref.rs:94:14 --> $DIR/dropping_references.rs:94:14
| |
LL | 3 if drop(println_and(&14)) == () => (), LL | 3 if drop(println_and(&14)) == () => (),
| ^^^^^----------------^ | ^^^^^----------------^
@ -114,7 +114,7 @@ LL | 3 if drop(println_and(&14)) == () => (),
= note: use `let _ = ...` to ignore the expression or result = note: use `let _ = ...` to ignore the expression or result
warning: calls to `std::mem::drop` with a reference instead of an owned value does nothing warning: calls to `std::mem::drop` with a reference instead of an owned value does nothing
--> $DIR/drop_ref.rs:96:14 --> $DIR/dropping_references.rs:96:14
| |
LL | 4 => drop(&2), LL | 4 => drop(&2),
| ^^^^^--^ | ^^^^^--^

View file

@ -3,7 +3,7 @@
// //
// check-pass // check-pass
#![allow(drop_ref)] #![allow(dropping_references)]
trait MyTrait<'a> { trait MyTrait<'a> {
type Output; type Output;

View file

@ -4,7 +4,7 @@
#![allow(irrefutable_let_patterns)] #![allow(irrefutable_let_patterns)]
#![allow(dropping_copy_types)] #![allow(dropping_copy_types)]
#![allow(drop_ref)] #![allow(dropping_references)]
fn main() { fn main() {
// A regression test for a mistake we made at one point: // A regression test for a mistake we made at one point:

View file

@ -2,7 +2,7 @@
// Test `@` patterns combined with `box` patterns. // Test `@` patterns combined with `box` patterns.
#![allow(drop_ref)] #![allow(dropping_references)]
#![allow(dropping_copy_types)] #![allow(dropping_copy_types)]
#![feature(box_patterns)] #![feature(box_patterns)]

View file

@ -1,6 +1,6 @@
// check-pass // check-pass
#![allow(drop_ref)] #![allow(dropping_references)]
fn main() {} fn main() {}

View file

@ -1,6 +1,6 @@
// check-pass // check-pass
#![allow(drop_ref)] #![allow(dropping_references)]
fn main() { fn main() {
struct U; struct U;

View file

@ -3,7 +3,7 @@
// check-pass // check-pass
#![allow(drop_ref)] #![allow(dropping_references)]
// aux-build:monovariants.rs // aux-build:monovariants.rs
extern crate monovariants; extern crate monovariants;

View file

@ -14,7 +14,7 @@ async fn foo() {
#[cfg(fail)] #[cfg(fail)]
let x = &NotSync; let x = &NotSync;
bar().await; bar().await;
#[allow(drop_ref)] #[allow(dropping_references)]
drop(x); drop(x);
} }

View file

@ -2,7 +2,7 @@
// Check tautalogically false `Copy` bounds // Check tautalogically false `Copy` bounds
#![feature(trivial_bounds)] #![feature(trivial_bounds)]
#![allow(drop_ref, dropping_copy_types)] #![allow(dropping_references, dropping_copy_types)]
fn copy_string(t: String) -> String where String: Copy { //~ WARNING trivial_bounds fn copy_string(t: String) -> String where String: Copy { //~ WARNING trivial_bounds
is_copy(&t); is_copy(&t);