Apply review suggestions from @y21

This commit is contained in:
koka 2023-10-04 00:13:53 +09:00
parent 1a56f90ee5
commit c7152679ef
No known key found for this signature in database
GPG key ID: A5917A40697774CD
3 changed files with 31 additions and 31 deletions

View file

@ -124,14 +124,34 @@ impl Drop for WithDrop {
fn drop(&mut self) {}
}
struct InnerDrop(WithDrop);
struct ComposeDrop {
d: WithDrop,
}
struct WithoutDrop(usize);
fn drop_trait() {
let a = WithDrop(1);
let b = WithDrop(2);
let a = a;
let c = WithoutDrop(1);
let d = WithoutDrop(2);
let c = c;
}
fn without_drop() {
let a = WithoutDrop(1);
let b = WithoutDrop(2);
let a = a;
}
fn drop_inner() {
let a = InnerDrop(WithDrop(1));
let b = InnerDrop(WithDrop(2));
let a = a;
}
fn drop_compose() {
let a = ComposeDrop { d: WithDrop(1) };
let b = ComposeDrop { d: WithDrop(1) };
let a = a;
}

View file

@ -134,15 +134,15 @@ LL | let x = x;
= help: remove the redefinition of `x`
error: redundant redefinition of a binding
--> $DIR/redundant_locals.rs:134:9
--> $DIR/redundant_locals.rs:142:9
|
LL | let c = WithoutDrop(1);
LL | let a = WithoutDrop(1);
| ^
LL | let d = WithoutDrop(2);
LL | let c = c;
LL | let b = WithoutDrop(2);
LL | let a = a;
| ^^^^^^^^^^
|
= help: remove the redefinition of `c`
= help: remove the redefinition of `a`
error: aborting due to 14 previous errors