2022-06-30 03:50:09 -05:00
|
|
|
error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
|
2023-07-17 03:19:29 -05:00
|
|
|
--> $DIR/significant_drop_in_scrutinee.rs:55:11
|
2022-02-18 00:02:22 -06:00
|
|
|
|
|
|
|
|
LL | match mutex.lock().unwrap().foo() {
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
2023-08-24 14:32:12 -05:00
|
|
|
...
|
2022-06-30 03:50:09 -05:00
|
|
|
LL | mutex.lock().unwrap().bar();
|
|
|
|
| --------------------- another value with significant `Drop` created here
|
|
|
|
...
|
|
|
|
LL | };
|
|
|
|
| - temporary lives until here
|
2022-02-18 00:02:22 -06:00
|
|
|
|
|
2022-06-30 03:50:09 -05:00
|
|
|
= note: this might lead to deadlocks or other unexpected behavior
|
2022-09-22 11:04:22 -05:00
|
|
|
= note: `-D clippy::significant-drop-in-scrutinee` implied by `-D warnings`
|
2023-08-01 07:02:21 -05:00
|
|
|
= help: to override `-D warnings` add `#[allow(clippy::significant_drop_in_scrutinee)]`
|
2022-02-18 00:02:22 -06:00
|
|
|
help: try moving the temporary above the match
|
|
|
|
|
|
|
|
|
LL ~ let value = mutex.lock().unwrap().foo();
|
|
|
|
LL ~ match value {
|
|
|
|
|
|
|
|
|
|
2022-06-30 03:50:09 -05:00
|
|
|
error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
|
2023-08-24 14:32:12 -05:00
|
|
|
--> $DIR/significant_drop_in_scrutinee.rs:143:11
|
2022-02-18 00:02:22 -06:00
|
|
|
|
|
|
|
|
LL | match s.lock_m().get_the_value() {
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
2022-06-30 03:50:09 -05:00
|
|
|
...
|
|
|
|
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
|
2022-02-18 00:02:22 -06:00
|
|
|
help: try moving the temporary above the match
|
|
|
|
|
|
|
|
|
LL ~ let value = s.lock_m().get_the_value();
|
|
|
|
LL ~ match value {
|
|
|
|
|
|
|
|
|
|
2022-06-30 03:50:09 -05:00
|
|
|
error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
|
2023-08-24 14:32:12 -05:00
|
|
|
--> $DIR/significant_drop_in_scrutinee.rs:166:11
|
2022-02-18 00:02:22 -06:00
|
|
|
|
|
|
|
|
LL | match s.lock_m_m().get_the_value() {
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
2022-06-30 03:50:09 -05:00
|
|
|
...
|
|
|
|
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
|
2022-02-18 00:02:22 -06:00
|
|
|
help: try moving the temporary above the match
|
|
|
|
|
|
|
|
|
LL ~ let value = s.lock_m_m().get_the_value();
|
|
|
|
LL ~ match value {
|
|
|
|
|
|
|
|
|
|
2022-06-30 03:50:09 -05:00
|
|
|
error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
|
2023-08-24 14:32:12 -05:00
|
|
|
--> $DIR/significant_drop_in_scrutinee.rs:216:11
|
2022-02-18 00:02:22 -06:00
|
|
|
|
|
|
|
|
LL | match counter.temp_increment().len() {
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
2022-06-30 03:50:09 -05:00
|
|
|
...
|
|
|
|
LL | };
|
|
|
|
| - temporary lives until here
|
2022-02-18 00:02:22 -06:00
|
|
|
|
|
2022-06-30 03:50:09 -05:00
|
|
|
= note: this might lead to deadlocks or other unexpected behavior
|
2022-02-18 00:02:22 -06:00
|
|
|
help: try moving the temporary above the match
|
|
|
|
|
|
|
|
|
LL ~ let value = counter.temp_increment().len();
|
|
|
|
LL ~ match value {
|
|
|
|
|
|
|
|
|
|
2022-06-30 03:50:09 -05:00
|
|
|
error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
|
2023-08-24 14:32:12 -05:00
|
|
|
--> $DIR/significant_drop_in_scrutinee.rs:241:16
|
2022-02-18 00:02:22 -06:00
|
|
|
|
|
|
|
|
LL | match (mutex1.lock().unwrap().s.len(), true) {
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
2022-06-30 03:50:09 -05:00
|
|
|
...
|
|
|
|
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
|
2022-02-18 00:02:22 -06:00
|
|
|
help: try moving the temporary above the match
|
|
|
|
|
|
|
|
|
LL ~ let value = mutex1.lock().unwrap().s.len();
|
|
|
|
LL ~ match (value, true) {
|
|
|
|
|
|
|
|
|
|
2022-06-30 03:50:09 -05:00
|
|
|
error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
|
2023-08-24 14:32:12 -05:00
|
|
|
--> $DIR/significant_drop_in_scrutinee.rs:252:22
|
2022-02-18 00:02:22 -06:00
|
|
|
|
|
|
|
|
LL | match (true, mutex1.lock().unwrap().s.len(), true) {
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
2022-06-30 03:50:09 -05:00
|
|
|
...
|
|
|
|
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
|
2022-02-18 00:02:22 -06:00
|
|
|
help: try moving the temporary above the match
|
|
|
|
|
|
|
|
|
LL ~ let value = mutex1.lock().unwrap().s.len();
|
|
|
|
LL ~ match (true, value, true) {
|
|
|
|
|
|
|
|
|
|
2022-06-30 03:50:09 -05:00
|
|
|
error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
|
2023-08-24 14:32:12 -05:00
|
|
|
--> $DIR/significant_drop_in_scrutinee.rs:264:16
|
2022-02-18 00:02:22 -06:00
|
|
|
|
|
|
|
|
LL | match (mutex1.lock().unwrap().s.len(), true, mutex2.lock().unwrap().s.len()) {
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
2022-06-30 03:50:09 -05:00
|
|
|
...
|
|
|
|
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
|
2022-02-18 00:02:22 -06:00
|
|
|
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()) {
|
|
|
|
|
|
|
|
|
|
2022-06-30 03:50:09 -05:00
|
|
|
error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
|
2023-08-24 14:32:12 -05:00
|
|
|
--> $DIR/significant_drop_in_scrutinee.rs:264:54
|
2022-02-18 00:02:22 -06:00
|
|
|
|
|
|
|
|
LL | match (mutex1.lock().unwrap().s.len(), true, mutex2.lock().unwrap().s.len()) {
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
2022-06-30 03:50:09 -05:00
|
|
|
...
|
|
|
|
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
|
2022-02-18 00:02:22 -06:00
|
|
|
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) {
|
|
|
|
|
|
|
|
|
|
2022-06-30 03:50:09 -05:00
|
|
|
error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
|
2023-08-24 14:32:12 -05:00
|
|
|
--> $DIR/significant_drop_in_scrutinee.rs:279:15
|
2022-02-18 00:02:22 -06:00
|
|
|
|
|
|
|
|
LL | match mutex3.lock().unwrap().s.as_str() {
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
2022-06-30 03:50:09 -05:00
|
|
|
...
|
|
|
|
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
|
2022-02-18 00:02:22 -06:00
|
|
|
|
2022-06-30 03:50:09 -05:00
|
|
|
error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
|
2023-08-24 14:32:12 -05:00
|
|
|
--> $DIR/significant_drop_in_scrutinee.rs:291:22
|
2022-02-18 00:02:22 -06:00
|
|
|
|
|
|
|
|
LL | match (true, mutex3.lock().unwrap().s.as_str()) {
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
2022-06-30 03:50:09 -05:00
|
|
|
...
|
|
|
|
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
|
2022-02-18 00:02:22 -06:00
|
|
|
|
2022-06-30 03:50:09 -05:00
|
|
|
error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
|
2023-08-24 14:32:12 -05:00
|
|
|
--> $DIR/significant_drop_in_scrutinee.rs:312:11
|
2022-02-18 00:02:22 -06:00
|
|
|
|
|
|
|
|
LL | match mutex.lock().unwrap().s.len() > 1 {
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
2023-08-24 14:32:12 -05:00
|
|
|
...
|
2022-06-30 03:50:09 -05:00
|
|
|
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
|
2022-02-18 00:02:22 -06:00
|
|
|
help: try moving the temporary above the match
|
|
|
|
|
|
|
|
|
LL ~ let value = mutex.lock().unwrap().s.len() > 1;
|
|
|
|
LL ~ match value {
|
|
|
|
|
|
|
|
|
|
2022-06-30 03:50:09 -05:00
|
|
|
error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
|
2023-08-24 14:32:12 -05:00
|
|
|
--> $DIR/significant_drop_in_scrutinee.rs:321:11
|
2022-02-18 00:02:22 -06:00
|
|
|
|
|
|
|
|
LL | match 1 < mutex.lock().unwrap().s.len() {
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
2023-08-24 14:32:12 -05:00
|
|
|
...
|
2022-06-30 03:50:09 -05:00
|
|
|
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
|
2022-02-18 00:02:22 -06:00
|
|
|
help: try moving the temporary above the match
|
|
|
|
|
|
|
|
|
LL ~ let value = 1 < mutex.lock().unwrap().s.len();
|
|
|
|
LL ~ match value {
|
|
|
|
|
|
|
|
|
|
2022-06-30 03:50:09 -05:00
|
|
|
error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
|
2023-08-24 14:32:12 -05:00
|
|
|
--> $DIR/significant_drop_in_scrutinee.rs:341:11
|
2022-02-18 00:02:22 -06:00
|
|
|
|
|
|
|
|
LL | match mutex1.lock().unwrap().s.len() < mutex2.lock().unwrap().s.len() {
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
2022-06-30 03:50:09 -05:00
|
|
|
...
|
|
|
|
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
|
2022-02-18 00:02:22 -06:00
|
|
|
help: try moving the temporary above the match
|
|
|
|
|
|
|
|
|
LL ~ let value = mutex1.lock().unwrap().s.len() < mutex2.lock().unwrap().s.len();
|
|
|
|
LL ~ match value {
|
|
|
|
|
|
|
|
|
|
2022-06-30 03:50:09 -05:00
|
|
|
error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
|
2023-08-24 14:32:12 -05:00
|
|
|
--> $DIR/significant_drop_in_scrutinee.rs:354:11
|
2022-02-18 00:02:22 -06:00
|
|
|
|
|
|
|
|
LL | match mutex1.lock().unwrap().s.len() >= mutex2.lock().unwrap().s.len() {
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
2022-06-30 03:50:09 -05:00
|
|
|
...
|
|
|
|
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
|
2022-02-18 00:02:22 -06:00
|
|
|
help: try moving the temporary above the match
|
|
|
|
|
|
|
|
|
LL ~ let value = mutex1.lock().unwrap().s.len() >= mutex2.lock().unwrap().s.len();
|
|
|
|
LL ~ match value {
|
|
|
|
|
|
|
|
|
|
2022-06-30 03:50:09 -05:00
|
|
|
error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
|
2023-08-24 14:32:12 -05:00
|
|
|
--> $DIR/significant_drop_in_scrutinee.rs:391:11
|
2022-02-18 00:02:22 -06:00
|
|
|
|
|
|
|
|
LL | match get_mutex_guard().s.len() > 1 {
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
2023-08-24 14:32:12 -05:00
|
|
|
...
|
2022-06-30 03:50:09 -05:00
|
|
|
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
|
2022-02-18 00:02:22 -06:00
|
|
|
help: try moving the temporary above the match
|
|
|
|
|
|
|
|
|
LL ~ let value = get_mutex_guard().s.len() > 1;
|
|
|
|
LL ~ match value {
|
|
|
|
|
|
|
|
|
|
2022-06-30 03:50:09 -05:00
|
|
|
error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
|
2023-08-24 14:32:12 -05:00
|
|
|
--> $DIR/significant_drop_in_scrutinee.rs:410:11
|
2022-05-21 06:24:00 -05:00
|
|
|
|
|
|
|
|
LL | match match i {
|
|
|
|
| ___________^
|
2023-08-24 14:32:12 -05:00
|
|
|
LL | |
|
|
|
|
LL | |
|
2022-05-21 06:24:00 -05:00
|
|
|
LL | | 100 => mutex1.lock().unwrap(),
|
2023-08-24 14:32:12 -05:00
|
|
|
... |
|
2022-05-21 06:24:00 -05:00
|
|
|
LL | | .len()
|
|
|
|
LL | | > 1
|
|
|
|
| |___________^
|
2022-06-30 03:50:09 -05:00
|
|
|
...
|
|
|
|
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
|
2022-02-18 00:02:22 -06:00
|
|
|
help: try moving the temporary above the match
|
|
|
|
|
|
2022-05-21 06:24:00 -05:00
|
|
|
LL ~ let value = match i {
|
2023-08-24 14:32:12 -05:00
|
|
|
LL +
|
|
|
|
LL +
|
2022-05-21 06:24:00 -05:00
|
|
|
LL + 100 => mutex1.lock().unwrap(),
|
|
|
|
LL + _ => mutex2.lock().unwrap(),
|
|
|
|
LL + }
|
|
|
|
LL + .s
|
|
|
|
LL + .len()
|
2022-06-16 09:00:32 -05:00
|
|
|
LL + > 1;
|
|
|
|
LL ~ match value
|
|
|
|
|
|
2022-02-18 00:02:22 -06:00
|
|
|
|
2022-06-30 03:50:09 -05:00
|
|
|
error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
|
2023-08-24 14:32:12 -05:00
|
|
|
--> $DIR/significant_drop_in_scrutinee.rs:438:11
|
2022-05-21 06:24:00 -05:00
|
|
|
|
|
|
|
|
LL | match if i > 1 {
|
|
|
|
| ___________^
|
2023-08-24 14:32:12 -05:00
|
|
|
LL | |
|
|
|
|
LL | |
|
2022-05-21 06:24:00 -05:00
|
|
|
LL | | mutex1.lock().unwrap()
|
|
|
|
... |
|
|
|
|
LL | | .len()
|
|
|
|
LL | | > 1
|
|
|
|
| |___________^
|
2022-06-30 03:50:09 -05:00
|
|
|
...
|
|
|
|
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
|
2022-02-18 00:02:22 -06:00
|
|
|
help: try moving the temporary above the match
|
|
|
|
|
|
2022-05-21 06:24:00 -05:00
|
|
|
LL ~ let value = if i > 1 {
|
2023-08-24 14:32:12 -05:00
|
|
|
LL +
|
|
|
|
LL +
|
2022-05-21 06:24:00 -05:00
|
|
|
LL + mutex1.lock().unwrap()
|
|
|
|
LL + } else {
|
|
|
|
LL + mutex2.lock().unwrap()
|
|
|
|
LL + }
|
|
|
|
LL + .s
|
2022-06-16 09:00:32 -05:00
|
|
|
LL + .len()
|
|
|
|
LL + > 1;
|
|
|
|
LL ~ match value
|
|
|
|
|
|
2022-02-18 00:02:22 -06:00
|
|
|
|
2022-06-30 03:50:09 -05:00
|
|
|
error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
|
2023-08-24 14:32:12 -05:00
|
|
|
--> $DIR/significant_drop_in_scrutinee.rs:494:11
|
2022-02-18 00:02:22 -06:00
|
|
|
|
|
|
|
|
LL | match s.lock().deref().deref() {
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
2023-08-24 14:32:12 -05:00
|
|
|
...
|
2022-06-30 03:50:09 -05:00
|
|
|
LL | _ => println!("Value is {}", s.lock().deref()),
|
|
|
|
| ---------------- another value with significant `Drop` created here
|
|
|
|
LL | };
|
|
|
|
| - temporary lives until here
|
2022-02-18 00:02:22 -06:00
|
|
|
|
|
2022-06-30 03:50:09 -05:00
|
|
|
= note: this might lead to deadlocks or other unexpected behavior
|
2022-02-18 00:02:22 -06:00
|
|
|
help: try moving the temporary above the match and create a copy
|
|
|
|
|
|
|
|
|
LL ~ let value = *s.lock().deref().deref();
|
|
|
|
LL ~ match value {
|
|
|
|
|
|
|
|
|
|
2022-06-30 03:50:09 -05:00
|
|
|
error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
|
2023-08-24 14:32:12 -05:00
|
|
|
--> $DIR/significant_drop_in_scrutinee.rs:524:11
|
2022-02-18 00:02:22 -06:00
|
|
|
|
|
|
|
|
LL | match s.lock().deref().deref() {
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
2023-08-24 14:32:12 -05:00
|
|
|
...
|
2022-06-30 03:50:09 -05:00
|
|
|
LL | matcher => println!("Value is {}", s.lock().deref()),
|
|
|
|
| ---------------- another value with significant `Drop` created here
|
|
|
|
LL | _ => println!("Value was not a match"),
|
|
|
|
LL | };
|
|
|
|
| - temporary lives until here
|
|
|
|
|
|
|
|
|
= note: this might lead to deadlocks or other unexpected behavior
|
2022-02-18 00:02:22 -06:00
|
|
|
|
2022-06-30 03:50:09 -05:00
|
|
|
error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
|
2023-08-24 14:32:12 -05:00
|
|
|
--> $DIR/significant_drop_in_scrutinee.rs:545:11
|
2022-02-18 00:02:22 -06:00
|
|
|
|
|
|
|
|
LL | match mutex.lock().unwrap().i = i {
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
2023-08-24 14:32:12 -05:00
|
|
|
...
|
2022-06-30 03:50:09 -05:00
|
|
|
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
|
2022-02-18 00:02:22 -06:00
|
|
|
help: try moving the temporary above the match
|
|
|
|
|
|
|
|
|
LL ~ mutex.lock().unwrap().i = i;
|
|
|
|
LL ~ match () {
|
|
|
|
|
|
|
|
|
|
2022-06-30 03:50:09 -05:00
|
|
|
error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
|
2023-08-24 14:32:12 -05:00
|
|
|
--> $DIR/significant_drop_in_scrutinee.rs:553:11
|
2022-02-18 00:02:22 -06:00
|
|
|
|
|
|
|
|
LL | match i = mutex.lock().unwrap().i {
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
2023-08-24 14:32:12 -05:00
|
|
|
...
|
2022-06-30 03:50:09 -05:00
|
|
|
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
|
2022-02-18 00:02:22 -06:00
|
|
|
help: try moving the temporary above the match
|
|
|
|
|
|
|
|
|
LL ~ i = mutex.lock().unwrap().i;
|
|
|
|
LL ~ match () {
|
|
|
|
|
|
|
|
|
|
2022-06-30 03:50:09 -05:00
|
|
|
error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
|
2023-08-24 14:32:12 -05:00
|
|
|
--> $DIR/significant_drop_in_scrutinee.rs:561:11
|
2022-02-18 00:02:22 -06:00
|
|
|
|
|
|
|
|
LL | match mutex.lock().unwrap().i += 1 {
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
2023-08-24 14:32:12 -05:00
|
|
|
...
|
2022-06-30 03:50:09 -05:00
|
|
|
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
|
2022-02-18 00:02:22 -06:00
|
|
|
help: try moving the temporary above the match
|
|
|
|
|
|
|
|
|
LL ~ mutex.lock().unwrap().i += 1;
|
|
|
|
LL ~ match () {
|
|
|
|
|
|
|
|
|
|
2022-06-30 03:50:09 -05:00
|
|
|
error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
|
2023-08-24 14:32:12 -05:00
|
|
|
--> $DIR/significant_drop_in_scrutinee.rs:569:11
|
2022-02-18 00:02:22 -06:00
|
|
|
|
|
|
|
|
LL | match i += mutex.lock().unwrap().i {
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
2023-08-24 14:32:12 -05:00
|
|
|
...
|
2022-06-30 03:50:09 -05:00
|
|
|
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
|
2022-02-18 00:02:22 -06:00
|
|
|
help: try moving the temporary above the match
|
|
|
|
|
|
|
|
|
LL ~ i += mutex.lock().unwrap().i;
|
|
|
|
LL ~ match () {
|
|
|
|
|
|
|
|
|
|
2022-06-30 03:50:09 -05:00
|
|
|
error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
|
2023-08-24 14:32:12 -05:00
|
|
|
--> $DIR/significant_drop_in_scrutinee.rs:634:11
|
2022-06-04 06:34:07 -05:00
|
|
|
|
|
|
|
|
LL | match rwlock.read().unwrap().to_number() {
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
2022-06-30 03:50:09 -05:00
|
|
|
...
|
|
|
|
LL | };
|
|
|
|
| - temporary lives until here
|
|
|
|
|
|
|
|
|
= note: this might lead to deadlocks or other unexpected behavior
|
2022-06-04 06:34:07 -05:00
|
|
|
|
2022-06-30 03:50:09 -05:00
|
|
|
error: temporary with significant `Drop` in `for` loop condition will live until the end of the `for` expression
|
2023-08-24 14:32:12 -05:00
|
|
|
--> $DIR/significant_drop_in_scrutinee.rs:646:14
|
2022-06-04 06:34:07 -05:00
|
|
|
|
|
|
|
|
LL | for s in rwlock.read().unwrap().iter() {
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
2023-08-24 14:32:12 -05:00
|
|
|
...
|
2022-06-30 03:50:09 -05:00
|
|
|
LL | }
|
|
|
|
| - temporary lives until here
|
|
|
|
|
|
|
|
|
= note: this might lead to deadlocks or other unexpected behavior
|
|
|
|
|
|
|
|
error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
|
2023-08-24 14:32:12 -05:00
|
|
|
--> $DIR/significant_drop_in_scrutinee.rs:663:11
|
2022-06-30 03:50:09 -05:00
|
|
|
|
|
|
|
|
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 {
|
|
|
|
|
|
2022-06-04 06:34:07 -05:00
|
|
|
|
2022-06-30 03:50:09 -05:00
|
|
|
error: aborting due to 26 previous errors
|
2022-02-18 00:02:22 -06:00
|
|
|
|