diff options
| author | Mishio595 <[email protected]> | 2018-08-11 18:05:27 -0600 |
|---|---|---|
| committer | Mishio595 <[email protected]> | 2018-08-11 18:05:27 -0600 |
| commit | 7464354be7aaa77e2718045f99aecd34c69657e2 (patch) | |
| tree | c048467996c0b131af8394bd7221b33bc03c8c71 /src/client/dispatch.rs | |
| parent | Merge branch 'fix-default-command-upon-shortcut-prefix' of https://github.com... (diff) | |
| parent | Make default-command receive every bit of the command upon failure (diff) | |
| download | serenity-7464354be7aaa77e2718045f99aecd34c69657e2.tar.xz serenity-7464354be7aaa77e2718045f99aecd34c69657e2.zip | |
Resolve conflicts
Diffstat (limited to 'src/client/dispatch.rs')
| -rw-r--r-- | src/client/dispatch.rs | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/src/client/dispatch.rs b/src/client/dispatch.rs index 2bbe344..7dc9024 100644 --- a/src/client/dispatch.rs +++ b/src/client/dispatch.rs @@ -30,16 +30,16 @@ macro_rules! update { { #[cfg(feature = "cache")] { - CACHE.try_write_for(Duration::from_millis(10)) - .and_then(|mut lock| lock.update(&mut $event)) - .or_else(|| { - warn!( - "[dispatch] Possible deadlock: couldn't unlock cache to update with event: {:?}", - $event, - ); - - None - }) + if let Some(mut lock) = CACHE.try_write_for(Duration::from_millis(10)) { + lock.update(&mut $event) + } else { + warn!( + "[dispatch] Possible deadlock: couldn't unlock cache to update with event: {:?}", + $event, + ); + + None + } } } }; @@ -97,6 +97,7 @@ pub(crate) fn dispatch<H: EventHandler + Send + Sync + 'static>( } #[cfg(not(feature = "framework"))] +#[allow(unused_mut)] pub(crate) fn dispatch<H: EventHandler + Send + Sync + 'static>( event: DispatchEvent, data: &Arc<Mutex<ShareMap>>, |