File tree Expand file tree Collapse file tree 2 files changed +21
-3
lines changed Expand file tree Collapse file tree 2 files changed +21
-3
lines changed Original file line number Diff line number Diff line change @@ -47,9 +47,10 @@ async fn main() -> color_eyre::Result<()> {
47
47
let mut tasks = State :: default ( )
48
48
// TODO(eliza): allow configuring the list of linters via the
49
49
// CLI/possibly a config file?
50
- . with_linters ( vec ! [ warnings:: Linter :: new(
51
- warnings:: SelfWakePercent :: default ( ) ,
52
- ) ] ) ;
50
+ . with_linters ( vec ! [
51
+ warnings:: Linter :: new( warnings:: SelfWakePercent :: default ( ) ) ,
52
+ warnings:: Linter :: new( warnings:: LostWaker ) ,
53
+ ] ) ;
53
54
let mut input = input:: EventStream :: new ( ) ;
54
55
let mut view = view:: View :: new ( styles) ;
55
56
Original file line number Diff line number Diff line change @@ -133,3 +133,20 @@ impl Warn<Task> for SelfWakePercent {
133
133
)
134
134
}
135
135
}
136
+
137
+ #[ derive( Clone , Debug , Default ) ]
138
+ pub ( crate ) struct LostWaker ;
139
+
140
+ impl Warn < Task > for LostWaker {
141
+ fn summary ( & self ) -> & str {
142
+ "tasks have lost their waker"
143
+ }
144
+
145
+ fn check ( & self , task : & Task ) -> bool {
146
+ !task. is_completed ( ) && task. waker_count ( ) == 0
147
+ }
148
+
149
+ fn format ( & self , _: & Task ) -> String {
150
+ "This task has lost its waker, and will never be woken again." . into ( )
151
+ }
152
+ }
You can’t perform that action at this time.
0 commit comments