diff options
35 files changed, 155 insertions, 139 deletions
diff --git a/Cargo.toml b/Cargo.toml index 65827f14cfa..d8ff409cabb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,7 +13,7 @@ authors = ["The Servo Project Developers"] license = "MPL-2.0" edition = "2021" publish = false -rust-version = "1.82.0" +rust-version = "1.83.0" [workspace.dependencies] accountable-refcell = "0.2.0" diff --git a/components/bluetooth/lib.rs b/components/bluetooth/lib.rs index f67cf4d9d47..d2476c7f371 100644 --- a/components/bluetooth/lib.rs +++ b/components/bluetooth/lib.rs @@ -189,7 +189,7 @@ fn matches_filters(device: &BluetoothDevice, filters: &BluetoothScanfilterSequen return false; } - return filters.iter().any(|f| matches_filter(device, f)); + filters.iter().any(|f| matches_filter(device, f)) } fn is_mock_adapter(adapter: &BluetoothAdapter) -> bool { diff --git a/components/canvas/lib.rs b/components/canvas/lib.rs index d2c62c1d8b6..74982150356 100644 --- a/components/canvas/lib.rs +++ b/components/canvas/lib.rs @@ -3,6 +3,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ #![deny(unsafe_code)] +#![allow(clippy::needless_lifetimes)] mod raqote_backend; diff --git a/components/compositing/compositor.rs b/components/compositing/compositor.rs index 8da18bf5151..ff3d62e8868 100644 --- a/components/compositing/compositor.rs +++ b/components/compositing/compositor.rs @@ -1413,10 +1413,9 @@ impl<Window: WindowMethods + ?Sized> IOCompositor<Window> { } fn hit_test_at_point(&self, point: DevicePoint) -> Option<CompositorHitTestResult> { - return self - .hit_test_at_point_with_flags_and_pipeline(point, HitTestFlags::empty(), None) + self.hit_test_at_point_with_flags_and_pipeline(point, HitTestFlags::empty(), None) .first() - .cloned(); + .cloned() } fn hit_test_at_point_with_flags_and_pipeline( diff --git a/components/constellation/logging.rs b/components/constellation/logging.rs index f2ca53d1f44..a64b291a045 100644 --- a/components/constellation/logging.rs +++ b/components/constellation/logging.rs @@ -2,6 +2,10 @@ * 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/. */ +//! The constellation uses logging to perform crash reporting. +//! The constellation receives all `warn!`, `error!` and `panic!` messages, +//! and generates a crash report when it receives a panic. + use std::borrow::ToOwned; use std::sync::Arc; use std::thread; @@ -14,10 +18,6 @@ use log::{Level, LevelFilter, Log, Metadata, Record}; use parking_lot::ReentrantMutex; use script_traits::{LogEntry, ScriptMsg as FromScriptMsg, ScriptToConstellationChan}; -/// The constellation uses logging to perform crash reporting. -/// The constellation receives all `warn!`, `error!` and `panic!` messages, -/// and generates a crash report when it receives a panic. - /// A logger directed at the constellation from content processes /// #[derive(Clone)] pub struct FromScriptLogger { @@ -25,10 +25,6 @@ pub struct FromScriptLogger { pub script_to_constellation_chan: Arc<ReentrantMutex<ScriptToConstellationChan>>, } -/// The constellation uses logging to perform crash reporting. -/// The constellation receives all `warn!`, `error!` and `panic!` messages, -/// and generates a crash report when it receives a panic. - /// A logger directed at the constellation from content processes impl FromScriptLogger { /// Create a new constellation logger. diff --git a/components/constellation/sandboxing.rs b/components/constellation/sandboxing.rs index c7f4e55ae0e..ffb0d44d5cc 100644 --- a/components/constellation/sandboxing.rs +++ b/components/constellation/sandboxing.rs @@ -158,6 +158,8 @@ pub fn spawn_multiprocess(content: UnprivilegedContent) -> Result<(), Error> { let path_to_self = env::current_exe().expect("Failed to get current executor."); let mut child_process = process::Command::new(path_to_self); setup_common(&mut child_process, token); + + #[allow(clippy::zombie_processes)] let _ = child_process .spawn() .expect("Failed to start unsandboxed child process!"); @@ -180,7 +182,10 @@ pub fn spawn_multiprocess(content: UnprivilegedContent) -> Result<(), Error> { use gaol::sandbox::{self, Sandbox, SandboxMethods}; use ipc_channel::ipc::{IpcOneShotServer, IpcSender}; - impl CommandMethods for sandbox::Command { + // TODO: Move this impl out of the function. It is only currently here to avoid + // duplicating the feature flagging. + #[allow(non_local_definitions)] + impl CommandMethods for gaol::sandbox::Command { fn arg<T>(&mut self, arg: T) where T: AsRef<OsStr>, @@ -216,6 +221,8 @@ pub fn spawn_multiprocess(content: UnprivilegedContent) -> Result<(), Error> { let path_to_self = env::current_exe().expect("Failed to get current executor."); let mut child_process = process::Command::new(path_to_self); setup_common(&mut child_process, token); + + #[allow(clippy::zombie_processes)] let _ = child_process .spawn() .expect("Failed to start unsandboxed child process!"); diff --git a/components/domobject_derive/lib.rs b/components/domobject_derive/lib.rs index ac99c4fa16a..10225fb2302 100644 --- a/components/domobject_derive/lib.rs +++ b/components/domobject_derive/lib.rs @@ -35,7 +35,7 @@ fn expand_dom_object(input: syn::DeriveInput) -> proc_macro2::TokenStream { let name = &input.ident; let (impl_generics, ty_generics, where_clause) = input.generics.split_for_impl(); - let mut items = quote! { + let items = quote! { impl #impl_generics ::js::conversions::ToJSValConvertible for #name #ty_generics #where_clause { #[allow(unsafe_code)] unsafe fn to_jsval(&self, @@ -66,7 +66,15 @@ fn expand_dom_object(input: syn::DeriveInput) -> proc_macro2::TokenStream { crate::DomObject::reflector(self) == crate::DomObject::reflector(other) } } + }; + + let mut params = proc_macro2::TokenStream::new(); + params.append_separated( + input.generics.type_params().map(|param| ¶m.ident), + quote! {,}, + ); + let mut dummy_items = quote! { // Generic trait with a blanket impl over `()` for all types. // becomes ambiguous if impl trait NoDomObjectInDomObject<A> { @@ -83,13 +91,7 @@ fn expand_dom_object(input: syn::DeriveInput) -> proc_macro2::TokenStream { impl<T> NoDomObjectInDomObject<Invalid> for T where T: ?Sized + crate::DomObject {} }; - let mut params = proc_macro2::TokenStream::new(); - params.append_separated( - input.generics.type_params().map(|param| ¶m.ident), - quote! {,}, - ); - - items.append_all(field_types.iter().enumerate().map(|(i, ty)| { + dummy_items.append_all(field_types.iter().enumerate().map(|(i, ty)| { let s = syn::Ident::new(&format!("S{i}"), proc_macro2::Span::call_site()); quote! { struct #s<#params>(#params); @@ -111,7 +113,8 @@ fn expand_dom_object(input: syn::DeriveInput) -> proc_macro2::TokenStream { ); let tokens = quote! { #[allow(non_upper_case_globals)] - const #dummy_const: () = { #items }; + const #dummy_const: () = { #dummy_items }; + #items }; tokens diff --git a/components/fonts/glyph.rs b/components/fonts/glyph.rs index 8530bde66ac..84c0102c524 100644 --- a/components/fonts/glyph.rs +++ b/components/fonts/glyph.rs @@ -353,7 +353,7 @@ pub enum GlyphInfo<'a> { Detail(&'a GlyphStore, ByteIndex, u16), } -impl<'a> GlyphInfo<'a> { +impl GlyphInfo<'_> { pub fn id(self) -> GlyphId { match self { GlyphInfo::Simple(store, entry_i) => store.entry_buffer[entry_i.to_usize()].id(), diff --git a/components/hyper_serde/lib.rs b/components/hyper_serde/lib.rs index 58c54ae9f7c..3793fa0ce3e 100644 --- a/components/hyper_serde/lib.rs +++ b/components/hyper_serde/lib.rs @@ -62,6 +62,7 @@ #![deny(missing_docs)] #![deny(unsafe_code)] +#![allow(clippy::needless_lifetimes)] use std::ops::{Deref, DerefMut}; use std::str::FromStr; diff --git a/components/layout_2020/flow/mod.rs b/components/layout_2020/flow/mod.rs index 185143f425c..c9a1cfe55f1 100644 --- a/components/layout_2020/flow/mod.rs +++ b/components/layout_2020/flow/mod.rs @@ -1859,7 +1859,7 @@ impl<'container> PlacementState<'container> { fn new( collapsible_with_parent_start_margin: CollapsibleWithParentStartMargin, containing_block: &'container ContainingBlock<'container>, - ) -> PlacementState { + ) -> PlacementState<'container> { let is_inline_block_context = containing_block.style.get_box().clone_display() == Display::InlineBlock; PlacementState { diff --git a/components/layout_2020/lib.rs b/components/layout_2020/lib.rs index 1a84b6c94b4..bf38def9e28 100644 --- a/components/layout_2020/lib.rs +++ b/components/layout_2020/lib.rs @@ -3,6 +3,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ #![deny(unsafe_code)] +#![allow(clippy::needless_lifetimes)] mod cell; pub mod context; diff --git a/components/layout_2020/table/layout.rs b/components/layout_2020/table/layout.rs index 6c977795fe2..aed912cc412 100644 --- a/components/layout_2020/table/layout.rs +++ b/components/layout_2020/table/layout.rs @@ -218,7 +218,7 @@ impl Zero for CellOrTrackMeasure { } impl<'a> TableLayout<'a> { - fn new(table: &'a Table) -> TableLayout { + fn new(table: &'a Table) -> TableLayout<'a> { Self { table, pbm: PaddingBorderMargin::zero(), diff --git a/components/layout_2020/taffy/layout.rs b/components/layout_2020/taffy/layout.rs index 3cdf162899e..8dd5421a3c7 100644 --- a/components/layout_2020/taffy/layout.rs +++ b/components/layout_2020/taffy/layout.rs @@ -75,7 +75,10 @@ impl Iterator for ChildIter { } impl taffy::TraversePartialTree for TaffyContainerContext<'_> { - type ChildIter<'a> = ChildIter where Self: 'a; + type ChildIter<'a> + = ChildIter + where + Self: 'a; fn child_ids(&self, _node_id: taffy::NodeId) -> Self::ChildIter<'_> { ChildIter(0..self.source_child_nodes.len()) @@ -91,7 +94,10 @@ impl taffy::TraversePartialTree for TaffyContainerContext<'_> { } impl taffy::LayoutPartialTree for TaffyContainerContext<'_> { - type CoreContainerStyle<'a> = TaffyStyloStyle<&'a ComputedValues> where Self: 'a; + type CoreContainerStyle<'a> + = TaffyStyloStyle<&'a ComputedValues> + where + Self: 'a; fn get_core_container_style(&self, _node_id: taffy::NodeId) -> Self::CoreContainerStyle<'_> { TaffyStyloStyle(self.style) @@ -283,11 +289,13 @@ impl taffy::LayoutPartialTree for TaffyContainerContext<'_> { } impl taffy::LayoutGridContainer for TaffyContainerContext<'_> { - type GridContainerStyle<'a> = TaffyStyloStyle<&'a ComputedValues> + type GridContainerStyle<'a> + = TaffyStyloStyle<&'a ComputedValues> where Self: 'a; - type GridItemStyle<'a> = TaffyStyloStyle<AtomicRef<'a, ComputedValues>> + type GridItemStyle<'a> + = TaffyStyloStyle<AtomicRef<'a, ComputedValues>> where Self: 'a; diff --git a/components/malloc_size_of/lib.rs b/components/malloc_size_of/lib.rs index 297f93c3f69..94e49004e4b 100644 --- a/components/malloc_size_of/lib.rs +++ b/components/malloc_size_of/lib.rs @@ -160,7 +160,7 @@ impl MallocSizeOf for String { } } -impl<'a, T: ?Sized> MallocSizeOf for &'a T { +impl<T: ?Sized> MallocSizeOf for &'_ T { fn size_of(&self, _ops: &mut MallocSizeOfOps) -> usize { // Zero makes sense for a non-owning reference. 0 @@ -249,7 +249,7 @@ impl<T: MallocSizeOf> MallocSizeOf for std::cell::RefCell<T> { } } -impl<'a, B: ?Sized + ToOwned> MallocSizeOf for std::borrow::Cow<'a, B> +impl<B: ?Sized + ToOwned> MallocSizeOf for std::borrow::Cow<'_, B> where B::Owned: MallocSizeOf, { diff --git a/components/net/cookie.rs b/components/net/cookie.rs index 34d327673f3..3d2cf61fab3 100644 --- a/components/net/cookie.rs +++ b/components/net/cookie.rs @@ -206,6 +206,7 @@ impl ServoCookie { // 3. The cookie-attribute-list contains an attribute with an attribute-name of "Path", // and the cookie's path is /. + #[allow(clippy::nonminimal_bool)] if !has_path_specified || !cookie.path().is_some_and(|path| path == "/") { return None; } diff --git a/components/net/image_cache.rs b/components/net/image_cache.rs index 71e41ab59e2..e81b0026ece 100644 --- a/components/net/image_cache.rs +++ b/components/net/image_cache.rs @@ -25,15 +25,15 @@ use webrender_traits::{CrossProcessCompositorApi, SerializableImageData}; use crate::resource_thread::CoreResourceThreadPool; -/// -/// TODO(gw): Remaining work on image cache: -/// * Make use of the prefetch support in various parts of the code. -/// * Profile time in GetImageIfAvailable - might be worth caching these -/// results per paint / layout. -/// -/// MAYBE(Yoric): -/// * For faster lookups, it might be useful to store the LoadKey in the -/// DOM once we have performed a first load. +// +// TODO(gw): Remaining work on image cache: +// * Make use of the prefetch support in various parts of the code. +// * Profile time in GetImageIfAvailable - might be worth caching these +// results per paint / layout. +// +// MAYBE(Yoric): +// * For faster lookups, it might be useful to store the LoadKey in the +// DOM once we have performed a first load. // ====================================================================== // Helper functions. 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] diff --git a/components/webdriver_server/lib.rs b/components/webdriver_server/lib.rs index 2e64cc97396..f77628fb705 100644 --- a/components/webdriver_server/lib.rs +++ b/components/webdriver_server/lib.rs @@ -5,6 +5,7 @@ #![crate_name = "webdriver_server"] #![crate_type = "rlib"] #![deny(unsafe_code)] +#![allow(clippy::needless_lifetimes)] mod actions; mod capabilities; diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 0fe1f853c64..7c5c70ffa98 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,6 +1,6 @@ [toolchain] # Be sure to update shell.nix and support/crown/rust-toolchain.toml when bumping this! -channel = "1.82.0" +channel = "1.83.0" components = [ "clippy", diff --git a/shell.nix b/shell.nix index fe1efcb6aa7..5850584b437 100644 --- a/shell.nix +++ b/shell.nix @@ -10,7 +10,7 @@ with import (builtins.fetchTarball { overlays = [ (import (builtins.fetchTarball { # Bumped the channel in rust-toolchain.toml? Bump this commit too! - url = "https://github.com/oxalica/rust-overlay/archive/0be641045af6d8666c11c2c40e45ffc9667839b5.tar.gz"; + url = "https://github.com/oxalica/rust-overlay/archive/10faa81b4c0135a04716cbd1649260d82b2890cd.tar.gz"; })) ]; config = { diff --git a/support/crown/rust-toolchain.toml b/support/crown/rust-toolchain.toml index 46329873306..3911948d76c 100644 --- a/support/crown/rust-toolchain.toml +++ b/support/crown/rust-toolchain.toml @@ -1,5 +1,5 @@ [toolchain] -channel = "1.82.0" +channel = "1.83.0" components = [ "clippy", diff --git a/support/crown/src/common.rs b/support/crown/src/common.rs index 7899563bbeb..e36343061b2 100644 --- a/support/crown/src/common.rs +++ b/support/crown/src/common.rs @@ -99,14 +99,11 @@ fn find_primitive_impls<'tcx>(tcx: TyCtxt<'tcx>, name: &str) -> impl Iterator<It "f64" => SimplifiedType::Float(FloatTy::F64), #[allow(trivial_casts)] _ => { - return Result::<_, rustc_errors::ErrorGuaranteed>::Ok(&[] as &[_]) - .into_iter() - .flatten() - .copied(); + return [].iter().copied(); }, }; - tcx.incoherent_impls(ty).into_iter().flatten().copied() + tcx.incoherent_impls(ty).iter().copied() } fn non_local_item_children_by_name(tcx: TyCtxt<'_>, def_id: DefId, name: Symbol) -> Vec<Res> { @@ -235,7 +232,6 @@ pub fn def_path_res(cx: &LateContext<'_>, path: &[&str]) -> Vec<Res> { let inherent_impl_children = tcx .inherent_impls(def_id) .into_iter() - .flatten() .flat_map(|&impl_def_id| item_children_by_name(tcx, impl_def_id, segment)); let direct_children = item_children_by_name(tcx, def_id, segment); @@ -280,7 +276,6 @@ pub fn def_local_res(cx: &LateContext<'_>, path: &str) -> Vec<Res> { let inherent_impl_children = tcx .inherent_impls(def_id) .into_iter() - .flatten() .flat_map(|&impl_def_id| item_children_by_name(tcx, impl_def_id, segment)); let direct_children = item_children_by_name(tcx, def_id, segment); |