Skip to content

Commit 5ba798a

Browse files
committed
docs: Make empty listener panic clearer
This commit makes the panic message for a listener that's not inserted into the linked list much clearer. The goal is to convey to the user that they may be `poll`ing the listener after it has completed. This commit also fixes some new Clippy lints. cc #124 Signed-off-by: John Nunley <[email protected]>
1 parent d73931a commit 5ba798a

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/lib.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1248,7 +1248,7 @@ impl<T> RegisterResult<T> {
12481248
match self {
12491249
Self::Notified(tag) => Some(tag),
12501250
Self::Registered => None,
1251-
Self::NeverInserted => panic!("listener was never inserted into the list"),
1251+
Self::NeverInserted => panic!("{}", NEVER_INSERTED_PANIC),
12521252
}
12531253
}
12541254
}
@@ -1326,6 +1326,10 @@ impl TaskRef<'_> {
13261326
}
13271327
}
13281328

1329+
const NEVER_INSERTED_PANIC: &str = "\
1330+
EventListener was not inserted into the linked list, make sure you're not polling \
1331+
EventListener/listener! after it has finished";
1332+
13291333
/// Synchronization primitive implementation.
13301334
mod sync {
13311335
pub(super) use core::cell;

0 commit comments

Comments
 (0)