Write lint to check for dashmaps entries being held
Signed-off-by: Marcel Müller <neikos@neikos.email>
This commit is contained in:
parent
bf589f7d28
commit
ace01a2096
8 changed files with 355 additions and 24 deletions
|
|
@ -0,0 +1,126 @@
|
|||
warning: this dashmap reference is held across an 'await' point. Either drop it before the 'await', or read it again afterwards.
|
||||
--> $DIR/main.rs:12:9
|
||||
|
|
||||
LL | let reference = map.get("Hello");
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
note: these are all the await points this ref is held through
|
||||
--> $DIR/main.rs:14:34
|
||||
|
|
||||
LL | std::future::pending::<()>().await;
|
||||
| ^^^^^
|
||||
= note: `#[warn(dashmap_ref)]` on by default
|
||||
|
||||
warning: this dashmap reference is held across an 'await' point. Either drop it before the 'await', or read it again afterwards.
|
||||
--> $DIR/main.rs:22:9
|
||||
|
|
||||
LL | let _reference = map.get("Hello");
|
||||
| ^^^^^^^^^^
|
||||
|
|
||||
note: these are all the await points this ref is held through
|
||||
--> $DIR/main.rs:24:34
|
||||
|
|
||||
LL | std::future::pending::<()>().await;
|
||||
| ^^^^^
|
||||
LL |
|
||||
LL | std::future::pending::<()>().await;
|
||||
| ^^^^^
|
||||
|
||||
warning: this dashmap reference is held across an 'await' point. Either drop it before the 'await', or read it again afterwards.
|
||||
--> $DIR/main.rs:40:9
|
||||
|
|
||||
LL | let _ref = map.get("Hello");
|
||||
| ^^^^
|
||||
|
|
||||
note: these are all the await points this ref is held through
|
||||
--> $DIR/main.rs:49:34
|
||||
|
|
||||
LL | std::future::pending::<()>().await;
|
||||
| ^^^^^
|
||||
|
||||
warning: this dashmap reference is held across an 'await' point. Either drop it before the 'await', or read it again afterwards.
|
||||
--> $DIR/main.rs:41:9
|
||||
|
|
||||
LL | let _ref_mut = map.get_mut("Hello");
|
||||
| ^^^^^^^^
|
||||
|
|
||||
note: these are all the await points this ref is held through
|
||||
--> $DIR/main.rs:49:34
|
||||
|
|
||||
LL | std::future::pending::<()>().await;
|
||||
| ^^^^^
|
||||
|
||||
warning: this dashmap reference is held across an 'await' point. Either drop it before the 'await', or read it again afterwards.
|
||||
--> $DIR/main.rs:42:9
|
||||
|
|
||||
LL | let _entry = map.entry("Hello".to_string());
|
||||
| ^^^^^^
|
||||
|
|
||||
note: these are all the await points this ref is held through
|
||||
--> $DIR/main.rs:49:34
|
||||
|
|
||||
LL | std::future::pending::<()>().await;
|
||||
| ^^^^^
|
||||
|
||||
warning: this dashmap reference is held across an 'await' point. Either drop it before the 'await', or read it again afterwards.
|
||||
--> $DIR/main.rs:43:9
|
||||
|
|
||||
LL | let _opt_entry = map.try_entry("Hello".to_string());
|
||||
| ^^^^^^^^^^
|
||||
|
|
||||
note: these are all the await points this ref is held through
|
||||
--> $DIR/main.rs:49:34
|
||||
|
|
||||
LL | std::future::pending::<()>().await;
|
||||
| ^^^^^
|
||||
|
||||
warning: this dashmap reference is held across an 'await' point. Either drop it before the 'await', or read it again afterwards.
|
||||
--> $DIR/main.rs:44:9
|
||||
|
|
||||
LL | let _iter_entry = map.iter();
|
||||
| ^^^^^^^^^^^
|
||||
|
|
||||
note: these are all the await points this ref is held through
|
||||
--> $DIR/main.rs:49:34
|
||||
|
|
||||
LL | std::future::pending::<()>().await;
|
||||
| ^^^^^
|
||||
|
||||
warning: this dashmap reference is held across an 'await' point. Either drop it before the 'await', or read it again afterwards.
|
||||
--> $DIR/main.rs:45:9
|
||||
|
|
||||
LL | let _iter_mut_entry = map.iter_mut();
|
||||
| ^^^^^^^^^^^^^^^
|
||||
|
|
||||
note: these are all the await points this ref is held through
|
||||
--> $DIR/main.rs:49:34
|
||||
|
|
||||
LL | std::future::pending::<()>().await;
|
||||
| ^^^^^
|
||||
|
||||
warning: this dashmap reference is held across an 'await' point. Either drop it before the 'await', or read it again afterwards.
|
||||
--> $DIR/main.rs:46:9
|
||||
|
|
||||
LL | let _direct_ref = map.get("Hello").unwrap();
|
||||
| ^^^^^^^^^^^
|
||||
|
|
||||
note: these are all the await points this ref is held through
|
||||
--> $DIR/main.rs:49:34
|
||||
|
|
||||
LL | std::future::pending::<()>().await;
|
||||
| ^^^^^
|
||||
|
||||
warning: this dashmap reference is held across an 'await' point. Either drop it before the 'await', or read it again afterwards.
|
||||
--> $DIR/main.rs:47:9
|
||||
|
|
||||
LL | let _direct_ref_mut = map.get_mut("Hello").unwrap();
|
||||
| ^^^^^^^^^^^^^^^
|
||||
|
|
||||
note: these are all the await points this ref is held through
|
||||
--> $DIR/main.rs:49:34
|
||||
|
|
||||
LL | std::future::pending::<()>().await;
|
||||
| ^^^^^
|
||||
|
||||
warning: 10 warnings emitted
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue