[significant_drop_tightening] Ignore inexpensive statements
This commit is contained in:
parent
dfe23dc236
commit
747f81ecd0
4 changed files with 38 additions and 8 deletions
|
|
@ -4,6 +4,14 @@
|
|||
|
||||
use std::sync::Mutex;
|
||||
|
||||
pub fn post_bindings_can_be_ignored() {
|
||||
let mutex = Mutex::new(1);
|
||||
let lock = mutex.lock().unwrap();
|
||||
let rslt = *lock;
|
||||
let another = rslt;
|
||||
let _ = another;
|
||||
}
|
||||
|
||||
pub fn unnecessary_contention_with_multiple_owned_results() {
|
||||
{
|
||||
let mutex = Mutex::new(1i32);
|
||||
|
|
|
|||
|
|
@ -4,6 +4,14 @@
|
|||
|
||||
use std::sync::Mutex;
|
||||
|
||||
pub fn post_bindings_can_be_ignored() {
|
||||
let mutex = Mutex::new(1);
|
||||
let lock = mutex.lock().unwrap();
|
||||
let rslt = *lock;
|
||||
let another = rslt;
|
||||
let _ = another;
|
||||
}
|
||||
|
||||
pub fn unnecessary_contention_with_multiple_owned_results() {
|
||||
{
|
||||
let mutex = Mutex::new(1i32);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
error: temporary with significant `Drop` can be early dropped
|
||||
--> $DIR/significant_drop_tightening.rs:17:13
|
||||
--> $DIR/significant_drop_tightening.rs:25:13
|
||||
|
|
||||
LL | / {
|
||||
LL | | let mutex = Mutex::new(1i32);
|
||||
|
|
@ -20,7 +20,7 @@ LL + drop(lock);
|
|||
|
|
||||
|
||||
error: temporary with significant `Drop` can be early dropped
|
||||
--> $DIR/significant_drop_tightening.rs:38:13
|
||||
--> $DIR/significant_drop_tightening.rs:46:13
|
||||
|
|
||||
LL | / {
|
||||
LL | | let mutex = Mutex::new(1i32);
|
||||
|
|
@ -44,7 +44,7 @@ LL +
|
|||
|
|
||||
|
||||
error: temporary with significant `Drop` can be early dropped
|
||||
--> $DIR/significant_drop_tightening.rs:44:17
|
||||
--> $DIR/significant_drop_tightening.rs:52:17
|
||||
|
|
||||
LL | / {
|
||||
LL | | let mutex = Mutex::new(vec![1i32]);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue