573 lines
20 KiB
Plaintext
573 lines
20 KiB
Plaintext
error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
|
|
--> tests/ui/significant_drop_in_scrutinee.rs:60:11
|
|
|
|
|
LL | match mutex.lock().unwrap().foo() {
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
...
|
|
LL | mutex.lock().unwrap().bar();
|
|
| --------------------- another value with significant `Drop` created here
|
|
...
|
|
LL | };
|
|
| - temporary lives until here
|
|
|
|
|
= note: this might lead to deadlocks or other unexpected behavior
|
|
= note: `-D clippy::significant-drop-in-scrutinee` implied by `-D warnings`
|
|
= help: to override `-D warnings` add `#[allow(clippy::significant_drop_in_scrutinee)]`
|
|
help: try moving the temporary above the match
|
|
|
|
|
LL ~ let value = mutex.lock().unwrap().foo();
|
|
LL ~ match value {
|
|
|
|
|
|
|
error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
|
|
--> tests/ui/significant_drop_in_scrutinee.rs:148:11
|
|
|
|
|
LL | match s.lock_m().get_the_value() {
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
...
|
|
LL | println!("{}", s.lock_m().get_the_value());
|
|
| ---------- another value with significant `Drop` created here
|
|
...
|
|
LL | println!("{}", s.lock_m().get_the_value());
|
|
| ---------- another value with significant `Drop` created here
|
|
...
|
|
LL | }
|
|
| - temporary lives until here
|
|
|
|
|
= note: this might lead to deadlocks or other unexpected behavior
|
|
help: try moving the temporary above the match
|
|
|
|
|
LL ~ let value = s.lock_m().get_the_value();
|
|
LL ~ match value {
|
|
|
|
|
|
|
error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
|
|
--> tests/ui/significant_drop_in_scrutinee.rs:171:11
|
|
|
|
|
LL | match s.lock_m_m().get_the_value() {
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
...
|
|
LL | println!("{}", s.lock_m().get_the_value());
|
|
| ---------- another value with significant `Drop` created here
|
|
...
|
|
LL | println!("{}", s.lock_m().get_the_value());
|
|
| ---------- another value with significant `Drop` created here
|
|
...
|
|
LL | }
|
|
| - temporary lives until here
|
|
|
|
|
= note: this might lead to deadlocks or other unexpected behavior
|
|
help: try moving the temporary above the match
|
|
|
|
|
LL ~ let value = s.lock_m_m().get_the_value();
|
|
LL ~ match value {
|
|
|
|
|
|
|
error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
|
|
--> tests/ui/significant_drop_in_scrutinee.rs:221:11
|
|
|
|
|
LL | match counter.temp_increment().len() {
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
...
|
|
LL | };
|
|
| - temporary lives until here
|
|
|
|
|
= note: this might lead to deadlocks or other unexpected behavior
|
|
help: try moving the temporary above the match
|
|
|
|
|
LL ~ let value = counter.temp_increment().len();
|
|
LL ~ match value {
|
|
|
|
|
|
|
error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
|
|
--> tests/ui/significant_drop_in_scrutinee.rs:246:16
|
|
|
|
|
LL | match (mutex1.lock().unwrap().s.len(), true) {
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
...
|
|
LL | mutex1.lock().unwrap().s.len();
|
|
| ---------------------- another value with significant `Drop` created here
|
|
...
|
|
LL | };
|
|
| - temporary lives until here
|
|
|
|
|
= note: this might lead to deadlocks or other unexpected behavior
|
|
help: try moving the temporary above the match
|
|
|
|
|
LL ~ let value = mutex1.lock().unwrap().s.len();
|
|
LL ~ match (value, true) {
|
|
|
|
|
|
|
error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
|
|
--> tests/ui/significant_drop_in_scrutinee.rs:257:22
|
|
|
|
|
LL | match (true, mutex1.lock().unwrap().s.len(), true) {
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
...
|
|
LL | mutex1.lock().unwrap().s.len();
|
|
| ---------------------- another value with significant `Drop` created here
|
|
...
|
|
LL | };
|
|
| - temporary lives until here
|
|
|
|
|
= note: this might lead to deadlocks or other unexpected behavior
|
|
help: try moving the temporary above the match
|
|
|
|
|
LL ~ let value = mutex1.lock().unwrap().s.len();
|
|
LL ~ match (true, value, true) {
|
|
|
|
|
|
|
error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
|
|
--> tests/ui/significant_drop_in_scrutinee.rs:269:16
|
|
|
|
|
LL | match (mutex1.lock().unwrap().s.len(), true, mutex2.lock().unwrap().s.len()) {
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
...
|
|
LL | mutex1.lock().unwrap().s.len();
|
|
| ---------------------- another value with significant `Drop` created here
|
|
LL | mutex2.lock().unwrap().s.len();
|
|
| ---------------------- another value with significant `Drop` created here
|
|
...
|
|
LL | };
|
|
| - temporary lives until here
|
|
|
|
|
= note: this might lead to deadlocks or other unexpected behavior
|
|
help: try moving the temporary above the match
|
|
|
|
|
LL ~ let value = mutex1.lock().unwrap().s.len();
|
|
LL ~ match (value, true, mutex2.lock().unwrap().s.len()) {
|
|
|
|
|
|
|
error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
|
|
--> tests/ui/significant_drop_in_scrutinee.rs:269:54
|
|
|
|
|
LL | match (mutex1.lock().unwrap().s.len(), true, mutex2.lock().unwrap().s.len()) {
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
...
|
|
LL | mutex1.lock().unwrap().s.len();
|
|
| ---------------------- another value with significant `Drop` created here
|
|
LL | mutex2.lock().unwrap().s.len();
|
|
| ---------------------- another value with significant `Drop` created here
|
|
...
|
|
LL | };
|
|
| - temporary lives until here
|
|
|
|
|
= note: this might lead to deadlocks or other unexpected behavior
|
|
help: try moving the temporary above the match
|
|
|
|
|
LL ~ let value = mutex2.lock().unwrap().s.len();
|
|
LL ~ match (mutex1.lock().unwrap().s.len(), true, value) {
|
|
|
|
|
|
|
error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
|
|
--> tests/ui/significant_drop_in_scrutinee.rs:324:11
|
|
|
|
|
LL | match mutex.lock().unwrap().s.len() > 1 {
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
...
|
|
LL | mutex.lock().unwrap().s.len();
|
|
| --------------------- another value with significant `Drop` created here
|
|
...
|
|
LL | };
|
|
| - temporary lives until here
|
|
|
|
|
= note: this might lead to deadlocks or other unexpected behavior
|
|
help: try moving the temporary above the match
|
|
|
|
|
LL ~ let value = mutex.lock().unwrap().s.len();
|
|
LL ~ match value > 1 {
|
|
|
|
|
|
|
error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
|
|
--> tests/ui/significant_drop_in_scrutinee.rs:333:15
|
|
|
|
|
LL | match 1 < mutex.lock().unwrap().s.len() {
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
...
|
|
LL | mutex.lock().unwrap().s.len();
|
|
| --------------------- another value with significant `Drop` created here
|
|
...
|
|
LL | };
|
|
| - temporary lives until here
|
|
|
|
|
= note: this might lead to deadlocks or other unexpected behavior
|
|
help: try moving the temporary above the match
|
|
|
|
|
LL ~ let value = mutex.lock().unwrap().s.len();
|
|
LL ~ match 1 < value {
|
|
|
|
|
|
|
error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
|
|
--> tests/ui/significant_drop_in_scrutinee.rs:353:11
|
|
|
|
|
LL | match mutex1.lock().unwrap().s.len() < mutex2.lock().unwrap().s.len() {
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
...
|
|
LL | mutex1.lock().unwrap().s.len(),
|
|
| ---------------------- another value with significant `Drop` created here
|
|
LL | mutex2.lock().unwrap().s.len()
|
|
| ---------------------- another value with significant `Drop` created here
|
|
...
|
|
LL | };
|
|
| - temporary lives until here
|
|
|
|
|
= note: this might lead to deadlocks or other unexpected behavior
|
|
help: try moving the temporary above the match
|
|
|
|
|
LL ~ let value = mutex1.lock().unwrap().s.len();
|
|
LL ~ match value < mutex2.lock().unwrap().s.len() {
|
|
|
|
|
|
|
error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
|
|
--> tests/ui/significant_drop_in_scrutinee.rs:353:44
|
|
|
|
|
LL | match mutex1.lock().unwrap().s.len() < mutex2.lock().unwrap().s.len() {
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
...
|
|
LL | mutex1.lock().unwrap().s.len(),
|
|
| ---------------------- another value with significant `Drop` created here
|
|
LL | mutex2.lock().unwrap().s.len()
|
|
| ---------------------- another value with significant `Drop` created here
|
|
...
|
|
LL | };
|
|
| - temporary lives until here
|
|
|
|
|
= note: this might lead to deadlocks or other unexpected behavior
|
|
help: try moving the temporary above the match
|
|
|
|
|
LL ~ let value = mutex2.lock().unwrap().s.len();
|
|
LL ~ match mutex1.lock().unwrap().s.len() < value {
|
|
|
|
|
|
|
error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
|
|
--> tests/ui/significant_drop_in_scrutinee.rs:366:11
|
|
|
|
|
LL | match mutex1.lock().unwrap().s.len() >= mutex2.lock().unwrap().s.len() {
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
...
|
|
LL | mutex1.lock().unwrap().s.len(),
|
|
| ---------------------- another value with significant `Drop` created here
|
|
LL | mutex2.lock().unwrap().s.len()
|
|
| ---------------------- another value with significant `Drop` created here
|
|
...
|
|
LL | };
|
|
| - temporary lives until here
|
|
|
|
|
= note: this might lead to deadlocks or other unexpected behavior
|
|
help: try moving the temporary above the match
|
|
|
|
|
LL ~ let value = mutex1.lock().unwrap().s.len();
|
|
LL ~ match value >= mutex2.lock().unwrap().s.len() {
|
|
|
|
|
|
|
error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
|
|
--> tests/ui/significant_drop_in_scrutinee.rs:366:45
|
|
|
|
|
LL | match mutex1.lock().unwrap().s.len() >= mutex2.lock().unwrap().s.len() {
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
...
|
|
LL | mutex1.lock().unwrap().s.len(),
|
|
| ---------------------- another value with significant `Drop` created here
|
|
LL | mutex2.lock().unwrap().s.len()
|
|
| ---------------------- another value with significant `Drop` created here
|
|
...
|
|
LL | };
|
|
| - temporary lives until here
|
|
|
|
|
= note: this might lead to deadlocks or other unexpected behavior
|
|
help: try moving the temporary above the match
|
|
|
|
|
LL ~ let value = mutex2.lock().unwrap().s.len();
|
|
LL ~ match mutex1.lock().unwrap().s.len() >= value {
|
|
|
|
|
|
|
error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
|
|
--> tests/ui/significant_drop_in_scrutinee.rs:403:11
|
|
|
|
|
LL | match get_mutex_guard().s.len() > 1 {
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
...
|
|
LL | mutex1.lock().unwrap().s.len();
|
|
| ---------------------- another value with significant `Drop` created here
|
|
...
|
|
LL | };
|
|
| - temporary lives until here
|
|
|
|
|
= note: this might lead to deadlocks or other unexpected behavior
|
|
help: try moving the temporary above the match
|
|
|
|
|
LL ~ let value = get_mutex_guard().s.len();
|
|
LL ~ match value > 1 {
|
|
|
|
|
|
|
error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
|
|
--> tests/ui/significant_drop_in_scrutinee.rs:422:11
|
|
|
|
|
LL | match match i {
|
|
| ___________^
|
|
LL | |
|
|
LL | |
|
|
LL | | 100 => mutex1.lock().unwrap(),
|
|
... |
|
|
LL | | .s
|
|
LL | | .len()
|
|
| |__________^
|
|
...
|
|
LL | mutex1.lock().unwrap().s.len();
|
|
| ---------------------- another value with significant `Drop` created here
|
|
...
|
|
LL | };
|
|
| - temporary lives until here
|
|
|
|
|
= note: this might lead to deadlocks or other unexpected behavior
|
|
help: try moving the temporary above the match
|
|
|
|
|
LL ~ let value = match i {
|
|
LL +
|
|
LL +
|
|
LL + 100 => mutex1.lock().unwrap(),
|
|
LL + _ => mutex2.lock().unwrap(),
|
|
LL + }
|
|
LL + .s
|
|
LL + .len();
|
|
LL ~ match value
|
|
|
|
|
|
|
error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
|
|
--> tests/ui/significant_drop_in_scrutinee.rs:450:11
|
|
|
|
|
LL | match if i > 1 {
|
|
| ___________^
|
|
LL | |
|
|
LL | |
|
|
LL | | mutex1.lock().unwrap()
|
|
... |
|
|
LL | | .s
|
|
LL | | .len()
|
|
| |__________^
|
|
...
|
|
LL | mutex1.lock().unwrap().s.len();
|
|
| ---------------------- another value with significant `Drop` created here
|
|
...
|
|
LL | };
|
|
| - temporary lives until here
|
|
|
|
|
= note: this might lead to deadlocks or other unexpected behavior
|
|
help: try moving the temporary above the match
|
|
|
|
|
LL ~ let value = if i > 1 {
|
|
LL +
|
|
LL +
|
|
LL + mutex1.lock().unwrap()
|
|
LL + } else {
|
|
LL + mutex2.lock().unwrap()
|
|
LL + }
|
|
LL + .s
|
|
LL + .len();
|
|
LL ~ match value
|
|
|
|
|
|
|
error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
|
|
--> tests/ui/significant_drop_in_scrutinee.rs:506:11
|
|
|
|
|
LL | match s.lock().deref().deref() {
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
|
...
|
|
LL | _ => println!("Value is {}", s.lock().deref()),
|
|
| -------- another value with significant `Drop` created here
|
|
LL | };
|
|
| - temporary lives until here
|
|
|
|
|
= note: this might lead to deadlocks or other unexpected behavior
|
|
help: try moving the temporary above the match and create a copy
|
|
|
|
|
LL ~ let value = *s.lock().deref().deref();
|
|
LL ~ match (&value) {
|
|
|
|
|
|
|
error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
|
|
--> tests/ui/significant_drop_in_scrutinee.rs:556:11
|
|
|
|
|
LL | match mutex.lock().unwrap().i = i {
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
...
|
|
LL | println!("{}", mutex.lock().unwrap().i);
|
|
| --------------------- another value with significant `Drop` created here
|
|
LL | },
|
|
LL | };
|
|
| - temporary lives until here
|
|
|
|
|
= note: this might lead to deadlocks or other unexpected behavior
|
|
help: try moving the temporary above the match
|
|
|
|
|
LL ~ mutex.lock().unwrap().i = i;
|
|
LL ~ match () {
|
|
|
|
|
|
|
error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
|
|
--> tests/ui/significant_drop_in_scrutinee.rs:564:15
|
|
|
|
|
LL | match i = mutex.lock().unwrap().i {
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^
|
|
...
|
|
LL | println!("{}", mutex.lock().unwrap().i);
|
|
| --------------------- another value with significant `Drop` created here
|
|
LL | },
|
|
LL | };
|
|
| - temporary lives until here
|
|
|
|
|
= note: this might lead to deadlocks or other unexpected behavior
|
|
help: try moving the temporary above the match
|
|
|
|
|
LL ~ let value = mutex.lock().unwrap().i;
|
|
LL ~ match i = value {
|
|
|
|
|
|
|
error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
|
|
--> tests/ui/significant_drop_in_scrutinee.rs:572:11
|
|
|
|
|
LL | match mutex.lock().unwrap().i += 1 {
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
...
|
|
LL | println!("{}", mutex.lock().unwrap().i);
|
|
| --------------------- another value with significant `Drop` created here
|
|
LL | },
|
|
LL | };
|
|
| - temporary lives until here
|
|
|
|
|
= note: this might lead to deadlocks or other unexpected behavior
|
|
help: try moving the temporary above the match
|
|
|
|
|
LL ~ mutex.lock().unwrap().i += 1;
|
|
LL ~ match () {
|
|
|
|
|
|
|
error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
|
|
--> tests/ui/significant_drop_in_scrutinee.rs:580:16
|
|
|
|
|
LL | match i += mutex.lock().unwrap().i {
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^
|
|
...
|
|
LL | println!("{}", mutex.lock().unwrap().i);
|
|
| --------------------- another value with significant `Drop` created here
|
|
LL | },
|
|
LL | };
|
|
| - temporary lives until here
|
|
|
|
|
= note: this might lead to deadlocks or other unexpected behavior
|
|
help: try moving the temporary above the match
|
|
|
|
|
LL ~ let value = mutex.lock().unwrap().i;
|
|
LL ~ match i += value {
|
|
|
|
|
|
|
error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
|
|
--> tests/ui/significant_drop_in_scrutinee.rs:645:11
|
|
|
|
|
LL | match rwlock.read().unwrap().to_number() {
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
...
|
|
LL | };
|
|
| - temporary lives until here
|
|
|
|
|
= note: this might lead to deadlocks or other unexpected behavior
|
|
help: try moving the temporary above the match
|
|
|
|
|
LL ~ let value = rwlock.read().unwrap().to_number();
|
|
LL ~ match value {
|
|
|
|
|
|
|
error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
|
|
--> tests/ui/significant_drop_in_scrutinee.rs:673:11
|
|
|
|
|
LL | match mutex.lock().unwrap().foo() {
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
...
|
|
LL | };
|
|
| - temporary lives until here
|
|
|
|
|
= note: this might lead to deadlocks or other unexpected behavior
|
|
help: try moving the temporary above the match
|
|
|
|
|
LL ~ let value = mutex.lock().unwrap().foo();
|
|
LL ~ match value {
|
|
|
|
|
|
|
error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
|
|
--> tests/ui/significant_drop_in_scrutinee.rs:736:11
|
|
|
|
|
LL | match guard.take().len() {
|
|
| ^^^^^^^^^^^^^^^^^^
|
|
...
|
|
LL | };
|
|
| - temporary lives until here
|
|
|
|
|
= note: this might lead to deadlocks or other unexpected behavior
|
|
help: try moving the temporary above the match
|
|
|
|
|
LL ~ let value = guard.take().len();
|
|
LL ~ match value {
|
|
|
|
|
|
|
error: temporary with significant `Drop` in `for` loop condition will live until the end of the `for` expression
|
|
--> tests/ui/significant_drop_in_scrutinee.rs:762:16
|
|
|
|
|
LL | for val in mutex.lock().unwrap().copy_old_lifetime() {
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
...
|
|
LL | }
|
|
| - temporary lives until here
|
|
|
|
|
= note: this might lead to deadlocks or other unexpected behavior
|
|
help: try moving the temporary above the match
|
|
|
|
|
LL ~ let value = mutex.lock().unwrap().copy_old_lifetime();
|
|
LL ~ for val in value {
|
|
|
|
|
|
|
error: temporary with significant `Drop` in `for` loop condition will live until the end of the `for` expression
|
|
--> tests/ui/significant_drop_in_scrutinee.rs:802:17
|
|
|
|
|
LL | for val in [mutex.lock().unwrap()[0], 2] {
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
|
...
|
|
LL | }
|
|
| - temporary lives until here
|
|
|
|
|
= note: this might lead to deadlocks or other unexpected behavior
|
|
help: try moving the temporary above the match
|
|
|
|
|
LL ~ let value = mutex.lock().unwrap()[0];
|
|
LL ~ for val in [value, 2] {
|
|
|
|
|
|
|
error: temporary with significant `Drop` in `if let` scrutinee will live until the end of the `if let` expression
|
|
--> tests/ui/significant_drop_in_scrutinee.rs:812:24
|
|
|
|
|
LL | if let Some(val) = mutex.lock().unwrap().first().copied() {
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
...
|
|
LL | }
|
|
| - temporary lives until here
|
|
|
|
|
= note: this might lead to deadlocks or other unexpected behavior
|
|
help: try moving the temporary above the match
|
|
|
|
|
LL ~ let value = mutex.lock().unwrap().first().copied();
|
|
LL ~ if let Some(val) = value {
|
|
|
|
|
|
|
error: temporary with significant `Drop` in `while let` scrutinee will live until the end of the `while let` expression
|
|
--> tests/ui/significant_drop_in_scrutinee.rs:828:27
|
|
|
|
|
LL | while let Some(val) = mutex.lock().unwrap().pop() {
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
...
|
|
LL | }
|
|
| - temporary lives until here
|
|
|
|
|
= note: this might lead to deadlocks or other unexpected behavior
|
|
|
|
error: aborting due to 29 previous errors
|
|
|