diff options
author | Nico Burns <nico@nicoburns.com> | 2025-01-01 22:38:28 +1300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-01-01 09:38:28 +0000 |
commit | deb819f23368ed43b9312a439e48f9d5f961930c (patch) | |
tree | 5645f16c1b3915204b009b6c44aa8e11ab62014c /components/script | |
parent | d581acab3bd244e233105edde972a0605224358a (diff) | |
download | servo-deb819f23368ed43b9312a439e48f9d5f961930c.tar.gz servo-deb819f23368ed43b9312a439e48f9d5f961930c.zip |
Upgrade rustc to 1.83 (#34793)
* Upgrade rustc to 1.83
Signed-off-by: Nico Burns <nico@nicoburns.com>
* Fix crown (change copied from linked clippy function)
Signed-off-by: Nico Burns <nico@nicoburns.com>
* Fix named lifetime lint
Signed-off-by: Nico Burns <nico@nicoburns.com>
* Bump shell.nix
Signed-off-by: Nico Burns <nico@nicoburns.com>
* Fix non-local impl warnings
Signed-off-by: Nico Burns <nico@nicoburns.com>
* Format with 1.83 formatting changes
Signed-off-by: Nico Burns <nico@nicoburns.com>
* Fix manual non-local impl
Signed-off-by: Nico Burns <nico@nicoburns.com>
* More fixes for crown
Signed-off-by: Nico Burns <nico@nicoburns.com>
* Fix tidy
Signed-off-by: Nico Burns <nico@nicoburns.com>
* Fix needless_return lints
Signed-off-by: Nico Burns <nico@nicoburns.com>
* Fix doc comment lint
Signed-off-by: Nico Burns <nico@nicoburns.com>
* Fix missing wait lint
Signed-off-by: Nico Burns <nico@nicoburns.com>
* Allow needless_lifetimes lint
Signed-off-by: Nico Burns <nico@nicoburns.com>
* more doc comments
Signed-off-by: Nico Burns <nico@nicoburns.com>
* More needless_returns
Signed-off-by: Nico Burns <nico@nicoburns.com>
* is_empty lint
Signed-off-by: Nico Burns <nico@nicoburns.com>
* Fix needless_lifetime lints
Signed-off-by: Nico Burns <nico@nicoburns.com>
* fix div_ceil lint
Signed-off-by: Nico Burns <nico@nicoburns.com>
* Allow non-minimal bool
Signed-off-by: Nico Burns <nico@nicoburns.com>
* Non-local impl in constellation
Signed-off-by: Nico Burns <nico@nicoburns.com>
* Missing wait in constellation
Signed-off-by: Nico Burns <nico@nicoburns.com>
* fmt
Signed-off-by: Nico Burns <nico@nicoburns.com>
* remove useless lints table
Signed-off-by: Nico Burns <nico@nicoburns.com>
* Fixup comments
Signed-off-by: Nico Burns <nico@nicoburns.com>
* Allow non-local definition in sandboxing code to simplify feature flagging
Signed-off-by: Nico Burns <nico@nicoburns.com>
* Remove wait calls and allow zombie_processes lint
Signed-off-by: Nico Burns <nico@nicoburns.com>
---------
Signed-off-by: Nico Burns <nico@nicoburns.com>
Diffstat (limited to 'components/script')
-rw-r--r-- | components/script/build.rs | 4 | ||||
-rw-r--r-- | components/script/dom/audiobuffer.rs | 2 | ||||
-rw-r--r-- | components/script/dom/bindings/finalize.rs | 4 | ||||
-rw-r--r-- | components/script/dom/bindings/proxyhandler.rs | 2 | ||||
-rw-r--r-- | components/script/dom/htmlformelement.rs | 4 | ||||
-rw-r--r-- | components/script/dom/mediafragmentparser.rs | 2 | ||||
-rw-r--r-- | components/script/dom/performance.rs | 4 | ||||
-rw-r--r-- | components/script/dom/resizeobserver.rs | 6 | ||||
-rw-r--r-- | components/script/dom/servoparser/async_html.rs | 5 | ||||
-rw-r--r-- | components/script/dom/servoparser/mod.rs | 5 | ||||
-rw-r--r-- | components/script/dom/webgl_validations/tex_image_2d.rs | 4 | ||||
-rw-r--r-- | components/script/dom/windowproxy.rs | 2 | ||||
-rw-r--r-- | components/script/dom/xmlhttprequest.rs | 134 | ||||
-rw-r--r-- | components/script/lib.rs | 1 |
14 files changed, 91 insertions, 88 deletions
diff --git a/components/script/build.rs b/components/script/build.rs index a0666675c7a..e6962d6b3ac 100644 --- a/components/script/build.rs +++ b/components/script/build.rs @@ -56,7 +56,7 @@ fn main() { #[derive(Eq, Hash, PartialEq)] struct Bytes<'a>(&'a str); -impl<'a> FmtConst for Bytes<'a> { +impl FmtConst for Bytes<'_> { fn fmt_const(&self, formatter: &mut fmt::Formatter) -> fmt::Result { // https://github.com/rust-lang/rust/issues/55223 // should technically be just `write!(formatter, "b\"{}\"", self.0) @@ -65,7 +65,7 @@ impl<'a> FmtConst for Bytes<'a> { } } -impl<'a> phf_shared::PhfHash for Bytes<'a> { +impl phf_shared::PhfHash for Bytes<'_> { fn phf_hash<H: std::hash::Hasher>(&self, hasher: &mut H) { self.0.as_bytes().phf_hash(hasher) } diff --git a/components/script/dom/audiobuffer.rs b/components/script/dom/audiobuffer.rs index 8b88cd0bcac..5fc2acdbf4d 100644 --- a/components/script/dom/audiobuffer.rs +++ b/components/script/dom/audiobuffer.rs @@ -179,7 +179,7 @@ impl AudioBuffer { *self.shared_channels.borrow_mut() = channels; } } - return self.shared_channels.borrow(); + self.shared_channels.borrow() } } diff --git a/components/script/dom/bindings/finalize.rs b/components/script/dom/bindings/finalize.rs index 9ef4665118a..2a1ff930fac 100644 --- a/components/script/dom/bindings/finalize.rs +++ b/components/script/dom/bindings/finalize.rs @@ -2,6 +2,8 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ +//! Generic finalizer implementations for DOM binding implementations. + use std::any::type_name; use std::mem; @@ -12,8 +14,6 @@ use js::jsval::UndefinedValue; use crate::dom::bindings::utils::finalize_global as do_finalize_global; use crate::dom::bindings::weakref::{WeakBox, WeakReferenceable, DOM_WEAK_SLOT}; -/// Generic finalizer implementations for DOM binding implementations. - pub unsafe fn finalize_common<T>(this: *const T) { if !this.is_null() { // The pointer can be null if the object is the unforgeable holder of that interface. diff --git a/components/script/dom/bindings/proxyhandler.rs b/components/script/dom/bindings/proxyhandler.rs index 91fad86a0cd..c3520c6d8ca 100644 --- a/components/script/dom/bindings/proxyhandler.rs +++ b/components/script/dom/bindings/proxyhandler.rs @@ -631,7 +631,7 @@ pub unsafe fn cross_origin_get_own_property_helper( holder.handle_mut().into(), ); - return JS_GetOwnPropertyDescriptorById(*cx, holder.handle().into(), id, desc, is_none); + JS_GetOwnPropertyDescriptorById(*cx, holder.handle().into(), id, desc, is_none) } /// Implementation of [`CrossOriginPropertyFallback`]. diff --git a/components/script/dom/htmlformelement.rs b/components/script/dom/htmlformelement.rs index 0467d30bdf6..f1f176daeb6 100644 --- a/components/script/dom/htmlformelement.rs +++ b/components/script/dom/htmlformelement.rs @@ -483,9 +483,9 @@ impl HTMLFormElementMethods<crate::DomTypeHolder> for HTMLFormElement { ); // Step 6 - return Some(RadioNodeListOrElement::Element(DomRoot::from_ref( + Some(RadioNodeListOrElement::Element(DomRoot::from_ref( element_node.downcast::<Element>().unwrap(), - ))); + ))) } // https://html.spec.whatwg.org/multipage/#dom-a-rel diff --git a/components/script/dom/mediafragmentparser.rs b/components/script/dom/mediafragmentparser.rs index e8fb9b2c18a..0dc949b6eef 100644 --- a/components/script/dom/mediafragmentparser.rs +++ b/components/script/dom/mediafragmentparser.rs @@ -293,7 +293,7 @@ fn parse_npt_seconds(s: &str) -> Result<f64, ()> { fn parse_hms(s: &str) -> Result<f64, ()> { let mut vec: VecDeque<&str> = s.split(':').collect(); - vec.retain(|x| !x.eq(&"")); + vec.retain(|x| !x.is_empty()); let result = match vec.len() { 1 => { diff --git a/components/script/dom/performance.rs b/components/script/dom/performance.rs index f3a6033ab84..e9f73f26af4 100644 --- a/components/script/dom/performance.rs +++ b/components/script/dom/performance.rs @@ -198,8 +198,8 @@ impl Performance { self.resource_timing_buffer_size_limit.set(0); } - /// Add a PerformanceObserver to the list of observers with a set of - /// observed entry types. + // Add a PerformanceObserver to the list of observers with a set of + // observed entry types. pub fn add_multiple_type_observer( &self, diff --git a/components/script/dom/resizeobserver.rs b/components/script/dom/resizeobserver.rs index 9fd4fd58014..b3e7f680725 100644 --- a/components/script/dom/resizeobserver.rs +++ b/components/script/dom/resizeobserver.rs @@ -219,11 +219,11 @@ enum ObservationState { } /// <https://drafts.csswg.org/resize-observer/#resizeobservation> +/// +/// Note: `target` is kept out of here, to avoid having to root the `ResizeObservation`. +/// <https://drafts.csswg.org/resize-observer/#dom-resizeobservation-target> #[derive(JSTraceable, MallocSizeOf)] struct ResizeObservation { - /// <https://drafts.csswg.org/resize-observer/#dom-resizeobservation-target> - /// Note: `target` is kept out of here, to avoid having to root the `ResizeObservation`. - /// <https://drafts.csswg.org/resize-observer/#dom-resizeobservation-observedbox> observed_box: RefCell<ResizeObserverBoxOptions>, /// <https://drafts.csswg.org/resize-observer/#dom-resizeobservation-lastreportedsizes> diff --git a/components/script/dom/servoparser/async_html.rs b/components/script/dom/servoparser/async_html.rs index 29d684f5fdc..e9be6f8b657 100644 --- a/components/script/dom/servoparser/async_html.rs +++ b/components/script/dom/servoparser/async_html.rs @@ -701,7 +701,10 @@ impl TreeSink for Sink { } type Handle = ParseNode; - type ElemName<'a> = ExpandedName<'a> where Self: 'a; + type ElemName<'a> + = ExpandedName<'a> + where + Self: 'a; fn get_document(&self) -> Self::Handle { self.document_node.clone() diff --git a/components/script/dom/servoparser/mod.rs b/components/script/dom/servoparser/mod.rs index 182702f334b..f10a26bd9ad 100644 --- a/components/script/dom/servoparser/mod.rs +++ b/components/script/dom/servoparser/mod.rs @@ -1135,7 +1135,10 @@ impl TreeSink for Sink { } type Handle = Dom<Node>; - type ElemName<'a> = ExpandedName<'a> where Self: 'a; + type ElemName<'a> + = ExpandedName<'a> + where + Self: 'a; #[allow(crown::unrooted_must_root)] fn get_document(&self) -> Dom<Node> { diff --git a/components/script/dom/webgl_validations/tex_image_2d.rs b/components/script/dom/webgl_validations/tex_image_2d.rs index ecd0a167ce6..c8ab11b87d8 100644 --- a/components/script/dom/webgl_validations/tex_image_2d.rs +++ b/components/script/dom/webgl_validations/tex_image_2d.rs @@ -435,8 +435,8 @@ fn valid_compressed_data_len( let block_width = compression.block_width as u32; let block_height = compression.block_height as u32; - let required_blocks_hor = (width + block_width - 1) / block_width; - let required_blocks_ver = (height + block_height - 1) / block_height; + let required_blocks_hor = width.div_ceil(block_width); + let required_blocks_ver = height.div_ceil(block_height); let required_blocks = required_blocks_hor * required_blocks_ver; let required_bytes = required_blocks * compression.bytes_per_block as u32; diff --git a/components/script/dom/windowproxy.rs b/components/script/dom/windowproxy.rs index a85ce40a919..02944715696 100644 --- a/components/script/dom/windowproxy.rs +++ b/components/script/dom/windowproxy.rs @@ -930,7 +930,7 @@ unsafe extern "C" fn getOwnPropertyDescriptor( let mut slot = UndefinedValue(); GetProxyPrivate(proxy.get(), &mut slot); rooted!(in(cx) let target = slot.to_object()); - return JS_GetOwnPropertyDescriptorById(cx, target.handle().into(), id, desc, is_none); + JS_GetOwnPropertyDescriptorById(cx, target.handle().into(), id, desc, is_none) } #[allow(unsafe_code, non_snake_case)] diff --git a/components/script/dom/xmlhttprequest.rs b/components/script/dom/xmlhttprequest.rs index 60b76654be6..a031b625036 100644 --- a/components/script/dom/xmlhttprequest.rs +++ b/components/script/dom/xmlhttprequest.rs @@ -98,6 +98,71 @@ struct XHRContext { url: ServoUrl, } +impl FetchResponseListener for XHRContext { + fn process_request_body(&mut self, _: RequestId) { + // todo + } + + fn process_request_eof(&mut self, _: RequestId) { + // todo + } + + fn process_response(&mut self, _: RequestId, metadata: Result<FetchMetadata, NetworkError>) { + let xhr = self.xhr.root(); + let rv = xhr.process_headers_available(self.gen_id, metadata, CanGc::note()); + if rv.is_err() { + *self.sync_status.borrow_mut() = Some(rv); + } + } + + fn process_response_chunk(&mut self, _: RequestId, chunk: Vec<u8>) { + self.xhr + .root() + .process_data_available(self.gen_id, chunk, CanGc::note()); + } + + fn process_response_eof( + &mut self, + _: RequestId, + response: Result<ResourceFetchTiming, NetworkError>, + ) { + let rv = self.xhr.root().process_response_complete( + self.gen_id, + response.map(|_| ()), + CanGc::note(), + ); + *self.sync_status.borrow_mut() = Some(rv); + } + + fn resource_timing_mut(&mut self) -> &mut ResourceFetchTiming { + &mut self.resource_timing + } + + fn resource_timing(&self) -> &ResourceFetchTiming { + &self.resource_timing + } + + fn submit_resource_timing(&mut self) { + network_listener::submit_timing(self, CanGc::note()) + } +} + +impl ResourceTimingListener for XHRContext { + fn resource_timing_information(&self) -> (InitiatorType, ServoUrl) { + (InitiatorType::XMLHttpRequest, self.url.clone()) + } + + fn resource_timing_global(&self) -> DomRoot<GlobalScope> { + self.xhr.root().global() + } +} + +impl PreInvoke for XHRContext { + fn should_invoke(&self) -> bool { + self.xhr.root().generation_id.get() == self.gen_id + } +} + #[derive(Clone)] pub enum XHRProgress { /// Notify that headers have been received @@ -234,75 +299,6 @@ impl XMLHttpRequest { init: RequestBuilder, cancellation_chan: ipc::IpcReceiver<()>, ) { - impl FetchResponseListener for XHRContext { - fn process_request_body(&mut self, _: RequestId) { - // todo - } - - fn process_request_eof(&mut self, _: RequestId) { - // todo - } - - fn process_response( - &mut self, - _: RequestId, - metadata: Result<FetchMetadata, NetworkError>, - ) { - let xhr = self.xhr.root(); - let rv = xhr.process_headers_available(self.gen_id, metadata, CanGc::note()); - if rv.is_err() { - *self.sync_status.borrow_mut() = Some(rv); - } - } - - fn process_response_chunk(&mut self, _: RequestId, chunk: Vec<u8>) { - self.xhr - .root() - .process_data_available(self.gen_id, chunk, CanGc::note()); - } - - fn process_response_eof( - &mut self, - _: RequestId, - response: Result<ResourceFetchTiming, NetworkError>, - ) { - let rv = self.xhr.root().process_response_complete( - self.gen_id, - response.map(|_| ()), - CanGc::note(), - ); - *self.sync_status.borrow_mut() = Some(rv); - } - - fn resource_timing_mut(&mut self) -> &mut ResourceFetchTiming { - &mut self.resource_timing - } - - fn resource_timing(&self) -> &ResourceFetchTiming { - &self.resource_timing - } - - fn submit_resource_timing(&mut self) { - network_listener::submit_timing(self, CanGc::note()) - } - } - - impl ResourceTimingListener for XHRContext { - fn resource_timing_information(&self) -> (InitiatorType, ServoUrl) { - (InitiatorType::XMLHttpRequest, self.url.clone()) - } - - fn resource_timing_global(&self) -> DomRoot<GlobalScope> { - self.xhr.root().global() - } - } - - impl PreInvoke for XHRContext { - fn should_invoke(&self) -> bool { - self.xhr.root().generation_id.get() == self.gen_id - } - } - global.fetch(init, context, task_source, Some(cancellation_chan)); } } diff --git a/components/script/lib.rs b/components/script/lib.rs index e406eb084fb..360e5e492ad 100644 --- a/components/script/lib.rs +++ b/components/script/lib.rs @@ -11,6 +11,7 @@ #![register_tool(crown)] #![cfg_attr(any(doc, clippy), allow(unknown_lints))] #![deny(crown_is_not_used)] +#![allow(clippy::needless_lifetimes)] // These are used a lot so let's keep them for now #[macro_use] |