2022-06-30 08:50:09 +00:00
|
|
|
error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
|
2024-08-18 11:31:47 +00:00
|
|
|
--> tests/ui/significant_drop_in_scrutinee.rs:60:11
|
2022-02-18 06:02:22 +00:00
|
|
|
|
|
|
|
|
LL | match mutex.lock().unwrap().foo() {
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
2023-08-24 19:32:12 +00:00
|
|
|
...
|
2022-06-30 08:50:09 +00:00
|
|
|
LL | mutex.lock().unwrap().bar();
|
|
|
|
| --------------------- another value with significant `Drop` created here
|
|
|
|
...
|
|
|
|
LL | };
|
|
|
|
| - temporary lives until here
|
2022-02-18 06:02:22 +00:00
|
|
|
|
|
2022-06-30 08:50:09 +00:00
|
|
|
= note: this might lead to deadlocks or other unexpected behavior
|
2022-09-22 16:04:22 +00:00
|
|
|
= note: `-D clippy::significant-drop-in-scrutinee` implied by `-D warnings`
|
2023-08-01 12:02:21 +00:00
|
|
|
= help: to override `-D warnings` add `#[allow(clippy::significant_drop_in_scrutinee)]`
|
2022-02-18 06:02:22 +00:00
|
|
|
help: try moving the temporary above the match
|
|
|
|
|
|
|
|
|
LL ~ let value = mutex.lock().unwrap().foo();
|
|
|
|
LL ~ match value {
|
|
|
|
|
|
|
|
|
|
2022-06-30 08:50:09 +00:00
|
|
|
error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
|
2024-08-18 11:31:47 +00:00
|
|
|
--> tests/ui/significant_drop_in_scrutinee.rs:148:11
|
2022-02-18 06:02:22 +00:00
|
|
|
|
|
|
|
|
LL | match s.lock_m().get_the_value() {
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
2022-06-30 08:50:09 +00:00
|
|
|
...
|
|
|
|
LL | println!("{}", s.lock_m().get_the_value());
|
|
|
|
| ---------- another value with significant `Drop` created here
|
|
|
|
...
|
2024-04-26 09:26:35 +00:00
|
|
|
LL | println!("{}", s.lock_m().get_the_value());
|
|
|
|
| ---------- another value with significant `Drop` created here
|
|
|
|
...
|
2022-06-30 08:50:09 +00:00
|
|
|
LL | }
|
|
|
|
| - temporary lives until here
|
|
|
|
|
|
|
|
|
= note: this might lead to deadlocks or other unexpected behavior
|
2022-02-18 06:02:22 +00:00
|
|
|
help: try moving the temporary above the match
|
|
|
|
|
|
|
|
|
LL ~ let value = s.lock_m().get_the_value();
|
|
|
|
LL ~ match value {
|
|
|
|
|
|
|
|
|
|
2022-06-30 08:50:09 +00:00
|
|
|
error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
|
2024-08-18 11:31:47 +00:00
|
|
|
--> tests/ui/significant_drop_in_scrutinee.rs:171:11
|
2022-02-18 06:02:22 +00:00
|
|
|
|
|
|
|
|
LL | match s.lock_m_m().get_the_value() {
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
2022-06-30 08:50:09 +00:00
|
|
|
...
|
|
|
|
LL | println!("{}", s.lock_m().get_the_value());
|
|
|
|
| ---------- another value with significant `Drop` created here
|
|
|
|
...
|
2024-04-26 09:26:35 +00:00
|
|
|
LL | println!("{}", s.lock_m().get_the_value());
|
|
|
|
| ---------- another value with significant `Drop` created here
|
|
|
|
...
|
2022-06-30 08:50:09 +00:00
|
|
|
LL | }
|
|
|
|
| - temporary lives until here
|
|
|
|
|
|
|
|
|
= note: this might lead to deadlocks or other unexpected behavior
|
2022-02-18 06:02:22 +00: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 08:50:09 +00:00
|
|
|
error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
|
2024-08-18 11:31:47 +00:00
|
|
|
--> tests/ui/significant_drop_in_scrutinee.rs:221:11
|
2022-02-18 06:02:22 +00:00
|
|
|
|
|
|
|
|
LL | match counter.temp_increment().len() {
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
2022-06-30 08:50:09 +00:00
|
|
|
...
|
|
|
|
LL | };
|
|
|
|
| - temporary lives until here
|
2022-02-18 06:02:22 +00:00
|
|
|
|
|
2022-06-30 08:50:09 +00:00
|
|
|
= note: this might lead to deadlocks or other unexpected behavior
|
2022-02-18 06:02:22 +00:00
|
|
|
help: try moving the temporary above the match
|
|
|
|
|
|
|
|
|
LL ~ let value = counter.temp_increment().len();
|
|
|
|
LL ~ match value {
|
|
|
|
|
|
|
|
|
|
2022-06-30 08:50:09 +00:00
|
|
|
error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
|
2024-08-18 11:31:47 +00:00
|
|
|
--> tests/ui/significant_drop_in_scrutinee.rs:246:16
|
2022-02-18 06:02:22 +00:00
|
|
|
|
|
|
|
|
LL | match (mutex1.lock().unwrap().s.len(), true) {
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
2022-06-30 08:50:09 +00: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 06:02:22 +00:00
|
|
|
help: try moving the temporary above the match
|
|
|
|
|
|
|
|
|
LL ~ let value = mutex1.lock().unwrap().s.len();
|
|
|
|
LL ~ match (value, true) {
|
|
|
|
|
|
|
|
|
|
2022-06-30 08:50:09 +00:00
|
|
|
error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
|
2024-08-18 11:31:47 +00:00
|
|
|
--> tests/ui/significant_drop_in_scrutinee.rs:257:22
|
2022-02-18 06:02:22 +00:00
|
|
|
|
|
|
|
|
LL | match (true, mutex1.lock().unwrap().s.len(), true) {
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
2022-06-30 08:50:09 +00: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 06:02:22 +00: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 08:50:09 +00:00
|
|
|
error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
|
2024-08-18 11:31:47 +00:00
|
|
|
--> tests/ui/significant_drop_in_scrutinee.rs:269:16
|
2022-02-18 06:02:22 +00:00
|
|
|
|
|
|
|
|
LL | match (mutex1.lock().unwrap().s.len(), true, mutex2.lock().unwrap().s.len()) {
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
2022-06-30 08:50:09 +00: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 06:02:22 +00: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 08:50:09 +00:00
|
|
|
error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
|
2024-08-18 11:31:47 +00:00
|
|
|
--> tests/ui/significant_drop_in_scrutinee.rs:269:54
|
2022-02-18 06:02:22 +00:00
|
|
|
|
|
|
|
|
LL | match (mutex1.lock().unwrap().s.len(), true, mutex2.lock().unwrap().s.len()) {
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
2022-06-30 08:50:09 +00: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 06:02:22 +00: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 08:50:09 +00:00
|
|
|
error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
|
2024-08-18 11:31:47 +00:00
|
|
|
--> tests/ui/significant_drop_in_scrutinee.rs:324:11
|
2022-02-18 06:02:22 +00:00
|
|
|
|
|
2024-04-27 15:47:11 +00:00
|
|
|
LL | match mutex.lock().unwrap().s.len() > 1 {
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
2022-06-30 08:50:09 +00:00
|
|
|
...
|
2024-04-27 15:47:11 +00:00
|
|
|
LL | mutex.lock().unwrap().s.len();
|
|
|
|
| --------------------- another value with significant `Drop` created here
|
2022-06-30 08:50:09 +00:00
|
|
|
...
|
2024-04-27 15:47:11 +00:00
|
|
|
LL | };
|
|
|
|
| - temporary lives until here
|
2022-06-30 08:50:09 +00:00
|
|
|
|
|
|
|
|
= note: this might lead to deadlocks or other unexpected behavior
|
2024-04-27 15:47:11 +00:00
|
|
|
help: try moving the temporary above the match
|
|
|
|
|
|
|
|
|
LL ~ let value = mutex.lock().unwrap().s.len();
|
|
|
|
LL ~ match value > 1 {
|
|
|
|
|
|
2022-02-18 06:02:22 +00:00
|
|
|
|
2022-06-30 08:50:09 +00:00
|
|
|
error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
|
2024-08-18 11:31:47 +00:00
|
|
|
--> tests/ui/significant_drop_in_scrutinee.rs:333:15
|
2022-02-18 06:02:22 +00:00
|
|
|
|
|
2024-04-27 15:47:11 +00:00
|
|
|
LL | match 1 < mutex.lock().unwrap().s.len() {
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
2022-06-30 08:50:09 +00:00
|
|
|
...
|
2024-04-27 15:47:11 +00:00
|
|
|
LL | mutex.lock().unwrap().s.len();
|
|
|
|
| --------------------- another value with significant `Drop` created here
|
2022-06-30 08:50:09 +00:00
|
|
|
...
|
2024-04-27 15:47:11 +00:00
|
|
|
LL | };
|
|
|
|
| - temporary lives until here
|
2022-06-30 08:50:09 +00:00
|
|
|
|
|
|
|
|
= note: this might lead to deadlocks or other unexpected behavior
|
2024-04-27 15:47:11 +00:00
|
|
|
help: try moving the temporary above the match
|
|
|
|
|
|
|
|
|
LL ~ let value = mutex.lock().unwrap().s.len();
|
|
|
|
LL ~ match 1 < value {
|
|
|
|
|
|
2022-02-18 06:02:22 +00:00
|
|
|
|
2022-06-30 08:50:09 +00:00
|
|
|
error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
|
2024-08-18 11:31:47 +00:00
|
|
|
--> tests/ui/significant_drop_in_scrutinee.rs:353:11
|
2022-02-18 06:02:22 +00:00
|
|
|
|
|
2024-04-27 15:47:11 +00:00
|
|
|
LL | match mutex1.lock().unwrap().s.len() < mutex2.lock().unwrap().s.len() {
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
2023-08-24 19:32:12 +00:00
|
|
|
...
|
2024-04-27 15:47:11 +00: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
|
2022-06-30 08:50:09 +00:00
|
|
|
...
|
|
|
|
LL | };
|
|
|
|
| - temporary lives until here
|
|
|
|
|
|
|
|
|
= note: this might lead to deadlocks or other unexpected behavior
|
2022-02-18 06:02:22 +00:00
|
|
|
help: try moving the temporary above the match
|
|
|
|
|
|
2024-04-27 15:47:11 +00:00
|
|
|
LL ~ let value = mutex1.lock().unwrap().s.len();
|
|
|
|
LL ~ match value < mutex2.lock().unwrap().s.len() {
|
2022-02-18 06:02:22 +00:00
|
|
|
|
|
|
|
|
|
2022-06-30 08:50:09 +00:00
|
|
|
error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
|
2024-08-18 11:31:47 +00:00
|
|
|
--> tests/ui/significant_drop_in_scrutinee.rs:353:44
|
2022-02-18 06:02:22 +00:00
|
|
|
|
|
2024-04-27 15:47:11 +00:00
|
|
|
LL | match mutex1.lock().unwrap().s.len() < mutex2.lock().unwrap().s.len() {
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
2023-08-24 19:32:12 +00:00
|
|
|
...
|
2024-04-27 15:47:11 +00: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
|
2022-06-30 08:50:09 +00:00
|
|
|
...
|
|
|
|
LL | };
|
|
|
|
| - temporary lives until here
|
|
|
|
|
|
|
|
|
= note: this might lead to deadlocks or other unexpected behavior
|
2022-02-18 06:02:22 +00:00
|
|
|
help: try moving the temporary above the match
|
|
|
|
|
|
2024-04-27 15:47:11 +00:00
|
|
|
LL ~ let value = mutex2.lock().unwrap().s.len();
|
|
|
|
LL ~ match mutex1.lock().unwrap().s.len() < value {
|
2022-02-18 06:02:22 +00:00
|
|
|
|
|
|
|
|
|
2022-06-30 08:50:09 +00:00
|
|
|
error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
|
2024-08-18 11:31:47 +00:00
|
|
|
--> tests/ui/significant_drop_in_scrutinee.rs:366:11
|
2022-02-18 06:02:22 +00:00
|
|
|
|
|
2024-04-27 15:47:11 +00:00
|
|
|
LL | match mutex1.lock().unwrap().s.len() >= mutex2.lock().unwrap().s.len() {
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
2022-06-30 08:50:09 +00: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 06:02:22 +00:00
|
|
|
help: try moving the temporary above the match
|
|
|
|
|
|
2024-04-27 15:47:11 +00:00
|
|
|
LL ~ let value = mutex1.lock().unwrap().s.len();
|
|
|
|
LL ~ match value >= mutex2.lock().unwrap().s.len() {
|
2022-02-18 06:02:22 +00:00
|
|
|
|
|
|
|
|
|
2022-06-30 08:50:09 +00:00
|
|
|
error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
|
2024-08-18 11:31:47 +00:00
|
|
|
--> tests/ui/significant_drop_in_scrutinee.rs:366:45
|
2022-02-18 06:02:22 +00:00
|
|
|
|
|
|
|
|
LL | match mutex1.lock().unwrap().s.len() >= mutex2.lock().unwrap().s.len() {
|
2024-04-27 15:47:11 +00:00
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
2022-06-30 08:50:09 +00: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 06:02:22 +00:00
|
|
|
help: try moving the temporary above the match
|
|
|
|
|
|
2024-04-27 15:47:11 +00:00
|
|
|
LL ~ let value = mutex2.lock().unwrap().s.len();
|
|
|
|
LL ~ match mutex1.lock().unwrap().s.len() >= value {
|
2022-02-18 06:02:22 +00:00
|
|
|
|
|
|
|
|
|
2022-06-30 08:50:09 +00:00
|
|
|
error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
|
2024-08-18 11:31:47 +00:00
|
|
|
--> tests/ui/significant_drop_in_scrutinee.rs:403:11
|
2022-02-18 06:02:22 +00:00
|
|
|
|
|
|
|
|
LL | match get_mutex_guard().s.len() > 1 {
|
2024-04-27 15:47:11 +00:00
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
2023-08-24 19:32:12 +00:00
|
|
|
...
|
2022-06-30 08:50:09 +00: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 06:02:22 +00:00
|
|
|
help: try moving the temporary above the match
|
|
|
|
|
|
2024-04-27 15:47:11 +00:00
|
|
|
LL ~ let value = get_mutex_guard().s.len();
|
|
|
|
LL ~ match value > 1 {
|
2022-02-18 06:02:22 +00:00
|
|
|
|
|
|
|
|
|
2022-06-30 08:50:09 +00:00
|
|
|
error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
|
2024-08-18 11:31:47 +00:00
|
|
|
--> tests/ui/significant_drop_in_scrutinee.rs:422:11
|
2022-05-21 11:24:00 +00:00
|
|
|
|
|
|
|
|
LL | match match i {
|
|
|
|
| ___________^
|
2023-08-24 19:32:12 +00:00
|
|
|
LL | |
|
|
|
|
LL | |
|
2022-05-21 11:24:00 +00:00
|
|
|
LL | | 100 => mutex1.lock().unwrap(),
|
2023-08-24 19:32:12 +00:00
|
|
|
... |
|
2024-04-27 15:47:11 +00:00
|
|
|
LL | | .s
|
2022-05-21 11:24:00 +00:00
|
|
|
LL | | .len()
|
2024-04-27 15:47:11 +00:00
|
|
|
| |__________^
|
2022-06-30 08:50:09 +00: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 06:02:22 +00:00
|
|
|
help: try moving the temporary above the match
|
|
|
|
|
|
2022-05-21 11:24:00 +00:00
|
|
|
LL ~ let value = match i {
|
2023-08-24 19:32:12 +00:00
|
|
|
LL +
|
|
|
|
LL +
|
2022-05-21 11:24:00 +00:00
|
|
|
LL + 100 => mutex1.lock().unwrap(),
|
|
|
|
LL + _ => mutex2.lock().unwrap(),
|
|
|
|
LL + }
|
|
|
|
LL + .s
|
2024-04-27 15:47:11 +00:00
|
|
|
LL + .len();
|
2022-06-16 14:00:32 +00:00
|
|
|
LL ~ match value
|
|
|
|
|
|
2022-02-18 06:02:22 +00:00
|
|
|
|
2022-06-30 08:50:09 +00:00
|
|
|
error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
|
2024-08-18 11:31:47 +00:00
|
|
|
--> tests/ui/significant_drop_in_scrutinee.rs:450:11
|
2022-05-21 11:24:00 +00:00
|
|
|
|
|
|
|
|
LL | match if i > 1 {
|
|
|
|
| ___________^
|
2023-08-24 19:32:12 +00:00
|
|
|
LL | |
|
|
|
|
LL | |
|
2022-05-21 11:24:00 +00:00
|
|
|
LL | | mutex1.lock().unwrap()
|
|
|
|
... |
|
2024-04-27 15:47:11 +00:00
|
|
|
LL | | .s
|
2022-05-21 11:24:00 +00:00
|
|
|
LL | | .len()
|
2024-04-27 15:47:11 +00:00
|
|
|
| |__________^
|
2022-06-30 08:50:09 +00: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 06:02:22 +00:00
|
|
|
help: try moving the temporary above the match
|
|
|
|
|
|
2022-05-21 11:24:00 +00:00
|
|
|
LL ~ let value = if i > 1 {
|
2023-08-24 19:32:12 +00:00
|
|
|
LL +
|
|
|
|
LL +
|
2022-05-21 11:24:00 +00:00
|
|
|
LL + mutex1.lock().unwrap()
|
|
|
|
LL + } else {
|
|
|
|
LL + mutex2.lock().unwrap()
|
|
|
|
LL + }
|
|
|
|
LL + .s
|
2024-04-27 15:47:11 +00:00
|
|
|
LL + .len();
|
2022-06-16 14:00:32 +00:00
|
|
|
LL ~ match value
|
|
|
|
|
|
2022-02-18 06:02:22 +00:00
|
|
|
|
2022-06-30 08:50:09 +00:00
|
|
|
error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
|
2024-08-18 11:31:47 +00:00
|
|
|
--> tests/ui/significant_drop_in_scrutinee.rs:506:11
|
2022-02-18 06:02:22 +00:00
|
|
|
|
|
|
|
|
LL | match s.lock().deref().deref() {
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
2023-08-24 19:32:12 +00:00
|
|
|
...
|
2022-06-30 08:50:09 +00:00
|
|
|
LL | _ => println!("Value is {}", s.lock().deref()),
|
2024-04-26 09:26:35 +00:00
|
|
|
| -------- another value with significant `Drop` created here
|
2022-06-30 08:50:09 +00:00
|
|
|
LL | };
|
|
|
|
| - temporary lives until here
|
2022-02-18 06:02:22 +00:00
|
|
|
|
|
2022-06-30 08:50:09 +00:00
|
|
|
= note: this might lead to deadlocks or other unexpected behavior
|
2022-02-18 06:02:22 +00:00
|
|
|
help: try moving the temporary above the match and create a copy
|
|
|
|
|
|
|
|
|
LL ~ let value = *s.lock().deref().deref();
|
2024-04-27 15:47:11 +00:00
|
|
|
LL ~ match (&value) {
|
2022-02-18 06:02:22 +00:00
|
|
|
|
|
|
|
|
|
2022-06-30 08:50:09 +00:00
|
|
|
error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
|
2024-08-18 11:31:47 +00:00
|
|
|
--> tests/ui/significant_drop_in_scrutinee.rs:556:11
|
2022-02-18 06:02:22 +00:00
|
|
|
|
|
|
|
|
LL | match mutex.lock().unwrap().i = i {
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
2023-08-24 19:32:12 +00:00
|
|
|
...
|
2022-06-30 08:50:09 +00: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 06:02:22 +00:00
|
|
|
help: try moving the temporary above the match
|
|
|
|
|
|
|
|
|
LL ~ mutex.lock().unwrap().i = i;
|
|
|
|
LL ~ match () {
|
|
|
|
|
|
|
|
|
|
2022-06-30 08:50:09 +00:00
|
|
|
error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
|
2024-08-18 11:31:47 +00:00
|
|
|
--> tests/ui/significant_drop_in_scrutinee.rs:564:15
|
2022-02-18 06:02:22 +00:00
|
|
|
|
|
|
|
|
LL | match i = mutex.lock().unwrap().i {
|
2024-04-27 15:47:11 +00:00
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^
|
2023-08-24 19:32:12 +00:00
|
|
|
...
|
2022-06-30 08:50:09 +00: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 06:02:22 +00:00
|
|
|
help: try moving the temporary above the match
|
|
|
|
|
|
2024-04-27 15:47:11 +00:00
|
|
|
LL ~ let value = mutex.lock().unwrap().i;
|
|
|
|
LL ~ match i = value {
|
2022-02-18 06:02:22 +00:00
|
|
|
|
|
|
|
|
|
2022-06-30 08:50:09 +00:00
|
|
|
error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
|
2024-08-18 11:31:47 +00:00
|
|
|
--> tests/ui/significant_drop_in_scrutinee.rs:572:11
|
2022-02-18 06:02:22 +00:00
|
|
|
|
|
|
|
|
LL | match mutex.lock().unwrap().i += 1 {
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
2023-08-24 19:32:12 +00:00
|
|
|
...
|
2022-06-30 08:50:09 +00: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 06:02:22 +00:00
|
|
|
help: try moving the temporary above the match
|
|
|
|
|
|
|
|
|
LL ~ mutex.lock().unwrap().i += 1;
|
|
|
|
LL ~ match () {
|
|
|
|
|
|
|
|
|
|
2022-06-30 08:50:09 +00:00
|
|
|
error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
|
2024-08-18 11:31:47 +00:00
|
|
|
--> tests/ui/significant_drop_in_scrutinee.rs:580:16
|
2022-02-18 06:02:22 +00:00
|
|
|
|
|
|
|
|
LL | match i += mutex.lock().unwrap().i {
|
2024-04-27 15:47:11 +00:00
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^
|
2023-08-24 19:32:12 +00:00
|
|
|
...
|
2022-06-30 08:50:09 +00: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 06:02:22 +00:00
|
|
|
help: try moving the temporary above the match
|
|
|
|
|
|
2024-04-27 15:47:11 +00:00
|
|
|
LL ~ let value = mutex.lock().unwrap().i;
|
|
|
|
LL ~ match i += value {
|
2022-02-18 06:02:22 +00:00
|
|
|
|
|
|
|
|
|
2022-06-30 08:50:09 +00:00
|
|
|
error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
|
2024-08-18 11:31:47 +00:00
|
|
|
--> tests/ui/significant_drop_in_scrutinee.rs:645:11
|
2022-06-04 11:34:07 +00:00
|
|
|
|
|
|
|
|
LL | match rwlock.read().unwrap().to_number() {
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
2022-06-30 08:50:09 +00:00
|
|
|
...
|
|
|
|
LL | };
|
|
|
|
| - temporary lives until here
|
|
|
|
|
|
|
|
|
= note: this might lead to deadlocks or other unexpected behavior
|
2024-04-27 15:47:11 +00:00
|
|
|
help: try moving the temporary above the match
|
2022-06-04 11:34:07 +00:00
|
|
|
|
|
2024-04-27 15:47:11 +00:00
|
|
|
LL ~ let value = rwlock.read().unwrap().to_number();
|
|
|
|
LL ~ match value {
|
2022-06-30 08:50:09 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
|
2024-08-18 11:31:47 +00:00
|
|
|
--> tests/ui/significant_drop_in_scrutinee.rs:673:11
|
2022-06-30 08:50:09 +00: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 11:34:07 +00:00
|
|
|
|
2024-04-29 04:55:12 +00:00
|
|
|
error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
|
2024-08-18 11:31:47 +00:00
|
|
|
--> tests/ui/significant_drop_in_scrutinee.rs:736:11
|
2024-04-29 04:55:12 +00:00
|
|
|
|
|
|
|
|
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 {
|
|
|
|
|
|
|
|
|
|
2024-04-27 15:47:11 +00:00
|
|
|
error: temporary with significant `Drop` in `for` loop condition will live until the end of the `for` expression
|
2024-08-18 11:31:47 +00:00
|
|
|
--> tests/ui/significant_drop_in_scrutinee.rs:762:16
|
2024-04-27 15:47:11 +00:00
|
|
|
|
|
|
|
|
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
|
2024-08-18 11:31:47 +00:00
|
|
|
--> tests/ui/significant_drop_in_scrutinee.rs:802:17
|
2024-04-27 15:47:11 +00:00
|
|
|
|
|
|
|
|
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] {
|
|
|
|
|
|
|
|
|
|
2024-04-29 04:39:31 +00:00
|
|
|
error: temporary with significant `Drop` in `if let` scrutinee will live until the end of the `if let` expression
|
2024-08-18 11:31:47 +00:00
|
|
|
--> tests/ui/significant_drop_in_scrutinee.rs:812:24
|
2024-04-29 04:39:31 +00:00
|
|
|
|
|
|
|
|
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
|
2024-08-18 11:31:47 +00:00
|
|
|
--> tests/ui/significant_drop_in_scrutinee.rs:828:27
|
2024-04-29 04:39:31 +00:00
|
|
|
|
|
|
|
|
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
|
2022-02-18 06:02:22 +00:00
|
|
|
|