Rename drop_ref
lint to dropping_references
This commit is contained in:
parent
85a1828943
commit
c93d9c1794
30 changed files with 50 additions and 50 deletions
|
@ -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_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}`
|
||||
.note = use `let _ = ...` to ignore the expression or result
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ use crate::{
|
|||
};
|
||||
|
||||
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.
|
||||
///
|
||||
/// ### Example
|
||||
|
@ -29,7 +29,7 @@ declare_lint! {
|
|||
/// 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
|
||||
/// is likely what was intended.
|
||||
pub DROP_REF,
|
||||
pub DROPPING_REFERENCES,
|
||||
Warn,
|
||||
"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"
|
||||
}
|
||||
|
||||
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 {
|
||||
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);
|
||||
match fn_name {
|
||||
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() => {
|
||||
cx.emit_spanned_lint(FORGET_REF, expr.span, ForgetRefDiag { arg_ty, label: arg.span });
|
||||
|
|
|
@ -662,9 +662,9 @@ pub struct ForLoopsOverFalliblesSuggestion<'a> {
|
|||
pub end_span: Span,
|
||||
}
|
||||
|
||||
// drop_ref.rs
|
||||
// drop_forget_useless.rs
|
||||
#[derive(LintDiagnostic)]
|
||||
#[diag(lint_drop_ref)]
|
||||
#[diag(lint_dropping_references)]
|
||||
#[note]
|
||||
pub struct DropRefDiag<'a> {
|
||||
pub arg_ty: Ty<'a>,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue