clipping: Fix some warnings in components/script/dom (#31799)

* fix clippy websocket errors

* fix clippy window errors

* fix clippy window errors

* fix clippy window errors
This commit is contained in:
Rosemary Ajayi 2024-03-21 11:46:18 +00:00 committed by GitHub
parent 4b408a3724
commit ce0d456469
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 16 additions and 22 deletions

View file

@ -368,7 +368,7 @@ impl WebSocketMethods for WebSocket {
let send_data = self.send_impl(data_byte_len)?;
if send_data {
let bytes = blob.get_bytes().unwrap_or(vec![]);
let bytes = blob.get_bytes().unwrap_or_default();
let _ = self
.sender
.send(WebSocketDomAction::SendMessage(MessageData::Binary(bytes)));
@ -409,7 +409,7 @@ impl WebSocketMethods for WebSocket {
fn Close(&self, code: Option<u16>, reason: Option<USVString>) -> ErrorResult {
if let Some(code) = code {
//Fail if the supplied code isn't normal and isn't reserved for libraries, frameworks, and applications
if code != close_code::NORMAL && (code < 3000 || code > 4999) {
if code != close_code::NORMAL && !(3000..=4999).contains(&code) {
return Err(Error::InvalidAccess);
}
}