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-02-17 12:16:29 +00:00
|
|
|
--> tests/ui/significant_drop_in_scrutinee.rs:55: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-02-17 12:16:29 +00:00
|
|
|
--> tests/ui/significant_drop_in_scrutinee.rs:143: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-02-17 12:16:29 +00:00
|
|
|
--> tests/ui/significant_drop_in_scrutinee.rs:166: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-02-17 12:16:29 +00:00
|
|
|
--> tests/ui/significant_drop_in_scrutinee.rs:216: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-02-17 12:16:29 +00:00
|
|
|
--> tests/ui/significant_drop_in_scrutinee.rs:241: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-02-17 12:16:29 +00:00
|
|
|
--> tests/ui/significant_drop_in_scrutinee.rs:252: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-02-17 12:16:29 +00:00
|
|
|
--> tests/ui/significant_drop_in_scrutinee.rs:264: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-02-17 12:16:29 +00:00
|
|
|
--> tests/ui/significant_drop_in_scrutinee.rs:264: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-04-27 15:47:11 +00:00
|
|
|
--> tests/ui/significant_drop_in_scrutinee.rs:319: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-04-27 15:47:11 +00:00
|
|
|
--> tests/ui/significant_drop_in_scrutinee.rs:328: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-04-27 15:47:11 +00:00
|
|
|
--> tests/ui/significant_drop_in_scrutinee.rs:348: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-04-27 15:47:11 +00:00
|
|
|
--> tests/ui/significant_drop_in_scrutinee.rs:348: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-04-27 15:47:11 +00:00
|
|
|
--> tests/ui/significant_drop_in_scrutinee.rs:361: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-04-27 15:47:11 +00:00
|
|
|
--> tests/ui/significant_drop_in_scrutinee.rs:361: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-04-27 15:47:11 +00:00
|
|
|
--> tests/ui/significant_drop_in_scrutinee.rs:398: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-04-27 15:47:11 +00:00
|
|
|
--> tests/ui/significant_drop_in_scrutinee.rs:417: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-04-27 15:47:11 +00:00
|
|
|
--> tests/ui/significant_drop_in_scrutinee.rs:445: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-04-27 15:47:11 +00:00
|
|
|
--> tests/ui/significant_drop_in_scrutinee.rs:501: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-04-27 15:47:11 +00:00
|
|
|
--> tests/ui/significant_drop_in_scrutinee.rs:551: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-04-27 15:47:11 +00:00
|
|
|
--> tests/ui/significant_drop_in_scrutinee.rs:559: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-04-27 15:47:11 +00:00
|
|
|
--> tests/ui/significant_drop_in_scrutinee.rs:567: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-04-27 15:47:11 +00:00
|
|
|
--> tests/ui/significant_drop_in_scrutinee.rs:575: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-04-27 15:47:11 +00:00
|
|
|
--> tests/ui/significant_drop_in_scrutinee.rs:640: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-04-27 15:47:11 +00:00
|
|
|
--> tests/ui/significant_drop_in_scrutinee.rs:668: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-04-27 15:47:11 +00:00
|
|
|
--> tests/ui/significant_drop_in_scrutinee.rs:731: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
|
|
|
|
--> tests/ui/significant_drop_in_scrutinee.rs:757: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:797: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] {
|
|
|
|
|
|
|
|
|
|
2024-04-29 04:55:12 +00:00
|
|
|
error: aborting due to 27 previous errors
|
2022-02-18 06:02:22 +00:00
|
|
|
|