mirror of
https://github.com/servo/servo.git
synced 2025-08-02 04:00:32 +01:00
Remove redundant .clone()
s
This commit is contained in:
parent
eeaca0b26d
commit
c44a2febe6
19 changed files with 31 additions and 35 deletions
|
@ -765,7 +765,7 @@ where
|
||||||
self.event_loops.get(&host).and_then(|weak| weak.upgrade());
|
self.event_loops.get(&host).and_then(|weak| weak.upgrade());
|
||||||
match event_loop {
|
match event_loop {
|
||||||
None => (None, Some(host)),
|
None => (None, Some(host)),
|
||||||
Some(event_loop) => (Some(event_loop.clone()), None),
|
Some(event_loop) => (Some(event_loop), None),
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -1238,7 +1238,7 @@ where
|
||||||
},
|
},
|
||||||
None => "".to_owned(),
|
None => "".to_owned(),
|
||||||
};
|
};
|
||||||
if let Err(e) = sender.send(contents.to_owned()) {
|
if let Err(e) = sender.send(contents) {
|
||||||
warn!("Failed to send clipboard ({})", e);
|
warn!("Failed to send clipboard ({})", e);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -1635,7 +1635,7 @@ where
|
||||||
None,
|
None,
|
||||||
opener,
|
opener,
|
||||||
window_size,
|
window_size,
|
||||||
load_data.clone(),
|
load_data,
|
||||||
sandbox,
|
sandbox,
|
||||||
is_private,
|
is_private,
|
||||||
is_visible.unwrap_or(true),
|
is_visible.unwrap_or(true),
|
||||||
|
@ -1716,7 +1716,7 @@ where
|
||||||
);
|
);
|
||||||
self.embedder_proxy.send(msg);
|
self.embedder_proxy.send(msg);
|
||||||
let browsing_context_id = BrowsingContextId::from(top_level_browsing_context_id);
|
let browsing_context_id = BrowsingContextId::from(top_level_browsing_context_id);
|
||||||
let load_data = LoadData::new(url.clone(), None, None, None);
|
let load_data = LoadData::new(url, None, None, None);
|
||||||
let sandbox = IFrameSandboxState::IFrameUnsandboxed;
|
let sandbox = IFrameSandboxState::IFrameUnsandboxed;
|
||||||
let is_private = false;
|
let is_private = false;
|
||||||
let is_visible = true;
|
let is_visible = true;
|
||||||
|
@ -1738,7 +1738,7 @@ where
|
||||||
None,
|
None,
|
||||||
None,
|
None,
|
||||||
Some(window_size),
|
Some(window_size),
|
||||||
load_data.clone(),
|
load_data,
|
||||||
sandbox,
|
sandbox,
|
||||||
is_private,
|
is_private,
|
||||||
is_visible,
|
is_visible,
|
||||||
|
@ -1909,7 +1909,7 @@ where
|
||||||
Some(parent_pipeline_id),
|
Some(parent_pipeline_id),
|
||||||
None,
|
None,
|
||||||
browsing_context.size,
|
browsing_context.size,
|
||||||
load_data.clone(),
|
load_data,
|
||||||
load_info.sandbox,
|
load_info.sandbox,
|
||||||
is_private,
|
is_private,
|
||||||
browsing_context.is_visible,
|
browsing_context.is_visible,
|
||||||
|
@ -2235,7 +2235,7 @@ where
|
||||||
None,
|
None,
|
||||||
opener,
|
opener,
|
||||||
window_size,
|
window_size,
|
||||||
load_data.clone(),
|
load_data,
|
||||||
sandbox,
|
sandbox,
|
||||||
is_private,
|
is_private,
|
||||||
is_visible,
|
is_visible,
|
||||||
|
@ -2555,7 +2555,7 @@ where
|
||||||
top_level_browsing_context_id: top_level_id,
|
top_level_browsing_context_id: top_level_id,
|
||||||
browsing_context_id: browsing_context_id,
|
browsing_context_id: browsing_context_id,
|
||||||
new_pipeline_id: new_pipeline_id,
|
new_pipeline_id: new_pipeline_id,
|
||||||
replace: Some(NeedsToReload::Yes(pipeline_id, load_data.clone())),
|
replace: Some(NeedsToReload::Yes(pipeline_id, load_data)),
|
||||||
// Browsing context must exist at this point.
|
// Browsing context must exist at this point.
|
||||||
new_browsing_context_info: None,
|
new_browsing_context_info: None,
|
||||||
});
|
});
|
||||||
|
@ -3190,7 +3190,7 @@ where
|
||||||
.future
|
.future
|
||||||
.iter()
|
.iter()
|
||||||
.rev()
|
.rev()
|
||||||
.scan(current_load_data.clone(), &resolve_load_data_future),
|
.scan(current_load_data, &resolve_load_data_future),
|
||||||
);
|
);
|
||||||
let urls = entries.iter().map(|entry| entry.url.clone()).collect();
|
let urls = entries.iter().map(|entry| entry.url.clone()).collect();
|
||||||
let msg = (
|
let msg = (
|
||||||
|
|
|
@ -129,7 +129,7 @@ impl NetworkListener {
|
||||||
_ => {
|
_ => {
|
||||||
// Response should be processed by script thread.
|
// Response should be processed by script thread.
|
||||||
self.should_send = true;
|
self.should_send = true;
|
||||||
self.send(FetchResponseMsg::ProcessResponse(Ok(res_metadata.clone())));
|
self.send(FetchResponseMsg::ProcessResponse(Ok(res_metadata)));
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
|
@ -219,9 +219,7 @@ impl Pipeline {
|
||||||
load_data: state.load_data.clone(),
|
load_data: state.load_data.clone(),
|
||||||
window_size: window_size,
|
window_size: window_size,
|
||||||
pipeline_port: pipeline_port,
|
pipeline_port: pipeline_port,
|
||||||
content_process_shutdown_chan: Some(
|
content_process_shutdown_chan: Some(layout_content_process_shutdown_chan),
|
||||||
layout_content_process_shutdown_chan.clone(),
|
|
||||||
),
|
|
||||||
layout_threads: PREFS.get("layout.threads").as_u64().expect("count") as usize,
|
layout_threads: PREFS.get("layout.threads").as_u64().expect("count") as usize,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -552,7 +550,7 @@ impl UnprivilegedPipelineContent {
|
||||||
background_hang_monitor_register,
|
background_hang_monitor_register,
|
||||||
self.layout_to_constellation_chan,
|
self.layout_to_constellation_chan,
|
||||||
self.script_chan,
|
self.script_chan,
|
||||||
image_cache.clone(),
|
image_cache,
|
||||||
self.font_cache_thread,
|
self.font_cache_thread,
|
||||||
self.time_profiler_chan,
|
self.time_profiler_chan,
|
||||||
self.mem_profiler_chan,
|
self.mem_profiler_chan,
|
||||||
|
|
|
@ -552,7 +552,7 @@ impl Actor for PageStyleActor {
|
||||||
m.insert("bottom".to_owned(), auto.clone());
|
m.insert("bottom".to_owned(), auto.clone());
|
||||||
}
|
}
|
||||||
if autoMargins.left {
|
if autoMargins.left {
|
||||||
m.insert("left".to_owned(), auto.clone());
|
m.insert("left".to_owned(), auto);
|
||||||
}
|
}
|
||||||
serde_json::value::Value::Object(m)
|
serde_json::value::Value::Object(m)
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -358,7 +358,7 @@ impl NetworkEventActor {
|
||||||
let status_text = String::from_utf8_lossy(st).into_owned();
|
let status_text = String::from_utf8_lossy(st).into_owned();
|
||||||
(StatusCode::from_u16(s).unwrap(), status_text)
|
(StatusCode::from_u16(s).unwrap(), status_text)
|
||||||
});
|
});
|
||||||
self.response.body = response.body.clone();
|
self.response.body = response.body;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn event_actor(&self) -> EventActor {
|
pub fn event_actor(&self) -> EventActor {
|
||||||
|
|
|
@ -404,7 +404,7 @@ fn run_server(
|
||||||
None => return,
|
None => return,
|
||||||
};
|
};
|
||||||
let netevent_actor_name =
|
let netevent_actor_name =
|
||||||
find_network_event_actor(actors.clone(), actor_requests, request_id.clone());
|
find_network_event_actor(actors.clone(), actor_requests, request_id);
|
||||||
let mut actors = actors.lock().unwrap();
|
let mut actors = actors.lock().unwrap();
|
||||||
let actor = actors.find_mut::<NetworkEventActor>(&netevent_actor_name);
|
let actor = actors.find_mut::<NetworkEventActor>(&netevent_actor_name);
|
||||||
|
|
||||||
|
@ -499,7 +499,7 @@ fn run_server(
|
||||||
}
|
}
|
||||||
|
|
||||||
let msg = NetworkEventUpdateMsg {
|
let msg = NetworkEventUpdateMsg {
|
||||||
from: netevent_actor_name.clone(),
|
from: netevent_actor_name,
|
||||||
type_: "networkEventUpdate".to_owned(),
|
type_: "networkEventUpdate".to_owned(),
|
||||||
updateType: "responseHeaders".to_owned(),
|
updateType: "responseHeaders".to_owned(),
|
||||||
};
|
};
|
||||||
|
@ -533,14 +533,13 @@ fn run_server(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let sender_clone = sender.clone();
|
|
||||||
thread::Builder::new()
|
thread::Builder::new()
|
||||||
.name("DevtoolsClientAcceptor".to_owned())
|
.name("DevtoolsClientAcceptor".to_owned())
|
||||||
.spawn(move || {
|
.spawn(move || {
|
||||||
// accept connections and process them, spawning a new thread for each one
|
// accept connections and process them, spawning a new thread for each one
|
||||||
for stream in listener.incoming() {
|
for stream in listener.incoming() {
|
||||||
// connection succeeded
|
// connection succeeded
|
||||||
sender_clone
|
sender
|
||||||
.send(DevtoolsControlMsg::FromChrome(
|
.send(DevtoolsControlMsg::FromChrome(
|
||||||
ChromeToDevtoolsControlMsg::AddClient(stream.unwrap()),
|
ChromeToDevtoolsControlMsg::AddClient(stream.unwrap()),
|
||||||
))
|
))
|
||||||
|
|
|
@ -405,7 +405,7 @@ impl FontCache {
|
||||||
match (template.bytes_if_in_memory(), template.native_font()) {
|
match (template.bytes_if_in_memory(), template.native_font()) {
|
||||||
(Some(bytes), _) => txn.add_raw_font(font_key, bytes, 0),
|
(Some(bytes), _) => txn.add_raw_font(font_key, bytes, 0),
|
||||||
(None, Some(native_font)) => txn.add_native_font(font_key, native_font),
|
(None, Some(native_font)) => txn.add_native_font(font_key, native_font),
|
||||||
(None, None) => txn.add_raw_font(font_key, template.bytes().clone(), 0),
|
(None, None) => txn.add_raw_font(font_key, template.bytes(), 0),
|
||||||
}
|
}
|
||||||
webrender_api.update_resources(txn.resource_updates);
|
webrender_api.update_resources(txn.resource_updates);
|
||||||
font_key
|
font_key
|
||||||
|
|
|
@ -195,7 +195,7 @@ impl<S: FontSource> FontContext<S> {
|
||||||
.get_font_instance(info.font_key, actual_pt_size);
|
.get_font_instance(info.font_key, actual_pt_size);
|
||||||
Ok(Font::new(
|
Ok(Font::new(
|
||||||
handle,
|
handle,
|
||||||
descriptor.to_owned(),
|
descriptor,
|
||||||
actual_pt_size,
|
actual_pt_size,
|
||||||
font_instance_key,
|
font_instance_key,
|
||||||
))
|
))
|
||||||
|
|
|
@ -143,7 +143,7 @@ impl FontHandleMethods for FontHandle {
|
||||||
|
|
||||||
let mut handle = FontHandle {
|
let mut handle = FontHandle {
|
||||||
face: face,
|
face: face,
|
||||||
font_data: template.clone(),
|
font_data: template,
|
||||||
handle: fctx.clone(),
|
handle: fctx.clone(),
|
||||||
can_do_fast_shaping: false,
|
can_do_fast_shaping: false,
|
||||||
};
|
};
|
||||||
|
|
|
@ -1257,7 +1257,7 @@ impl BlockFlow {
|
||||||
self.fragment.inline_start_offset(),
|
self.fragment.inline_start_offset(),
|
||||||
Au(0),
|
Au(0),
|
||||||
));
|
));
|
||||||
self.base.floats = floats.clone();
|
self.base.floats = floats;
|
||||||
self.adjust_fragments_for_collapsed_margins_if_root(layout_context.shared_context());
|
self.adjust_fragments_for_collapsed_margins_if_root(layout_context.shared_context());
|
||||||
} else {
|
} else {
|
||||||
// We don't need to reflow, but we still need to perform in-order traversals if
|
// We don't need to reflow, but we still need to perform in-order traversals if
|
||||||
|
|
|
@ -2288,7 +2288,7 @@ impl FragmentDisplayListBuilding for Fragment {
|
||||||
// Pop all the PushTextShadows
|
// Pop all the PushTextShadows
|
||||||
if !text_shadows.is_empty() {
|
if !text_shadows.is_empty() {
|
||||||
state.add_display_item(DisplayItem::PopAllTextShadows(Box::new(
|
state.add_display_item(DisplayItem::PopAllTextShadows(Box::new(
|
||||||
PopAllTextShadowsDisplayItem { base: base.clone() },
|
PopAllTextShadowsDisplayItem { base },
|
||||||
)));
|
)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1660,7 +1660,7 @@ impl Flow for InlineFlow {
|
||||||
None => Au(0),
|
None => Au(0),
|
||||||
};
|
};
|
||||||
|
|
||||||
self.base.floats = scanner.floats.clone();
|
self.base.floats = scanner.floats;
|
||||||
let writing_mode = self.base.floats.writing_mode;
|
let writing_mode = self.base.floats.writing_mode;
|
||||||
self.base.floats.translate(LogicalSize::new(
|
self.base.floats.translate(LogicalSize::new(
|
||||||
writing_mode,
|
writing_mode,
|
||||||
|
|
|
@ -191,7 +191,7 @@ pub fn main_fetch(
|
||||||
},
|
},
|
||||||
Referrer::ReferrerUrl(url) => {
|
Referrer::ReferrerUrl(url) => {
|
||||||
request.headers.remove(header::REFERER);
|
request.headers.remove(header::REFERER);
|
||||||
let current_url = request.current_url().clone();
|
let current_url = request.current_url();
|
||||||
determine_request_referrer(
|
determine_request_referrer(
|
||||||
&mut request.headers,
|
&mut request.headers,
|
||||||
request.referrer_policy.unwrap(),
|
request.referrer_policy.unwrap(),
|
||||||
|
|
|
@ -681,7 +681,7 @@ impl FileManagerStore {
|
||||||
self.insert(
|
self.insert(
|
||||||
id,
|
id,
|
||||||
FileStoreEntry {
|
FileStoreEntry {
|
||||||
origin: origin.clone(),
|
origin,
|
||||||
file_impl: FileImpl::Memory(blob_buf),
|
file_impl: FileImpl::Memory(blob_buf),
|
||||||
refs: AtomicUsize::new(1),
|
refs: AtomicUsize::new(1),
|
||||||
is_valid_url: AtomicBool::new(set_valid),
|
is_valid_url: AtomicBool::new(set_valid),
|
||||||
|
|
|
@ -40,7 +40,7 @@ pub struct CacheKey {
|
||||||
impl CacheKey {
|
impl CacheKey {
|
||||||
fn new(request: Request) -> CacheKey {
|
fn new(request: Request) -> CacheKey {
|
||||||
CacheKey {
|
CacheKey {
|
||||||
url: request.current_url().clone(),
|
url: request.current_url(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1254,8 +1254,8 @@ fn http_network_fetch(
|
||||||
};
|
};
|
||||||
|
|
||||||
let devtools_sender = context.devtools_chan.clone();
|
let devtools_sender = context.devtools_chan.clone();
|
||||||
let meta_status = meta.status.clone();
|
let meta_status = meta.status;
|
||||||
let meta_headers = meta.headers.clone();
|
let meta_headers = meta.headers;
|
||||||
let cancellation_listener = context.cancellation_listener.clone();
|
let cancellation_listener = context.cancellation_listener.clone();
|
||||||
if cancellation_listener.lock().unwrap().cancelled() {
|
if cancellation_listener.lock().unwrap().cancelled() {
|
||||||
return Response::network_error(NetworkError::Internal("Fetch aborted".into()));
|
return Response::network_error(NetworkError::Internal("Fetch aborted".into()));
|
||||||
|
@ -1281,7 +1281,6 @@ fn http_network_fetch(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let done_sender = done_sender.clone();
|
|
||||||
let done_sender2 = done_sender.clone();
|
let done_sender2 = done_sender.clone();
|
||||||
HANDLE.lock().unwrap().spawn(
|
HANDLE.lock().unwrap().spawn(
|
||||||
res.into_body()
|
res.into_body()
|
||||||
|
|
|
@ -183,7 +183,7 @@ pub fn init(
|
||||||
.name(format!("WebSocket connection to {}", req_init.url))
|
.name(format!("WebSocket connection to {}", req_init.url))
|
||||||
.spawn(move || {
|
.spawn(move || {
|
||||||
let protocols = match req_init.mode {
|
let protocols = match req_init.mode {
|
||||||
RequestMode::WebSocket { protocols } => protocols.clone(),
|
RequestMode::WebSocket { protocols } => protocols,
|
||||||
_ => panic!("Received a RequestInit with a non-websocket mode in websocket_loader"),
|
_ => panic!("Received a RequestInit with a non-websocket mode in websocket_loader"),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1024,7 +1024,7 @@ impl Stylist {
|
||||||
|
|
||||||
ViewportRule {
|
ViewportRule {
|
||||||
declarations: viewport_rule::Cascade::from_stylesheets(
|
declarations: viewport_rule::Cascade::from_stylesheets(
|
||||||
stylesheets.clone(),
|
stylesheets,
|
||||||
guards,
|
guards,
|
||||||
&device,
|
&device,
|
||||||
)
|
)
|
||||||
|
|
|
@ -287,7 +287,7 @@ impl WebVRThread {
|
||||||
fn notify_events(&self, events: Vec<VREvent>) {
|
fn notify_events(&self, events: Vec<VREvent>) {
|
||||||
let pipeline_ids: Vec<PipelineId> = self.contexts.iter().map(|c| *c).collect();
|
let pipeline_ids: Vec<PipelineId> = self.contexts.iter().map(|c| *c).collect();
|
||||||
self.constellation_chan
|
self.constellation_chan
|
||||||
.send(ConstellationMsg::WebVREvents(pipeline_ids.clone(), events))
|
.send(ConstellationMsg::WebVREvents(pipeline_ids, events))
|
||||||
.unwrap();
|
.unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue