Use label instead of note to be more consistent with other lints
This commit is contained in:
parent
77773ad002
commit
457fa953a2
7 changed files with 133 additions and 283 deletions
|
@ -522,13 +522,13 @@ 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
|
||||
.note = argument has type `{$arg_ty}`
|
||||
.label = argument has type `{$arg_ty}`
|
||||
|
||||
lint_drop_copy = calls to `std::mem::drop` with a value that implements `Copy`.
|
||||
.note = argument has type `{$arg_ty}`
|
||||
.label = argument has type `{$arg_ty}`
|
||||
|
||||
lint_forget_ref = calls to `std::mem::forget` with a reference instead of an owned value
|
||||
.note = argument has type `{$arg_ty}`
|
||||
.label = argument has type `{$arg_ty}`
|
||||
|
||||
lint_forget_copy = calls to `std::mem::forget` with a value that implements `Copy`.
|
||||
.note = argument has type `{$arg_ty}`
|
||||
.label = argument has type `{$arg_ty}`
|
||||
|
|
|
@ -123,16 +123,16 @@ 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, note: arg.span });
|
||||
cx.emit_spanned_lint(DROP_REF, 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, note: arg.span });
|
||||
cx.emit_spanned_lint(FORGET_REF, expr.span, ForgetRefDiag { arg_ty, label: arg.span });
|
||||
},
|
||||
sym::mem_drop if is_copy && !drop_is_single_call_in_arm => {
|
||||
cx.emit_spanned_lint(DROP_COPY, expr.span, DropCopyDiag { arg_ty, note: arg.span });
|
||||
cx.emit_spanned_lint(DROP_COPY, expr.span, DropCopyDiag { arg_ty, label: arg.span });
|
||||
}
|
||||
sym::mem_forget if is_copy => {
|
||||
cx.emit_spanned_lint(FORGET_COPY, expr.span, ForgetCopyDiag { arg_ty, note: arg.span });
|
||||
cx.emit_spanned_lint(FORGET_COPY, expr.span, ForgetCopyDiag { arg_ty, label: arg.span });
|
||||
}
|
||||
_ => return,
|
||||
};
|
||||
|
|
|
@ -667,32 +667,32 @@ pub struct ForLoopsOverFalliblesSuggestion<'a> {
|
|||
#[diag(lint_drop_ref)]
|
||||
pub struct DropRefDiag<'a> {
|
||||
pub arg_ty: Ty<'a>,
|
||||
#[note]
|
||||
pub note: Span,
|
||||
#[label]
|
||||
pub label: Span,
|
||||
}
|
||||
|
||||
#[derive(LintDiagnostic)]
|
||||
#[diag(lint_drop_copy)]
|
||||
pub struct DropCopyDiag<'a> {
|
||||
pub arg_ty: Ty<'a>,
|
||||
#[note]
|
||||
pub note: Span,
|
||||
#[label]
|
||||
pub label: Span,
|
||||
}
|
||||
|
||||
#[derive(LintDiagnostic)]
|
||||
#[diag(lint_forget_ref)]
|
||||
pub struct ForgetRefDiag<'a> {
|
||||
pub arg_ty: Ty<'a>,
|
||||
#[note]
|
||||
pub note: Span,
|
||||
#[label]
|
||||
pub label: Span,
|
||||
}
|
||||
|
||||
#[derive(LintDiagnostic)]
|
||||
#[diag(lint_forget_copy)]
|
||||
pub struct ForgetCopyDiag<'a> {
|
||||
pub arg_ty: Ty<'a>,
|
||||
#[note]
|
||||
pub note: Span,
|
||||
#[label]
|
||||
pub label: Span,
|
||||
}
|
||||
|
||||
// hidden_unicode_codepoints.rs
|
||||
|
|
|
@ -2,13 +2,10 @@ warning: calls to `std::mem::drop` with a value that implements `Copy`.
|
|||
--> $DIR/drop_copy.rs:34:5
|
||||
|
|
||||
LL | drop(s1);
|
||||
| ^^^^^^^^
|
||||
| ^^^^^--^
|
||||
| |
|
||||
| argument has type `SomeStruct`
|
||||
|
|
||||
note: argument has type `SomeStruct`
|
||||
--> $DIR/drop_copy.rs:34:10
|
||||
|
|
||||
LL | drop(s1);
|
||||
| ^^
|
||||
note: the lint level is defined here
|
||||
--> $DIR/drop_copy.rs:3:9
|
||||
|
|
||||
|
@ -19,110 +16,75 @@ warning: calls to `std::mem::drop` with a value that implements `Copy`.
|
|||
--> $DIR/drop_copy.rs:35:5
|
||||
|
|
||||
LL | drop(s2);
|
||||
| ^^^^^^^^
|
||||
|
|
||||
note: argument has type `SomeStruct`
|
||||
--> $DIR/drop_copy.rs:35:10
|
||||
|
|
||||
LL | drop(s2);
|
||||
| ^^
|
||||
| ^^^^^--^
|
||||
| |
|
||||
| argument has type `SomeStruct`
|
||||
|
||||
warning: calls to `std::mem::drop` with a reference instead of an owned value
|
||||
--> $DIR/drop_copy.rs:36:5
|
||||
|
|
||||
LL | drop(s3);
|
||||
| ^^^^^^^^
|
||||
| ^^^^^--^
|
||||
| |
|
||||
| argument has type `&SomeStruct`
|
||||
|
|
||||
note: argument has type `&SomeStruct`
|
||||
--> $DIR/drop_copy.rs:36:10
|
||||
|
|
||||
LL | drop(s3);
|
||||
| ^^
|
||||
= note: `#[warn(drop_ref)]` on by default
|
||||
|
||||
warning: calls to `std::mem::drop` with a value that implements `Copy`.
|
||||
--> $DIR/drop_copy.rs:37:5
|
||||
|
|
||||
LL | drop(s4);
|
||||
| ^^^^^^^^
|
||||
|
|
||||
note: argument has type `SomeStruct`
|
||||
--> $DIR/drop_copy.rs:37:10
|
||||
|
|
||||
LL | drop(s4);
|
||||
| ^^
|
||||
| ^^^^^--^
|
||||
| |
|
||||
| argument has type `SomeStruct`
|
||||
|
||||
warning: calls to `std::mem::drop` with a reference instead of an owned value
|
||||
--> $DIR/drop_copy.rs:38:5
|
||||
|
|
||||
LL | drop(s5);
|
||||
| ^^^^^^^^
|
||||
|
|
||||
note: argument has type `&SomeStruct`
|
||||
--> $DIR/drop_copy.rs:38:10
|
||||
|
|
||||
LL | drop(s5);
|
||||
| ^^
|
||||
| ^^^^^--^
|
||||
| |
|
||||
| argument has type `&SomeStruct`
|
||||
|
||||
warning: calls to `std::mem::drop` with a reference instead of an owned value
|
||||
--> $DIR/drop_copy.rs:50:5
|
||||
|
|
||||
LL | drop(a2);
|
||||
| ^^^^^^^^
|
||||
|
|
||||
note: argument has type `&AnotherStruct`
|
||||
--> $DIR/drop_copy.rs:50:10
|
||||
|
|
||||
LL | drop(a2);
|
||||
| ^^
|
||||
| ^^^^^--^
|
||||
| |
|
||||
| argument has type `&AnotherStruct`
|
||||
|
||||
warning: calls to `std::mem::drop` with a reference instead of an owned value
|
||||
--> $DIR/drop_copy.rs:52:5
|
||||
|
|
||||
LL | drop(a4);
|
||||
| ^^^^^^^^
|
||||
|
|
||||
note: argument has type `&AnotherStruct`
|
||||
--> $DIR/drop_copy.rs:52:10
|
||||
|
|
||||
LL | drop(a4);
|
||||
| ^^
|
||||
| ^^^^^--^
|
||||
| |
|
||||
| argument has type `&AnotherStruct`
|
||||
|
||||
warning: calls to `std::mem::drop` with a value that implements `Copy`.
|
||||
--> $DIR/drop_copy.rs:71:13
|
||||
|
|
||||
LL | drop(println_and(13));
|
||||
| ^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
note: argument has type `i32`
|
||||
--> $DIR/drop_copy.rs:71:18
|
||||
|
|
||||
LL | drop(println_and(13));
|
||||
| ^^^^^^^^^^^^^^^
|
||||
| ^^^^^---------------^
|
||||
| |
|
||||
| argument has type `i32`
|
||||
|
||||
warning: calls to `std::mem::drop` with a value that implements `Copy`.
|
||||
--> $DIR/drop_copy.rs:74:14
|
||||
|
|
||||
LL | 3 if drop(println_and(14)) == () => (),
|
||||
| ^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
note: argument has type `i32`
|
||||
--> $DIR/drop_copy.rs:74:19
|
||||
|
|
||||
LL | 3 if drop(println_and(14)) == () => (),
|
||||
| ^^^^^^^^^^^^^^^
|
||||
| ^^^^^---------------^
|
||||
| |
|
||||
| argument has type `i32`
|
||||
|
||||
warning: calls to `std::mem::drop` with a value that implements `Copy`.
|
||||
--> $DIR/drop_copy.rs:76:14
|
||||
|
|
||||
LL | 4 => drop(2),
|
||||
| ^^^^^^^
|
||||
|
|
||||
note: argument has type `i32`
|
||||
--> $DIR/drop_copy.rs:76:19
|
||||
|
|
||||
LL | 4 => drop(2),
|
||||
| ^
|
||||
| ^^^^^-^
|
||||
| |
|
||||
| argument has type `i32`
|
||||
|
||||
warning: 10 warnings emitted
|
||||
|
||||
|
|
|
@ -2,13 +2,10 @@ warning: calls to `std::mem::drop` with a reference instead of an owned value
|
|||
--> $DIR/drop_ref.rs:8:5
|
||||
|
|
||||
LL | drop(&SomeStruct);
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
| ^^^^^-----------^
|
||||
| |
|
||||
| argument has type `&SomeStruct`
|
||||
|
|
||||
note: argument has type `&SomeStruct`
|
||||
--> $DIR/drop_ref.rs:8:10
|
||||
|
|
||||
LL | drop(&SomeStruct);
|
||||
| ^^^^^^^^^^^
|
||||
note: the lint level is defined here
|
||||
--> $DIR/drop_ref.rs:3:9
|
||||
|
|
||||
|
@ -19,133 +16,89 @@ warning: calls to `std::mem::drop` with a reference instead of an owned value
|
|||
--> $DIR/drop_ref.rs:11:5
|
||||
|
|
||||
LL | drop(&owned1);
|
||||
| ^^^^^^^^^^^^^
|
||||
|
|
||||
note: argument has type `&SomeStruct`
|
||||
--> $DIR/drop_ref.rs:11:10
|
||||
|
|
||||
LL | drop(&owned1);
|
||||
| ^^^^^^^
|
||||
| ^^^^^-------^
|
||||
| |
|
||||
| argument has type `&SomeStruct`
|
||||
|
||||
warning: calls to `std::mem::drop` with a reference instead of an owned value
|
||||
--> $DIR/drop_ref.rs:12:5
|
||||
|
|
||||
LL | drop(&&owned1);
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
|
||||
note: argument has type `&&SomeStruct`
|
||||
--> $DIR/drop_ref.rs:12:10
|
||||
|
|
||||
LL | drop(&&owned1);
|
||||
| ^^^^^^^^
|
||||
| ^^^^^--------^
|
||||
| |
|
||||
| argument has type `&&SomeStruct`
|
||||
|
||||
warning: calls to `std::mem::drop` with a reference instead of an owned value
|
||||
--> $DIR/drop_ref.rs:13:5
|
||||
|
|
||||
LL | drop(&mut owned1);
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
note: argument has type `&mut SomeStruct`
|
||||
--> $DIR/drop_ref.rs:13:10
|
||||
|
|
||||
LL | drop(&mut owned1);
|
||||
| ^^^^^^^^^^^
|
||||
| ^^^^^-----------^
|
||||
| |
|
||||
| argument has type `&mut SomeStruct`
|
||||
|
||||
warning: calls to `std::mem::drop` with a reference instead of an owned value
|
||||
--> $DIR/drop_ref.rs:17:5
|
||||
|
|
||||
LL | drop(reference1);
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
|
||||
note: argument has type `&SomeStruct`
|
||||
--> $DIR/drop_ref.rs:17:10
|
||||
|
|
||||
LL | drop(reference1);
|
||||
| ^^^^^^^^^^
|
||||
| ^^^^^----------^
|
||||
| |
|
||||
| argument has type `&SomeStruct`
|
||||
|
||||
warning: calls to `std::mem::drop` with a reference instead of an owned value
|
||||
--> $DIR/drop_ref.rs:20:5
|
||||
|
|
||||
LL | drop(reference2);
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
|
||||
note: argument has type `&mut SomeStruct`
|
||||
--> $DIR/drop_ref.rs:20:10
|
||||
|
|
||||
LL | drop(reference2);
|
||||
| ^^^^^^^^^^
|
||||
| ^^^^^----------^
|
||||
| |
|
||||
| argument has type `&mut SomeStruct`
|
||||
|
||||
warning: calls to `std::mem::drop` with a reference instead of an owned value
|
||||
--> $DIR/drop_ref.rs:23:5
|
||||
|
|
||||
LL | drop(reference3);
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
|
||||
note: argument has type `&SomeStruct`
|
||||
--> $DIR/drop_ref.rs:23:10
|
||||
|
|
||||
LL | drop(reference3);
|
||||
| ^^^^^^^^^^
|
||||
| ^^^^^----------^
|
||||
| |
|
||||
| argument has type `&SomeStruct`
|
||||
|
||||
warning: calls to `std::mem::drop` with a reference instead of an owned value
|
||||
--> $DIR/drop_ref.rs:28:5
|
||||
|
|
||||
LL | drop(&val);
|
||||
| ^^^^^^^^^^
|
||||
|
|
||||
note: argument has type `&T`
|
||||
--> $DIR/drop_ref.rs:28:10
|
||||
|
|
||||
LL | drop(&val);
|
||||
| ^^^^
|
||||
| ^^^^^----^
|
||||
| |
|
||||
| argument has type `&T`
|
||||
|
||||
warning: calls to `std::mem::drop` with a reference instead of an owned value
|
||||
--> $DIR/drop_ref.rs:36:5
|
||||
|
|
||||
LL | std::mem::drop(&SomeStruct);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
note: argument has type `&SomeStruct`
|
||||
--> $DIR/drop_ref.rs:36:20
|
||||
|
|
||||
LL | std::mem::drop(&SomeStruct);
|
||||
| ^^^^^^^^^^^
|
||||
| ^^^^^^^^^^^^^^^-----------^
|
||||
| |
|
||||
| argument has type `&SomeStruct`
|
||||
|
||||
warning: calls to `std::mem::drop` with a reference instead of an owned value
|
||||
--> $DIR/drop_ref.rs:91:13
|
||||
|
|
||||
LL | drop(println_and(&13));
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
note: argument has type `&i32`
|
||||
--> $DIR/drop_ref.rs:91:18
|
||||
|
|
||||
LL | drop(println_and(&13));
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
| ^^^^^----------------^
|
||||
| |
|
||||
| argument has type `&i32`
|
||||
|
||||
warning: calls to `std::mem::drop` with a reference instead of an owned value
|
||||
--> $DIR/drop_ref.rs:94:14
|
||||
|
|
||||
LL | 3 if drop(println_and(&14)) == () => (),
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
note: argument has type `&i32`
|
||||
--> $DIR/drop_ref.rs:94:19
|
||||
|
|
||||
LL | 3 if drop(println_and(&14)) == () => (),
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
| ^^^^^----------------^
|
||||
| |
|
||||
| argument has type `&i32`
|
||||
|
||||
warning: calls to `std::mem::drop` with a reference instead of an owned value
|
||||
--> $DIR/drop_ref.rs:96:14
|
||||
|
|
||||
LL | 4 => drop(&2),
|
||||
| ^^^^^^^^
|
||||
|
|
||||
note: argument has type `&i32`
|
||||
--> $DIR/drop_ref.rs:96:19
|
||||
|
|
||||
LL | 4 => drop(&2),
|
||||
| ^^
|
||||
| ^^^^^--^
|
||||
| |
|
||||
| argument has type `&i32`
|
||||
|
||||
warning: 12 warnings emitted
|
||||
|
||||
|
|
|
@ -2,13 +2,10 @@ warning: calls to `std::mem::forget` with a value that implements `Copy`.
|
|||
--> $DIR/forget_copy.rs:34:5
|
||||
|
|
||||
LL | forget(s1);
|
||||
| ^^^^^^^^^^
|
||||
| ^^^^^^^--^
|
||||
| |
|
||||
| argument has type `SomeStruct`
|
||||
|
|
||||
note: argument has type `SomeStruct`
|
||||
--> $DIR/forget_copy.rs:34:12
|
||||
|
|
||||
LL | forget(s1);
|
||||
| ^^
|
||||
note: the lint level is defined here
|
||||
--> $DIR/forget_copy.rs:3:9
|
||||
|
|
||||
|
@ -19,86 +16,59 @@ warning: calls to `std::mem::forget` with a value that implements `Copy`.
|
|||
--> $DIR/forget_copy.rs:35:5
|
||||
|
|
||||
LL | forget(s2);
|
||||
| ^^^^^^^^^^
|
||||
|
|
||||
note: argument has type `SomeStruct`
|
||||
--> $DIR/forget_copy.rs:35:12
|
||||
|
|
||||
LL | forget(s2);
|
||||
| ^^
|
||||
| ^^^^^^^--^
|
||||
| |
|
||||
| argument has type `SomeStruct`
|
||||
|
||||
warning: calls to `std::mem::forget` with a reference instead of an owned value
|
||||
--> $DIR/forget_copy.rs:36:5
|
||||
|
|
||||
LL | forget(s3);
|
||||
| ^^^^^^^^^^
|
||||
| ^^^^^^^--^
|
||||
| |
|
||||
| argument has type `&SomeStruct`
|
||||
|
|
||||
note: argument has type `&SomeStruct`
|
||||
--> $DIR/forget_copy.rs:36:12
|
||||
|
|
||||
LL | forget(s3);
|
||||
| ^^
|
||||
= note: `#[warn(forget_ref)]` on by default
|
||||
|
||||
warning: calls to `std::mem::forget` with a value that implements `Copy`.
|
||||
--> $DIR/forget_copy.rs:37:5
|
||||
|
|
||||
LL | forget(s4);
|
||||
| ^^^^^^^^^^
|
||||
|
|
||||
note: argument has type `SomeStruct`
|
||||
--> $DIR/forget_copy.rs:37:12
|
||||
|
|
||||
LL | forget(s4);
|
||||
| ^^
|
||||
| ^^^^^^^--^
|
||||
| |
|
||||
| argument has type `SomeStruct`
|
||||
|
||||
warning: calls to `std::mem::forget` with a reference instead of an owned value
|
||||
--> $DIR/forget_copy.rs:38:5
|
||||
|
|
||||
LL | forget(s5);
|
||||
| ^^^^^^^^^^
|
||||
|
|
||||
note: argument has type `&SomeStruct`
|
||||
--> $DIR/forget_copy.rs:38:12
|
||||
|
|
||||
LL | forget(s5);
|
||||
| ^^
|
||||
| ^^^^^^^--^
|
||||
| |
|
||||
| argument has type `&SomeStruct`
|
||||
|
||||
warning: calls to `std::mem::forget` with a reference instead of an owned value
|
||||
--> $DIR/forget_copy.rs:50:5
|
||||
|
|
||||
LL | forget(a2);
|
||||
| ^^^^^^^^^^
|
||||
|
|
||||
note: argument has type `&AnotherStruct`
|
||||
--> $DIR/forget_copy.rs:50:12
|
||||
|
|
||||
LL | forget(a2);
|
||||
| ^^
|
||||
| ^^^^^^^--^
|
||||
| |
|
||||
| argument has type `&AnotherStruct`
|
||||
|
||||
warning: calls to `std::mem::forget` with a reference instead of an owned value
|
||||
--> $DIR/forget_copy.rs:52:5
|
||||
|
|
||||
LL | forget(a3);
|
||||
| ^^^^^^^^^^
|
||||
|
|
||||
note: argument has type `&AnotherStruct`
|
||||
--> $DIR/forget_copy.rs:52:12
|
||||
|
|
||||
LL | forget(a3);
|
||||
| ^^
|
||||
| ^^^^^^^--^
|
||||
| |
|
||||
| argument has type `&AnotherStruct`
|
||||
|
||||
warning: calls to `std::mem::forget` with a reference instead of an owned value
|
||||
--> $DIR/forget_copy.rs:53:5
|
||||
|
|
||||
LL | forget(a4);
|
||||
| ^^^^^^^^^^
|
||||
|
|
||||
note: argument has type `&AnotherStruct`
|
||||
--> $DIR/forget_copy.rs:53:12
|
||||
|
|
||||
LL | forget(a4);
|
||||
| ^^
|
||||
| ^^^^^^^--^
|
||||
| |
|
||||
| argument has type `&AnotherStruct`
|
||||
|
||||
warning: 8 warnings emitted
|
||||
|
||||
|
|
|
@ -2,13 +2,10 @@ warning: calls to `std::mem::forget` with a reference instead of an owned value
|
|||
--> $DIR/forget_ref.rs:10:5
|
||||
|
|
||||
LL | forget(&SomeStruct);
|
||||
| ^^^^^^^^^^^^^^^^^^^
|
||||
| ^^^^^^^-----------^
|
||||
| |
|
||||
| argument has type `&SomeStruct`
|
||||
|
|
||||
note: argument has type `&SomeStruct`
|
||||
--> $DIR/forget_ref.rs:10:12
|
||||
|
|
||||
LL | forget(&SomeStruct);
|
||||
| ^^^^^^^^^^^
|
||||
note: the lint level is defined here
|
||||
--> $DIR/forget_ref.rs:3:9
|
||||
|
|
||||
|
@ -19,97 +16,65 @@ warning: calls to `std::mem::forget` with a reference instead of an owned value
|
|||
--> $DIR/forget_ref.rs:13:5
|
||||
|
|
||||
LL | forget(&owned);
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
|
||||
note: argument has type `&SomeStruct`
|
||||
--> $DIR/forget_ref.rs:13:12
|
||||
|
|
||||
LL | forget(&owned);
|
||||
| ^^^^^^
|
||||
| ^^^^^^^------^
|
||||
| |
|
||||
| argument has type `&SomeStruct`
|
||||
|
||||
warning: calls to `std::mem::forget` with a reference instead of an owned value
|
||||
--> $DIR/forget_ref.rs:14:5
|
||||
|
|
||||
LL | forget(&&owned);
|
||||
| ^^^^^^^^^^^^^^^
|
||||
|
|
||||
note: argument has type `&&SomeStruct`
|
||||
--> $DIR/forget_ref.rs:14:12
|
||||
|
|
||||
LL | forget(&&owned);
|
||||
| ^^^^^^^
|
||||
| ^^^^^^^-------^
|
||||
| |
|
||||
| argument has type `&&SomeStruct`
|
||||
|
||||
warning: calls to `std::mem::forget` with a reference instead of an owned value
|
||||
--> $DIR/forget_ref.rs:15:5
|
||||
|
|
||||
LL | forget(&mut owned);
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
note: argument has type `&mut SomeStruct`
|
||||
--> $DIR/forget_ref.rs:15:12
|
||||
|
|
||||
LL | forget(&mut owned);
|
||||
| ^^^^^^^^^^
|
||||
| ^^^^^^^----------^
|
||||
| |
|
||||
| argument has type `&mut SomeStruct`
|
||||
|
||||
warning: calls to `std::mem::forget` with a reference instead of an owned value
|
||||
--> $DIR/forget_ref.rs:19:5
|
||||
|
|
||||
LL | forget(&*reference1);
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
note: argument has type `&SomeStruct`
|
||||
--> $DIR/forget_ref.rs:19:12
|
||||
|
|
||||
LL | forget(&*reference1);
|
||||
| ^^^^^^^^^^^^
|
||||
| ^^^^^^^------------^
|
||||
| |
|
||||
| argument has type `&SomeStruct`
|
||||
|
||||
warning: calls to `std::mem::forget` with a reference instead of an owned value
|
||||
--> $DIR/forget_ref.rs:22:5
|
||||
|
|
||||
LL | forget(reference2);
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
note: argument has type `&mut SomeStruct`
|
||||
--> $DIR/forget_ref.rs:22:12
|
||||
|
|
||||
LL | forget(reference2);
|
||||
| ^^^^^^^^^^
|
||||
| ^^^^^^^----------^
|
||||
| |
|
||||
| argument has type `&mut SomeStruct`
|
||||
|
||||
warning: calls to `std::mem::forget` with a reference instead of an owned value
|
||||
--> $DIR/forget_ref.rs:25:5
|
||||
|
|
||||
LL | forget(reference3);
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
note: argument has type `&SomeStruct`
|
||||
--> $DIR/forget_ref.rs:25:12
|
||||
|
|
||||
LL | forget(reference3);
|
||||
| ^^^^^^^^^^
|
||||
| ^^^^^^^----------^
|
||||
| |
|
||||
| argument has type `&SomeStruct`
|
||||
|
||||
warning: calls to `std::mem::forget` with a reference instead of an owned value
|
||||
--> $DIR/forget_ref.rs:30:5
|
||||
|
|
||||
LL | forget(&val);
|
||||
| ^^^^^^^^^^^^
|
||||
|
|
||||
note: argument has type `&T`
|
||||
--> $DIR/forget_ref.rs:30:12
|
||||
|
|
||||
LL | forget(&val);
|
||||
| ^^^^
|
||||
| ^^^^^^^----^
|
||||
| |
|
||||
| argument has type `&T`
|
||||
|
||||
warning: calls to `std::mem::forget` with a reference instead of an owned value
|
||||
--> $DIR/forget_ref.rs:38:5
|
||||
|
|
||||
LL | std::mem::forget(&SomeStruct);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
note: argument has type `&SomeStruct`
|
||||
--> $DIR/forget_ref.rs:38:22
|
||||
|
|
||||
LL | std::mem::forget(&SomeStruct);
|
||||
| ^^^^^^^^^^^
|
||||
| ^^^^^^^^^^^^^^^^^-----------^
|
||||
| |
|
||||
| argument has type `&SomeStruct`
|
||||
|
||||
warning: 9 warnings emitted
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue