clippy: Fix dereferenced warnings (#31770)

This commit is contained in:
Oluwatobi Sofela 2024-03-20 09:07:22 +01:00 committed by GitHub
parent 0cf2caba06
commit 02a0cdd6fa
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
43 changed files with 92 additions and 96 deletions

View file

@ -1039,7 +1039,7 @@ impl CanvasState {
};
let node = canvas.upcast::<Node>();
let window = window_from_node(&*canvas);
let resolved_font_style = match window.resolved_font_style_query(&node, value.to_string()) {
let resolved_font_style = match window.resolved_font_style_query(node, value.to_string()) {
Some(value) => value,
None => return, // syntax error
};

View file

@ -810,12 +810,12 @@ impl HTMLInputElement {
match self.input_type() {
// https://html.spec.whatwg.org/multipage/#url-state-(type%3Durl)%3Asuffering-from-a-type-mismatch
InputType::Url => Url::parse(&value).is_err(),
InputType::Url => Url::parse(value).is_err(),
// https://html.spec.whatwg.org/multipage/#e-mail-state-(type%3Demail)%3Asuffering-from-a-type-mismatch
// https://html.spec.whatwg.org/multipage/#e-mail-state-(type%3Demail)%3Asuffering-from-a-type-mismatch-2
InputType::Email => {
if self.Multiple() {
!split_commas(&value).all(|s| {
!split_commas(value).all(|s| {
DOMString::from_string(s.to_string()).is_valid_email_address_string()
})
} else {
@ -843,10 +843,10 @@ impl HTMLInputElement {
if compile_pattern(cx, &pattern_str, pattern.handle_mut()) {
if self.Multiple() && self.does_multiple_apply() {
!split_commas(&value)
!split_commas(value)
.all(|s| matches_js_regex(cx, pattern.handle(), s).unwrap_or(true))
} else {
!matches_js_regex(cx, pattern.handle(), &value).unwrap_or(true)
!matches_js_regex(cx, pattern.handle(), value).unwrap_or(true)
}
} else {
// Element doesn't suffer from pattern mismatch if pattern is invalid.
@ -926,7 +926,7 @@ impl HTMLInputElement {
return ValidationFlags::empty();
}
let value_as_number = match self.convert_string_to_number(&value) {
let value_as_number = match self.convert_string_to_number(value) {
Ok(num) => num,
Err(()) => return ValidationFlags::empty(),
};
@ -1645,7 +1645,7 @@ fn radio_group_iter<'a>(
// If group is None, in_same_group always fails, but we need to always return elem.
root.traverse_preorder(ShadowIncluding::No)
.filter_map(|r| DomRoot::downcast::<HTMLInputElement>(r))
.filter(move |r| &**r == elem || in_same_group(&r, owner.as_deref(), group, None))
.filter(move |r| &**r == elem || in_same_group(r, owner.as_deref(), group, None))
}
fn broadcast_radio_checked(broadcaster: &HTMLInputElement, group: Option<&Atom>) {
@ -1740,7 +1740,7 @@ impl HTMLInputElement {
datums.push(FormDatum {
ty: ty.clone(),
name: name.clone(),
value: FormDatumValue::File(DomRoot::from_ref(&f)),
value: FormDatumValue::File(DomRoot::from_ref(f)),
});
}
},
@ -2068,7 +2068,7 @@ impl HTMLInputElement {
#[allow(crown::unrooted_must_root)]
fn selection(&self) -> TextControlSelection<Self> {
TextControlSelection::new(&self, &self.textinput)
TextControlSelection::new(self, &self.textinput)
}
// https://html.spec.whatwg.org/multipage/#implicit-submission
@ -2129,10 +2129,7 @@ impl HTMLInputElement {
// lazily test for > 1 submission-blocking inputs
return;
}
form.submit(
SubmittedFrom::NotFromForm,
FormSubmitter::FormElement(&form),
);
form.submit(SubmittedFrom::NotFromForm, FormSubmitter::FormElement(form));
},
}
}
@ -2607,7 +2604,7 @@ impl VirtualMethods for HTMLInputElement {
.task_manager()
.user_interaction_task_source()
.queue_event(
&self.upcast(),
self.upcast(),
atom!("input"),
EventBubbles::Bubbles,
EventCancelable::NotCancelable,
@ -2828,7 +2825,7 @@ impl Activatable for HTMLInputElement {
// Avoiding iterating through the whole tree here, instead
// we can check if the conditions for radio group siblings apply
if in_same_group(
&o,
o,
self.form_owner().as_deref(),
self.radio_group_name().as_ref(),
Some(&*tree_root),

View file

@ -308,7 +308,7 @@ impl HTMLLinkElement {
None => "",
};
let mut input = ParserInput::new(&mq_str);
let mut input = ParserInput::new(mq_str);
let mut css_parser = CssParser::new(&mut input);
let document_url_data = &UrlExtraData(document.url().get_arc());
let window = document.window();
@ -317,7 +317,7 @@ impl HTMLLinkElement {
// much sense.
let context = CssParserContext::new(
Origin::Author,
&document_url_data,
document_url_data,
Some(CssRuleType::Media),
ParsingMode::DEFAULT,
document.quirks_mode(),

View file

@ -1952,7 +1952,7 @@ impl HTMLMediaElement {
let global = self.global();
let media_session = global.as_window().Navigator().MediaSession();
media_session.register_media_instance(&self);
media_session.register_media_instance(self);
media_session.send_event(event);
}

View file

@ -300,7 +300,7 @@ impl ScriptOrigin {
pub fn text(&self) -> Rc<DOMString> {
match &self.code {
SourceCode::Text(text) => Rc::clone(&text),
SourceCode::Text(text) => Rc::clone(text),
SourceCode::Compiled(compiled_script) => Rc::clone(&compiled_script.original_text),
}
}
@ -319,11 +319,11 @@ fn finish_fetching_a_classic_script(
let document = document_from_node(&*elem);
match script_kind {
ExternalScriptKind::Asap => document.asap_script_loaded(&elem, load),
ExternalScriptKind::AsapInOrder => document.asap_in_order_script_loaded(&elem, load),
ExternalScriptKind::Deferred => document.deferred_script_loaded(&elem, load),
ExternalScriptKind::Asap => document.asap_script_loaded(elem, load),
ExternalScriptKind::AsapInOrder => document.asap_in_order_script_loaded(elem, load),
ExternalScriptKind::Deferred => document.deferred_script_loaded(elem, load),
ExternalScriptKind::ParsingBlocking => {
document.pending_parsing_blocking_script_loaded(&elem, load)
document.pending_parsing_blocking_script_loaded(elem, load)
},
}
@ -645,7 +645,7 @@ impl HTMLScriptElement {
// Step 15.
if !element.has_attribute(&local_name!("src")) &&
doc.should_elements_inline_type_behavior_be_blocked(
&element,
element,
csp::InlineCheckType::Script,
&text,
) == csp::CheckResult::Blocked
@ -1085,7 +1085,7 @@ impl HTMLScriptElement {
// Step 4
let window = window_from_node(self);
let global = window.upcast::<GlobalScope>();
let _aes = AutoEntryScript::new(&global);
let _aes = AutoEntryScript::new(global);
let tree = if script.external {
global.get_module_map().borrow().get(&script.url).cloned()
@ -1103,7 +1103,7 @@ impl HTMLScriptElement {
let module_error = module_tree.get_rethrow_error().borrow();
let network_error = module_tree.get_network_error().borrow();
if module_error.is_some() && network_error.is_none() {
module_tree.report_error(&global);
module_tree.report_error(global);
return;
}
}
@ -1117,11 +1117,11 @@ impl HTMLScriptElement {
if let Some(record) = record {
rooted!(in(*GlobalScope::get_cx()) let mut rval = UndefinedValue());
let evaluated =
module_tree.execute_module(&global, record, rval.handle_mut().into());
module_tree.execute_module(global, record, rval.handle_mut().into());
if let Err(exception) = evaluated {
module_tree.set_rethrow_error(exception);
module_tree.report_error(&global);
module_tree.report_error(global);
return;
}
}

View file

@ -456,7 +456,7 @@ impl HTMLTextAreaElement {
#[allow(crown::unrooted_must_root)]
fn selection(&self) -> TextControlSelection<Self> {
TextControlSelection::new(&self, &self.textinput)
TextControlSelection::new(self, &self.textinput)
}
}
@ -656,7 +656,7 @@ impl VirtualMethods for HTMLTextAreaElement {
.task_manager()
.user_interaction_task_source()
.queue_event(
&self.upcast(),
self.upcast(),
atom!("input"),
EventBubbles::Bubbles,
EventCancelable::NotCancelable,

View file

@ -45,7 +45,7 @@ impl HTMLTrackElement {
HTMLTrackElement {
htmlelement: HTMLElement::new_inherited(local_name, prefix, document),
ready_state: ReadyState::None,
track: Dom::from_ref(&track),
track: Dom::from_ref(track),
}
}
@ -56,7 +56,7 @@ impl HTMLTrackElement {
proto: Option<HandleObject>,
) -> DomRoot<HTMLTrackElement> {
let track = TextTrack::new(
&document.window(),
document.window(),
Default::default(),
Default::default(),
Default::default(),

View file

@ -148,7 +148,7 @@ impl HTMLVideoElement {
}
// Step 3.
let poster_url = match document_from_node(self).url().join(&poster_url) {
let poster_url = match document_from_node(self).url().join(poster_url) {
Ok(url) => url,
Err(_) => return,
};

View file

@ -65,7 +65,7 @@ impl MediaMetadata {
}
pub fn set_session(&self, session: &MediaSession) {
self.session.set(Some(&session));
self.session.set(Some(session));
}
}

View file

@ -133,7 +133,7 @@ impl MediaSessionMethods for MediaSession {
init.artist = DOMString::from_string(metadata.artist.clone());
init.album = DOMString::from_string(metadata.album.clone());
let global = self.global();
Some(MediaMetadata::new(&global.as_window(), &init))
Some(MediaMetadata::new(global.as_window(), &init))
} else {
None
}

View file

@ -154,7 +154,7 @@ impl MediaStream {
fn clone_with_proto(&self, proto: Option<HandleObject>) -> DomRoot<MediaStream> {
let new = MediaStream::new_with_proto(&self.global(), proto);
for track in &*self.tracks.borrow() {
new.add_track(&track)
new.add_track(track)
}
new
}

View file

@ -43,7 +43,7 @@ impl MediaStreamAudioDestinationNode {
);
let node = AudioNode::new_inherited(
AudioNodeInit::MediaStreamDestinationNode(socket),
&context.upcast(),
context.upcast(),
node_options,
1, // inputs
0, // outputs

View file

@ -39,14 +39,14 @@ impl MediaStreamAudioSourceNode {
.id();
let node = AudioNode::new_inherited(
AudioNodeInit::MediaStreamSourceNode(track),
&context.upcast(),
context.upcast(),
Default::default(),
0, // inputs
1, // outputs
)?;
Ok(MediaStreamAudioSourceNode {
node,
stream: Dom::from_ref(&stream),
stream: Dom::from_ref(stream),
})
}

View file

@ -30,14 +30,14 @@ impl MediaStreamTrackAudioSourceNode {
) -> Fallible<MediaStreamTrackAudioSourceNode> {
let node = AudioNode::new_inherited(
AudioNodeInit::MediaStreamSourceNode(track.id()),
&context.upcast(),
context.upcast(),
Default::default(),
0, // inputs
1, // outputs
)?;
Ok(MediaStreamTrackAudioSourceNode {
node,
track: Dom::from_ref(&track),
track: Dom::from_ref(track),
})
}

View file

@ -31,10 +31,10 @@ impl MessageChannel {
/// <https://html.spec.whatwg.org/multipage/#dom-messagechannel>
fn new(incumbent: &GlobalScope, proto: Option<HandleObject>) -> DomRoot<MessageChannel> {
// Step 1
let port1 = MessagePort::new(&incumbent);
let port1 = MessagePort::new(incumbent);
// Step 2
let port2 = MessagePort::new(&incumbent);
let port2 = MessagePort::new(incumbent);
incumbent.track_message_port(&*port1, None);
incumbent.track_message_port(&*port2, None);

View file

@ -214,8 +214,7 @@ impl NavigatorMethods for Navigator {
/// <https://immersive-web.github.io/webxr/#dom-navigator-xr>
fn Xr(&self) -> DomRoot<XRSystem> {
self.xr
.or_init(|| XRSystem::new(&self.global().as_window()))
self.xr.or_init(|| XRSystem::new(self.global().as_window()))
}
/// <https://w3c.github.io/mediacapture-main/#dom-navigator-mediadevices>

View file

@ -242,7 +242,7 @@ impl Node {
},
Some(ref prev_sibling) => {
prev_sibling.next_sibling.set(Some(new_child));
new_child.prev_sibling.set(Some(&prev_sibling));
new_child.prev_sibling.set(Some(prev_sibling));
},
}
before.prev_sibling.set(Some(new_child));
@ -255,7 +255,7 @@ impl Node {
Some(ref last_child) => {
assert!(last_child.next_sibling.get().is_none());
last_child.next_sibling.set(Some(new_child));
new_child.prev_sibling.set(Some(&last_child));
new_child.prev_sibling.set(Some(last_child));
},
}
@ -282,7 +282,7 @@ impl Node {
node.set_flag(NodeFlags::IS_CONNECTED, parent_is_connected);
// Out-of-document elements never have the descendants flag set.
debug_assert!(!node.get_flag(NodeFlags::HAS_DIRTY_DESCENDANTS));
vtable_for(&&*node).bind_to_tree(&BindContext {
vtable_for(&*node).bind_to_tree(&BindContext {
tree_connected: parent_is_connected,
tree_in_doc: parent_in_doc,
});
@ -313,7 +313,7 @@ impl Node {
// This needs to be in its own loop, because unbind_from_tree may
// rely on the state of IS_IN_DOC of the context node's descendants,
// e.g. when removing a <form>.
vtable_for(&&*node).unbind_from_tree(&context);
vtable_for(&*node).unbind_from_tree(context);
// https://dom.spec.whatwg.org/#concept-node-remove step 14
if let Some(element) = node.as_custom_element() {
ScriptThread::enqueue_callback_reaction(
@ -2046,7 +2046,7 @@ impl Node {
Node::remove(kid, node, SuppressObserver::Suppressed);
}
// Step 5.
vtable_for(&node).children_changed(&ChildrenMutation::replace_all(new_nodes.r(), &[]));
vtable_for(node).children_changed(&ChildrenMutation::replace_all(new_nodes.r(), &[]));
let mutation = Mutation::ChildList {
added: None,
@ -2054,7 +2054,7 @@ impl Node {
prev: None,
next: None,
};
MutationObserver::queue_a_mutation_record(&node, mutation);
MutationObserver::queue_a_mutation_record(node, mutation);
new_nodes.r()
} else {
@ -2772,7 +2772,7 @@ impl NodeMethods for Node {
next: reference_child,
};
MutationObserver::queue_a_mutation_record(&self, mutation);
MutationObserver::queue_a_mutation_record(self, mutation);
// Step 15.
Ok(DomRoot::from_ref(child))
@ -2958,7 +2958,7 @@ impl NodeMethods for Node {
attr1 = Some(a);
attr1owner = a.GetOwnerElement();
node1 = match attr1owner {
Some(ref e) => Some(&e.upcast()),
Some(ref e) => Some(e.upcast()),
None => None,
}
}
@ -3468,7 +3468,7 @@ impl UniqueId {
if (*ptr).is_none() {
*ptr = Some(Box::new(Uuid::new_v4()));
}
&(&*ptr).as_ref().unwrap()
(&*ptr).as_ref().unwrap()
}
}
}

View file

@ -180,7 +180,7 @@ impl OfflineAudioContextMethods for OfflineAudioContext {
processed_audio.resize(this.length as usize, Vec::new())
}
let buffer = AudioBuffer::new(
&this.global().as_window(),
this.global().as_window(),
this.channel_count,
this.length,
*this.context.SampleRate(),
@ -188,7 +188,7 @@ impl OfflineAudioContextMethods for OfflineAudioContext {
(*this.pending_rendering_promise.borrow_mut()).take().unwrap().resolve_native(&buffer);
let global = &this.global();
let window = global.as_window();
let event = OfflineAudioCompletionEvent::new(&window,
let event = OfflineAudioCompletionEvent::new(window,
atom!("complete"),
EventBubbles::DoesNotBubble,
EventCancelable::NotCancelable,

View file

@ -469,7 +469,7 @@ impl PerformanceMethods for Performance {
// Steps 2 to 6.
let entry = PerformanceMark::new(&global, mark_name, self.now(), 0.);
// Steps 7 and 8.
self.queue_entry(&entry.upcast::<PerformanceEntry>());
self.queue_entry(entry.upcast::<PerformanceEntry>());
// Step 9.
Ok(())
@ -516,7 +516,7 @@ impl PerformanceMethods for Performance {
);
// Step 9 and 10.
self.queue_entry(&entry.upcast::<PerformanceEntry>());
self.queue_entry(entry.upcast::<PerformanceEntry>());
// Step 11.
Ok(())

View file

@ -200,7 +200,7 @@ impl Range {
}
if &self.start.node != node {
if self.start.node == self.end.node {
node.ranges().push(WeakRef::new(&self));
node.ranges().push(WeakRef::new(self));
} else if &self.end.node == node {
self.StartContainer().ranges().remove(self);
} else {
@ -218,7 +218,7 @@ impl Range {
}
if &self.end.node != node {
if self.end.node == self.start.node {
node.ranges().push(WeakRef::new(&self));
node.ranges().push(WeakRef::new(self));
} else if &self.start.node == node {
self.EndContainer().ranges().remove(self);
} else {

View file

@ -103,7 +103,7 @@ impl ReadableStream {
/// Build a stream backed by a Rust source that has already been read into memory.
pub fn new_from_bytes(global: &GlobalScope, bytes: Vec<u8>) -> DomRoot<ReadableStream> {
let stream = ReadableStream::new_with_external_underlying_source(
&global,
global,
ExternalUnderlyingSource::Memory(bytes.len()),
);
stream.enqueue_native(bytes);
@ -123,7 +123,7 @@ impl ReadableStream {
let source = Rc::new(ExternalUnderlyingSourceController::new(source));
let stream = ReadableStream::new(&global, Some(source.clone()));
let stream = ReadableStream::new(global, Some(source.clone()));
unsafe {
let js_wrapper = CreateReadableStreamUnderlyingSource(

View file

@ -86,7 +86,7 @@ impl Request {
// Step 5
RequestInfo::USVString(USVString(ref usv_string)) => {
// Step 5.1
let parsed_url = base_url.join(&usv_string);
let parsed_url = base_url.join(usv_string);
// Step 5.2
if parsed_url.is_err() {
return Err(Error::Type("Url could not be parsed".to_string()));
@ -266,11 +266,11 @@ impl Request {
// Step 25.1
if let Some(init_method) = init.method.as_ref() {
if !is_method(&init_method) {
if !is_method(init_method) {
return Err(Error::Type("Method is not a method".to_string()));
}
// Step 25.2
if is_forbidden_method(&init_method) {
if is_forbidden_method(init_method) {
return Err(Error::Type("Method is forbidden".to_string()));
}
// Step 25.3

View file

@ -155,7 +155,7 @@ impl Response {
} else {
// Reset FetchResponse to an in-memory stream with empty byte sequence here for
// no-init-body case
let stream = ReadableStream::new_from_bytes(&global, Vec::with_capacity(0));
let stream = ReadableStream::new_from_bytes(global, Vec::with_capacity(0));
r.body_stream.set(Some(&*stream));
}

View file

@ -75,7 +75,7 @@ impl RTCDataChannel {
let channel = RTCDataChannel {
eventtarget: EventTarget::new_inherited(),
servo_media_id,
peer_connection: Dom::from_ref(&peer_connection),
peer_connection: Dom::from_ref(peer_connection),
label,
ordered: options.ordered,
max_packet_life_time: options.maxPacketLifeTime,

View file

@ -52,7 +52,7 @@ impl RTCDataChannelEvent {
channel: &RTCDataChannel,
) -> DomRoot<RTCDataChannelEvent> {
let event = reflect_dom_object_with_proto(
Box::new(RTCDataChannelEvent::new_inherited(&channel)),
Box::new(RTCDataChannelEvent::new_inherited(channel)),
global,
proto,
);

View file

@ -52,7 +52,7 @@ impl RTCErrorEvent {
error: &RTCError,
) -> DomRoot<RTCErrorEvent> {
let event = reflect_dom_object_with_proto(
Box::new(RTCErrorEvent::new_inherited(&error)),
Box::new(RTCErrorEvent::new_inherited(error)),
global,
proto,
);

View file

@ -307,7 +307,7 @@ impl RTCPeerConnection {
DataChannelEvent::NewChannel => {
let channel = RTCDataChannel::new(
&self.global(),
&self,
self,
USVString::from("".to_owned()),
&RTCDataChannelInit::empty(),
Some(channel_id),
@ -357,7 +357,7 @@ impl RTCPeerConnection {
}
pub fn unregister_data_channel(&self, id: &DataChannelId) {
self.data_channels.borrow_mut().remove(&id);
self.data_channels.borrow_mut().remove(id);
}
/// <https://www.w3.org/TR/webrtc/#update-ice-gathering-state>
@ -648,7 +648,7 @@ impl RTCPeerConnectionMethods for RTCPeerConnection {
let this = this.root();
let desc = desc.into();
let desc = RTCSessionDescription::Constructor(
&this.global().as_window(),
this.global().as_window(),
None,
&desc,
).unwrap();
@ -688,7 +688,7 @@ impl RTCPeerConnectionMethods for RTCPeerConnection {
let this = this.root();
let desc = desc.into();
let desc = RTCSessionDescription::Constructor(
&this.global().as_window(),
this.global().as_window(),
None,
&desc,
).unwrap();
@ -764,7 +764,7 @@ impl RTCPeerConnectionMethods for RTCPeerConnection {
label: USVString,
init: &RTCDataChannelInit,
) -> DomRoot<RTCDataChannel> {
RTCDataChannel::new(&self.global(), &self, label, init, None)
RTCDataChannel::new(&self.global(), self, label, init, None)
}
/// <https://w3c.github.io/webrtc-pc/#dom-rtcpeerconnection-addtransceiver>

View file

@ -52,7 +52,7 @@ impl RTCTrackEvent {
track: &MediaStreamTrack,
) -> DomRoot<RTCTrackEvent> {
let trackevent = reflect_dom_object_with_proto(
Box::new(RTCTrackEvent::new_inherited(&track)),
Box::new(RTCTrackEvent::new_inherited(track)),
global,
proto,
);

View file

@ -27,7 +27,7 @@ impl Screen {
fn new_inherited(window: &Window) -> Screen {
Screen {
reflector_: Reflector::new(),
window: Dom::from_ref(&window),
window: Dom::from_ref(window),
}
}

View file

@ -47,7 +47,7 @@ impl ServiceWorkerContainer {
#[allow(crown::unrooted_must_root)]
pub fn new(global: &GlobalScope) -> DomRoot<ServiceWorkerContainer> {
let client = Client::new(&global.as_window());
let client = Client::new(global.as_window());
let container = ServiceWorkerContainer::new_inherited(&*client);
reflect_dom_object(Box::new(container), global)
}

View file

@ -70,7 +70,7 @@ impl QueuedTaskConversion for ServiceWorkerScriptMsg {
};
match script_msg {
CommonScriptMsg::Task(_category, _boxed, _pipeline_id, task_source) => {
Some(&task_source)
Some(task_source)
},
_ => None,
}

View file

@ -119,7 +119,7 @@ impl ServiceWorkerRegistration {
let worker_id = WorkerId(Uuid::new_v4());
let devtools_chan = global.devtools_chan().cloned();
let init = prepare_workerscope_init(&global, None, None);
let init = prepare_workerscope_init(global, None, None);
ScopeThings {
script_url: script_url,
init: init,
@ -197,6 +197,6 @@ impl ServiceWorkerRegistrationMethods for ServiceWorkerRegistration {
// https://w3c.github.io/ServiceWorker/#service-worker-registration-navigationpreload
fn NavigationPreload(&self) -> DomRoot<NavigationPreloadManager> {
self.navigation_preload
.or_init(|| NavigationPreloadManager::new(&self.global(), &self))
.or_init(|| NavigationPreloadManager::new(&self.global(), self))
}
}

View file

@ -433,7 +433,7 @@ impl Tokenizer {
},
ParseOperation::CreateComment { text, node } => {
let comment = Comment::new(DOMString::from(text), document, None);
self.insert_node(node, Dom::from_ref(&comment.upcast()));
self.insert_node(node, Dom::from_ref(comment.upcast()));
},
ParseOperation::AppendBeforeSibling { sibling, node } => {
self.append_before_sibling(sibling, node);

View file

@ -228,13 +228,13 @@ impl<'a> Serialize for &'a Node {
},
SerializationCommand::CloseElement(n) => {
end_element(&&n, serializer)?;
end_element(&n, serializer)?;
},
SerializationCommand::SerializeNonelement(n) => match n.type_id() {
NodeTypeId::DocumentType => {
let doctype = n.downcast::<DocumentType>().unwrap();
serializer.write_doctype(&doctype.name())?;
serializer.write_doctype(doctype.name())?;
},
NodeTypeId::CharacterData(CharacterDataTypeId::Text(_)) => {
@ -250,7 +250,7 @@ impl<'a> Serialize for &'a Node {
NodeTypeId::CharacterData(CharacterDataTypeId::ProcessingInstruction) => {
let pi = n.downcast::<ProcessingInstruction>().unwrap();
let data = pi.upcast::<CharacterData>().data();
serializer.write_processing_instruction(&pi.target(), &data)?;
serializer.write_processing_instruction(pi.target(), &data)?;
},
NodeTypeId::DocumentFragment(_) => {},

View file

@ -656,7 +656,7 @@ impl WorkletThread {
let script = load_whole_resource(
request,
&resource_fetcher,
&global_scope.upcast::<GlobalScope>(),
global_scope.upcast::<GlobalScope>(),
)
.ok()
.and_then(|(_, bytes)| String::from_utf8(bytes).ok());

View file

@ -100,7 +100,7 @@ impl XRInputSourceMethods for XRInputSource {
fn TargetRaySpace(&self) -> DomRoot<XRSpace> {
self.target_ray_space.or_init(|| {
let global = self.global();
XRSpace::new_inputspace(&global, &self.session, &self, false)
XRSpace::new_inputspace(&global, &self.session, self, false)
})
}

View file

@ -542,7 +542,7 @@ impl XRSession {
match event {
FrameUpdateEvent::HitTestSourceAdded(id) => {
if let Some(promise) = self.pending_hit_test_promises.borrow_mut().remove(&id) {
promise.resolve_native(&XRHitTestSource::new(&self.global(), id, &self));
promise.resolve_native(&XRHitTestSource::new(&self.global(), id, self));
} else {
warn!(
"received hit test add request for unknown hit test {:?}",

View file

@ -84,7 +84,7 @@ impl XRTestMethods for XRTest {
};
let floor_origin = if let Some(ref o) = init.floorOrigin {
match get_origin(&o) {
match get_origin(o) {
Ok(origin) => Some(origin),
Err(e) => {
p.reject_error(e);

View file

@ -346,7 +346,7 @@ pub fn load_whole_resource(
FetchResponseMsg::ProcessResponseEOF(Ok(_)) => {
let metadata = metadata.unwrap();
if let Some(timing) = &metadata.timing {
submit_timing_data(global, url, InitiatorType::Other, &timing);
submit_timing_data(global, url, InitiatorType::Other, timing);
}
return Ok((metadata, buf));
},

View file

@ -59,7 +59,7 @@ impl<'dom, LayoutDataType: LayoutDataTrait> ::style::dom::TShadowRoot
where
Self: 'a,
{
Some(&self.shadow_root.get_style_data_for_layout())
Some(self.shadow_root.get_style_data_for_layout())
}
}

View file

@ -79,7 +79,7 @@ use crate::task_source::TaskSourceName;
#[allow(unsafe_code)]
unsafe fn gen_type_error(global: &GlobalScope, string: String) -> RethrowError {
rooted!(in(*GlobalScope::get_cx()) let mut thrown = UndefinedValue());
Error::Type(string).to_jsval(*GlobalScope::get_cx(), &global, thrown.handle_mut());
Error::Type(string).to_jsval(*GlobalScope::get_cx(), global, thrown.handle_mut());
return RethrowError(RootedTraceableBox::from_box(Heap::boxed(thrown.get())));
}
@ -329,7 +329,7 @@ impl ModuleTree {
let module_map = global.get_module_map().borrow();
let mut discovered_urls = HashSet::new();
ModuleTree::recursive_check_descendants(&self, &module_map.0, &mut discovered_urls)
ModuleTree::recursive_check_descendants(self, &module_map.0, &mut discovered_urls)
}
// We just leverage the power of Promise to run the task for `finish` the owner.

View file

@ -3747,7 +3747,7 @@ impl ScriptThread {
global_scope.evaluate_js_on_global_with_result(
&script_source,
jsval.handle_mut(),
ScriptFetchOptions::default_classic_script(&global_scope),
ScriptFetchOptions::default_classic_script(global_scope),
global_scope.api_base_url(),
);
@ -3803,7 +3803,7 @@ impl ScriptThread {
DOMString::from("resize"),
EventBubbles::DoesNotBubble,
EventCancelable::NotCancelable,
Some(&window),
Some(window),
0i32,
);
uievent.upcast::<Event>().fire(window.upcast());

View file

@ -461,7 +461,7 @@ pub fn handle_find_element_link_text(
.find_document(pipeline)
.ok_or(ErrorStatus::UnknownError)
.and_then(|document| {
first_matching_link(&document.upcast::<Node>(), selector.clone(), partial)
first_matching_link(document.upcast::<Node>(), selector.clone(), partial)
}),
)
.unwrap();
@ -528,7 +528,7 @@ pub fn handle_find_elements_link_text(
.find_document(pipeline)
.ok_or(ErrorStatus::UnknownError)
.and_then(|document| {
all_matching_links(&document.upcast::<Node>(), selector.clone(), partial)
all_matching_links(document.upcast::<Node>(), selector.clone(), partial)
}),
)
.unwrap();