aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShotaro Yamada <sinkuu@sinkuu.xyz>2018-12-11 10:43:51 +0900
committerShotaro Yamada <sinkuu@sinkuu.xyz>2018-12-11 10:43:51 +0900
commitc44a2febe6f5f63f5b0d171c7793d00abb4f1dbd (patch)
tree74e446ae81da035445e300ae569d737ab5d38056
parenteeaca0b26d4bd46668fb792dccfbee0111982f6a (diff)
downloadservo-c44a2febe6f5f63f5b0d171c7793d00abb4f1dbd.tar.gz
servo-c44a2febe6f5f63f5b0d171c7793d00abb4f1dbd.zip
Remove redundant `.clone()`s
-rw-r--r--components/constellation/constellation.rs18
-rw-r--r--components/constellation/network_listener.rs2
-rw-r--r--components/constellation/pipeline.rs6
-rw-r--r--components/devtools/actors/inspector.rs2
-rw-r--r--components/devtools/actors/network_event.rs2
-rw-r--r--components/devtools/lib.rs7
-rw-r--r--components/gfx/font_cache_thread.rs2
-rw-r--r--components/gfx/font_context.rs2
-rw-r--r--components/gfx/platform/freetype/font.rs2
-rw-r--r--components/layout/block.rs2
-rw-r--r--components/layout/display_list/builder.rs2
-rw-r--r--components/layout/inline.rs2
-rw-r--r--components/net/fetch/methods.rs2
-rw-r--r--components/net/filemanager_thread.rs2
-rw-r--r--components/net/http_cache.rs2
-rw-r--r--components/net/http_loader.rs5
-rw-r--r--components/net/websocket_loader.rs2
-rw-r--r--components/style/stylist.rs2
-rw-r--r--components/webvr/webvr_thread.rs2
19 files changed, 31 insertions, 35 deletions
diff --git a/components/constellation/constellation.rs b/components/constellation/constellation.rs
index 828db1ce88e..afb0c16cde5 100644
--- a/components/constellation/constellation.rs
+++ b/components/constellation/constellation.rs
@@ -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 = (
diff --git a/components/constellation/network_listener.rs b/components/constellation/network_listener.rs
index 4087de187f5..675f634f5f4 100644
--- a/components/constellation/network_listener.rs
+++ b/components/constellation/network_listener.rs
@@ -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)));
},
};
},
diff --git a/components/constellation/pipeline.rs b/components/constellation/pipeline.rs
index 63376315101..c051f8124fa 100644
--- a/components/constellation/pipeline.rs
+++ b/components/constellation/pipeline.rs
@@ -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,
diff --git a/components/devtools/actors/inspector.rs b/components/devtools/actors/inspector.rs
index 03f18f4b357..cd3e5bf323c 100644
--- a/components/devtools/actors/inspector.rs
+++ b/components/devtools/actors/inspector.rs
@@ -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 {
diff --git a/components/devtools/actors/network_event.rs b/components/devtools/actors/network_event.rs
index 12f7c0c6f24..0de7d7544c1 100644
--- a/components/devtools/actors/network_event.rs
+++ b/components/devtools/actors/network_event.rs
@@ -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 {
diff --git a/components/devtools/lib.rs b/components/devtools/lib.rs
index 3a178e7e37c..f0a4e9facc8 100644
--- a/components/devtools/lib.rs
+++ b/components/devtools/lib.rs
@@ -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()),
))
diff --git a/components/gfx/font_cache_thread.rs b/components/gfx/font_cache_thread.rs
index 47939f38bd0..c932df2686b 100644
--- a/components/gfx/font_cache_thread.rs
+++ b/components/gfx/font_cache_thread.rs
@@ -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
diff --git a/components/gfx/font_context.rs b/components/gfx/font_context.rs
index ae6d8cfd6f1..20b30a49159 100644
--- a/components/gfx/font_context.rs
+++ b/components/gfx/font_context.rs
@@ -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,
))
diff --git a/components/gfx/platform/freetype/font.rs b/components/gfx/platform/freetype/font.rs
index 730a3d10d5e..bf39a418f6e 100644
--- a/components/gfx/platform/freetype/font.rs
+++ b/components/gfx/platform/freetype/font.rs
@@ -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,
};
diff --git a/components/layout/block.rs b/components/layout/block.rs
index a1d39e19fc2..8077b66f821 100644
--- a/components/layout/block.rs
+++ b/components/layout/block.rs
@@ -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
diff --git a/components/layout/display_list/builder.rs b/components/layout/display_list/builder.rs
index 3f474af6f1e..835c39865ff 100644
--- a/components/layout/display_list/builder.rs
+++ b/components/layout/display_list/builder.rs
@@ -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 },
)));
}
}
diff --git a/components/layout/inline.rs b/components/layout/inline.rs
index b6f63e44a5e..eceb2c7594e 100644
--- a/components/layout/inline.rs
+++ b/components/layout/inline.rs
@@ -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,
diff --git a/components/net/fetch/methods.rs b/components/net/fetch/methods.rs
index 54edee43e92..05559b57b41 100644
--- a/components/net/fetch/methods.rs
+++ b/components/net/fetch/methods.rs
@@ -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(),
diff --git a/components/net/filemanager_thread.rs b/components/net/filemanager_thread.rs
index f0779df632b..d10b149bc7c 100644
--- a/components/net/filemanager_thread.rs
+++ b/components/net/filemanager_thread.rs
@@ -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),
diff --git a/components/net/http_cache.rs b/components/net/http_cache.rs
index a91fb6f5180..b1dd453423f 100644
--- a/components/net/http_cache.rs
+++ b/components/net/http_cache.rs
@@ -40,7 +40,7 @@ pub struct CacheKey {
impl CacheKey {
fn new(request: Request) -> CacheKey {
CacheKey {
- url: request.current_url().clone(),
+ url: request.current_url(),
}
}
diff --git a/components/net/http_loader.rs b/components/net/http_loader.rs
index 66bdce34f89..ae815d09f41 100644
--- a/components/net/http_loader.rs
+++ b/components/net/http_loader.rs
@@ -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()
diff --git a/components/net/websocket_loader.rs b/components/net/websocket_loader.rs
index e1abc148021..0ac433ebbfd 100644
--- a/components/net/websocket_loader.rs
+++ b/components/net/websocket_loader.rs
@@ -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"),
};
diff --git a/components/style/stylist.rs b/components/style/stylist.rs
index 01e015aa1a2..c5129520b29 100644
--- a/components/style/stylist.rs
+++ b/components/style/stylist.rs
@@ -1024,7 +1024,7 @@ impl Stylist {
ViewportRule {
declarations: viewport_rule::Cascade::from_stylesheets(
- stylesheets.clone(),
+ stylesheets,
guards,
&device,
)
diff --git a/components/webvr/webvr_thread.rs b/components/webvr/webvr_thread.rs
index bd0897a281c..5c6889066b1 100644
--- a/components/webvr/webvr_thread.rs
+++ b/components/webvr/webvr_thread.rs
@@ -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();
}