mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00: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());
|
||||
match event_loop {
|
||||
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(),
|
||||
};
|
||||
if let Err(e) = sender.send(contents.to_owned()) {
|
||||
if let Err(e) = sender.send(contents) {
|
||||
warn!("Failed to send clipboard ({})", e);
|
||||
}
|
||||
},
|
||||
|
@ -1635,7 +1635,7 @@ where
|
|||
None,
|
||||
opener,
|
||||
window_size,
|
||||
load_data.clone(),
|
||||
load_data,
|
||||
sandbox,
|
||||
is_private,
|
||||
is_visible.unwrap_or(true),
|
||||
|
@ -1716,7 +1716,7 @@ where
|
|||
);
|
||||
self.embedder_proxy.send(msg);
|
||||
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 is_private = false;
|
||||
let is_visible = true;
|
||||
|
@ -1738,7 +1738,7 @@ where
|
|||
None,
|
||||
None,
|
||||
Some(window_size),
|
||||
load_data.clone(),
|
||||
load_data,
|
||||
sandbox,
|
||||
is_private,
|
||||
is_visible,
|
||||
|
@ -1909,7 +1909,7 @@ where
|
|||
Some(parent_pipeline_id),
|
||||
None,
|
||||
browsing_context.size,
|
||||
load_data.clone(),
|
||||
load_data,
|
||||
load_info.sandbox,
|
||||
is_private,
|
||||
browsing_context.is_visible,
|
||||
|
@ -2235,7 +2235,7 @@ where
|
|||
None,
|
||||
opener,
|
||||
window_size,
|
||||
load_data.clone(),
|
||||
load_data,
|
||||
sandbox,
|
||||
is_private,
|
||||
is_visible,
|
||||
|
@ -2555,7 +2555,7 @@ where
|
|||
top_level_browsing_context_id: top_level_id,
|
||||
browsing_context_id: browsing_context_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.
|
||||
new_browsing_context_info: None,
|
||||
});
|
||||
|
@ -3190,7 +3190,7 @@ where
|
|||
.future
|
||||
.iter()
|
||||
.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 msg = (
|
||||
|
|
|
@ -129,7 +129,7 @@ impl NetworkListener {
|
|||
_ => {
|
||||
// Response should be processed by script thread.
|
||||
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(),
|
||||
window_size: window_size,
|
||||
pipeline_port: pipeline_port,
|
||||
content_process_shutdown_chan: Some(
|
||||
layout_content_process_shutdown_chan.clone(),
|
||||
),
|
||||
content_process_shutdown_chan: Some(layout_content_process_shutdown_chan),
|
||||
layout_threads: PREFS.get("layout.threads").as_u64().expect("count") as usize,
|
||||
};
|
||||
|
||||
|
@ -552,7 +550,7 @@ impl UnprivilegedPipelineContent {
|
|||
background_hang_monitor_register,
|
||||
self.layout_to_constellation_chan,
|
||||
self.script_chan,
|
||||
image_cache.clone(),
|
||||
image_cache,
|
||||
self.font_cache_thread,
|
||||
self.time_profiler_chan,
|
||||
self.mem_profiler_chan,
|
||||
|
|
|
@ -552,7 +552,7 @@ impl Actor for PageStyleActor {
|
|||
m.insert("bottom".to_owned(), auto.clone());
|
||||
}
|
||||
if autoMargins.left {
|
||||
m.insert("left".to_owned(), auto.clone());
|
||||
m.insert("left".to_owned(), auto);
|
||||
}
|
||||
serde_json::value::Value::Object(m)
|
||||
} else {
|
||||
|
|
|
@ -358,7 +358,7 @@ impl NetworkEventActor {
|
|||
let status_text = String::from_utf8_lossy(st).into_owned();
|
||||
(StatusCode::from_u16(s).unwrap(), status_text)
|
||||
});
|
||||
self.response.body = response.body.clone();
|
||||
self.response.body = response.body;
|
||||
}
|
||||
|
||||
pub fn event_actor(&self) -> EventActor {
|
||||
|
|
|
@ -404,7 +404,7 @@ fn run_server(
|
|||
None => return,
|
||||
};
|
||||
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 actor = actors.find_mut::<NetworkEventActor>(&netevent_actor_name);
|
||||
|
||||
|
@ -499,7 +499,7 @@ fn run_server(
|
|||
}
|
||||
|
||||
let msg = NetworkEventUpdateMsg {
|
||||
from: netevent_actor_name.clone(),
|
||||
from: netevent_actor_name,
|
||||
type_: "networkEventUpdate".to_owned(),
|
||||
updateType: "responseHeaders".to_owned(),
|
||||
};
|
||||
|
@ -533,14 +533,13 @@ fn run_server(
|
|||
}
|
||||
}
|
||||
|
||||
let sender_clone = sender.clone();
|
||||
thread::Builder::new()
|
||||
.name("DevtoolsClientAcceptor".to_owned())
|
||||
.spawn(move || {
|
||||
// accept connections and process them, spawning a new thread for each one
|
||||
for stream in listener.incoming() {
|
||||
// connection succeeded
|
||||
sender_clone
|
||||
sender
|
||||
.send(DevtoolsControlMsg::FromChrome(
|
||||
ChromeToDevtoolsControlMsg::AddClient(stream.unwrap()),
|
||||
))
|
||||
|
|
|
@ -405,7 +405,7 @@ impl FontCache {
|
|||
match (template.bytes_if_in_memory(), template.native_font()) {
|
||||
(Some(bytes), _) => txn.add_raw_font(font_key, bytes, 0),
|
||||
(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);
|
||||
font_key
|
||||
|
|
|
@ -195,7 +195,7 @@ impl<S: FontSource> FontContext<S> {
|
|||
.get_font_instance(info.font_key, actual_pt_size);
|
||||
Ok(Font::new(
|
||||
handle,
|
||||
descriptor.to_owned(),
|
||||
descriptor,
|
||||
actual_pt_size,
|
||||
font_instance_key,
|
||||
))
|
||||
|
|
|
@ -143,7 +143,7 @@ impl FontHandleMethods for FontHandle {
|
|||
|
||||
let mut handle = FontHandle {
|
||||
face: face,
|
||||
font_data: template.clone(),
|
||||
font_data: template,
|
||||
handle: fctx.clone(),
|
||||
can_do_fast_shaping: false,
|
||||
};
|
||||
|
|
|
@ -1257,7 +1257,7 @@ impl BlockFlow {
|
|||
self.fragment.inline_start_offset(),
|
||||
Au(0),
|
||||
));
|
||||
self.base.floats = floats.clone();
|
||||
self.base.floats = floats;
|
||||
self.adjust_fragments_for_collapsed_margins_if_root(layout_context.shared_context());
|
||||
} else {
|
||||
// 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
|
||||
if !text_shadows.is_empty() {
|
||||
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),
|
||||
};
|
||||
|
||||
self.base.floats = scanner.floats.clone();
|
||||
self.base.floats = scanner.floats;
|
||||
let writing_mode = self.base.floats.writing_mode;
|
||||
self.base.floats.translate(LogicalSize::new(
|
||||
writing_mode,
|
||||
|
|
|
@ -191,7 +191,7 @@ pub fn main_fetch(
|
|||
},
|
||||
Referrer::ReferrerUrl(url) => {
|
||||
request.headers.remove(header::REFERER);
|
||||
let current_url = request.current_url().clone();
|
||||
let current_url = request.current_url();
|
||||
determine_request_referrer(
|
||||
&mut request.headers,
|
||||
request.referrer_policy.unwrap(),
|
||||
|
|
|
@ -681,7 +681,7 @@ impl FileManagerStore {
|
|||
self.insert(
|
||||
id,
|
||||
FileStoreEntry {
|
||||
origin: origin.clone(),
|
||||
origin,
|
||||
file_impl: FileImpl::Memory(blob_buf),
|
||||
refs: AtomicUsize::new(1),
|
||||
is_valid_url: AtomicBool::new(set_valid),
|
||||
|
|
|
@ -40,7 +40,7 @@ pub struct CacheKey {
|
|||
impl CacheKey {
|
||||
fn new(request: Request) -> 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 meta_status = meta.status.clone();
|
||||
let meta_headers = meta.headers.clone();
|
||||
let meta_status = meta.status;
|
||||
let meta_headers = meta.headers;
|
||||
let cancellation_listener = context.cancellation_listener.clone();
|
||||
if cancellation_listener.lock().unwrap().cancelled() {
|
||||
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();
|
||||
HANDLE.lock().unwrap().spawn(
|
||||
res.into_body()
|
||||
|
|
|
@ -183,7 +183,7 @@ pub fn init(
|
|||
.name(format!("WebSocket connection to {}", req_init.url))
|
||||
.spawn(move || {
|
||||
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"),
|
||||
};
|
||||
|
||||
|
|
|
@ -1024,7 +1024,7 @@ impl Stylist {
|
|||
|
||||
ViewportRule {
|
||||
declarations: viewport_rule::Cascade::from_stylesheets(
|
||||
stylesheets.clone(),
|
||||
stylesheets,
|
||||
guards,
|
||||
&device,
|
||||
)
|
||||
|
|
|
@ -287,7 +287,7 @@ impl WebVRThread {
|
|||
fn notify_events(&self, events: Vec<VREvent>) {
|
||||
let pipeline_ids: Vec<PipelineId> = self.contexts.iter().map(|c| *c).collect();
|
||||
self.constellation_chan
|
||||
.send(ConstellationMsg::WebVREvents(pipeline_ids.clone(), events))
|
||||
.send(ConstellationMsg::WebVREvents(pipeline_ids, events))
|
||||
.unwrap();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue