diff options
Diffstat (limited to 'ext')
-rw-r--r-- | ext/http/websocket_upgrade.rs | 9 | ||||
-rw-r--r-- | ext/napi/function.rs | 2 | ||||
-rw-r--r-- | ext/web/hr_timer_lock.rs | 2 |
3 files changed, 5 insertions, 8 deletions
diff --git a/ext/http/websocket_upgrade.rs b/ext/http/websocket_upgrade.rs index 70ad78526..f57f9e56b 100644 --- a/ext/http/websocket_upgrade.rs +++ b/ext/http/websocket_upgrade.rs @@ -131,12 +131,9 @@ impl<T: Default> WebSocketUpgrade<T> { HEADER_SEARCHER.get_or_init(|| TwoWaySearcher::new(b"\r\n\r\n")); let header_searcher2 = HEADER_SEARCHER2.get_or_init(|| TwoWaySearcher::new(b"\n\n")); - if let Some(..) = header_searcher.search_in(&self.buf) { - let (index, response) = parse_response(&self.buf)?; - let mut buf = std::mem::take(&mut self.buf); - self.state = Complete; - Ok(Some((response, buf.split_off(index).freeze()))) - } else if let Some(..) = header_searcher2.search_in(&self.buf) { + if header_searcher.search_in(&self.buf).is_some() + || header_searcher2.search_in(&self.buf).is_some() + { let (index, response) = parse_response(&self.buf)?; let mut buf = std::mem::take(&mut self.buf); self.state = Complete; diff --git a/ext/napi/function.rs b/ext/napi/function.rs index 49e9a3570..a99997225 100644 --- a/ext/napi/function.rs +++ b/ext/napi/function.rs @@ -37,7 +37,7 @@ extern "C" fn call_fn(info: *const v8::FunctionCallbackInfo) { }; // SAFETY: pointer from Box::into_raw. - let mut info = unsafe { &mut *info_ptr }; + let info = unsafe { &mut *info_ptr }; info.args = &args as *const _ as *const c_void; if let Some(f) = info.cb { diff --git a/ext/web/hr_timer_lock.rs b/ext/web/hr_timer_lock.rs index f1f588d6c..cd141a638 100644 --- a/ext/web/hr_timer_lock.rs +++ b/ext/web/hr_timer_lock.rs @@ -63,5 +63,5 @@ pub(crate) fn hr_timer_lock() -> windows::HrTimerLock { /// No-op on other platforms. #[cfg(not(target_os = "windows"))] pub(crate) fn hr_timer_lock() -> (std::marker::PhantomData<()>,) { - (std::marker::PhantomData::default(),) + Default::default() } |