mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-15 17:28:07 +00:00
eb3970285b
In order to switch `clippy::uninlined_format_args` from pedantic to style, all existing tests must not raise a warning. I did not want to change the actual tests, so this is a relatively minor change that: * add `#![allow(clippy::uninlined_format_args)]` where needed * normalizes all allow/deny/warn attributes * all allow attributes are grouped together * sorted alphabetically * the `clippy::*` attributes are listed separate from the other ones. * deny and warn attributes are listed before the allowed ones changelog: none
497 lines
18 KiB
Text
497 lines
18 KiB
Text
error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
|
|
--> $DIR/significant_drop_in_scrutinee.rs:56:11
|
|
|
|
|
LL | match mutex.lock().unwrap().foo() {
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
LL | true => {
|
|
LL | mutex.lock().unwrap().bar();
|
|
| --------------------- another value with significant `Drop` created here
|
|
...
|
|
LL | };
|
|
| - temporary lives until here
|
|
|
|
|
= note: `-D clippy::significant-drop-in-scrutinee` implied by `-D warnings`
|
|
= 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
|
|
--> $DIR/significant_drop_in_scrutinee.rs:142: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 | }
|
|
| - 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
|
|
--> $DIR/significant_drop_in_scrutinee.rs:163: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 | }
|
|
| - 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
|
|
--> $DIR/significant_drop_in_scrutinee.rs:211: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
|
|
--> $DIR/significant_drop_in_scrutinee.rs:234: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
|
|
--> $DIR/significant_drop_in_scrutinee.rs:243: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
|
|
--> $DIR/significant_drop_in_scrutinee.rs:253: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
|
|
--> $DIR/significant_drop_in_scrutinee.rs:253: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
|
|
--> $DIR/significant_drop_in_scrutinee.rs:264:15
|
|
|
|
|
LL | match mutex3.lock().unwrap().s.as_str() {
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
...
|
|
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
|
|
|
|
error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
|
|
--> $DIR/significant_drop_in_scrutinee.rs:274:22
|
|
|
|
|
LL | match (true, mutex3.lock().unwrap().s.as_str()) {
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
...
|
|
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
|
|
|
|
error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
|
|
--> $DIR/significant_drop_in_scrutinee.rs:293:11
|
|
|
|
|
LL | match mutex.lock().unwrap().s.len() > 1 {
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
LL | true => {
|
|
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() > 1;
|
|
LL ~ match value {
|
|
|
|
|
|
|
error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
|
|
--> $DIR/significant_drop_in_scrutinee.rs:300:11
|
|
|
|
|
LL | match 1 < mutex.lock().unwrap().s.len() {
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
LL | true => {
|
|
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 = 1 < mutex.lock().unwrap().s.len();
|
|
LL ~ match value {
|
|
|
|
|
|
|
error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
|
|
--> $DIR/significant_drop_in_scrutinee.rs:318: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() < mutex2.lock().unwrap().s.len();
|
|
LL ~ match value {
|
|
|
|
|
|
|
error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
|
|
--> $DIR/significant_drop_in_scrutinee.rs:329: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() >= mutex2.lock().unwrap().s.len();
|
|
LL ~ match value {
|
|
|
|
|
|
|
error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
|
|
--> $DIR/significant_drop_in_scrutinee.rs:364:11
|
|
|
|
|
LL | match get_mutex_guard().s.len() > 1 {
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
LL | 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 = get_mutex_guard().s.len() > 1;
|
|
LL ~ match value {
|
|
|
|
|
|
|
error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
|
|
--> $DIR/significant_drop_in_scrutinee.rs:381:11
|
|
|
|
|
LL | match match i {
|
|
| ___________^
|
|
LL | | 100 => mutex1.lock().unwrap(),
|
|
LL | | _ => mutex2.lock().unwrap(),
|
|
LL | | }
|
|
LL | | .s
|
|
LL | | .len()
|
|
LL | | > 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 = match i {
|
|
LL + 100 => mutex1.lock().unwrap(),
|
|
LL + _ => mutex2.lock().unwrap(),
|
|
LL + }
|
|
LL + .s
|
|
LL + .len()
|
|
LL + > 1;
|
|
LL ~ match value
|
|
|
|
|
|
|
error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
|
|
--> $DIR/significant_drop_in_scrutinee.rs:407:11
|
|
|
|
|
LL | match if i > 1 {
|
|
| ___________^
|
|
LL | | mutex1.lock().unwrap()
|
|
LL | | } else {
|
|
LL | | mutex2.lock().unwrap()
|
|
... |
|
|
LL | | .len()
|
|
LL | | > 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 = if i > 1 {
|
|
LL + mutex1.lock().unwrap()
|
|
LL + } else {
|
|
LL + mutex2.lock().unwrap()
|
|
LL + }
|
|
LL + .s
|
|
LL + .len()
|
|
LL + > 1;
|
|
LL ~ match value
|
|
|
|
|
|
|
error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
|
|
--> $DIR/significant_drop_in_scrutinee.rs:461:11
|
|
|
|
|
LL | match s.lock().deref().deref() {
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
|
LL | 0 | 1 => println!("Value was less than 2"),
|
|
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
|
|
--> $DIR/significant_drop_in_scrutinee.rs:489:11
|
|
|
|
|
LL | match s.lock().deref().deref() {
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
|
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
|
|
|
|
error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
|
|
--> $DIR/significant_drop_in_scrutinee.rs:508:11
|
|
|
|
|
LL | match mutex.lock().unwrap().i = i {
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
LL | _ => {
|
|
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
|
|
--> $DIR/significant_drop_in_scrutinee.rs:514:11
|
|
|
|
|
LL | match i = mutex.lock().unwrap().i {
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
LL | _ => {
|
|
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 ~ i = mutex.lock().unwrap().i;
|
|
LL ~ match () {
|
|
|
|
|
|
|
error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
|
|
--> $DIR/significant_drop_in_scrutinee.rs:520:11
|
|
|
|
|
LL | match mutex.lock().unwrap().i += 1 {
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
LL | _ => {
|
|
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
|
|
--> $DIR/significant_drop_in_scrutinee.rs:526:11
|
|
|
|
|
LL | match i += mutex.lock().unwrap().i {
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
LL | _ => {
|
|
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 ~ i += mutex.lock().unwrap().i;
|
|
LL ~ match () {
|
|
|
|
|
|
|
error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
|
|
--> $DIR/significant_drop_in_scrutinee.rs:589:11
|
|
|
|
|
LL | match rwlock.read().unwrap().to_number() {
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
...
|
|
LL | };
|
|
| - temporary lives until here
|
|
|
|
|
= note: this might lead to deadlocks or other unexpected behavior
|
|
|
|
error: temporary with significant `Drop` in `for` loop condition will live until the end of the `for` expression
|
|
--> $DIR/significant_drop_in_scrutinee.rs:599:14
|
|
|
|
|
LL | for s in rwlock.read().unwrap().iter() {
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
LL | println!("{}", s);
|
|
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
|
|
--> $DIR/significant_drop_in_scrutinee.rs:614: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: aborting due to 26 previous errors
|
|
|