librustc: Add a lint mode for unnecessary copy and remove a bunch of them.
This commit is contained in:
parent
8c082658be
commit
b4e674f6e6
59 changed files with 256 additions and 235 deletions
|
|
@ -177,7 +177,7 @@ impl Arena {
|
|||
// Allocate a new chunk.
|
||||
let chunk_size = at_vec::capacity(self.pod_head.data);
|
||||
let new_min_chunk_size = num::max(n_bytes, chunk_size);
|
||||
self.chunks = @mut MutCons(copy self.pod_head, self.chunks);
|
||||
self.chunks = @mut MutCons(self.pod_head, self.chunks);
|
||||
self.pod_head =
|
||||
chunk(uint::next_power_of_two(new_min_chunk_size + 1u), true);
|
||||
|
||||
|
|
@ -219,7 +219,7 @@ impl Arena {
|
|||
// Allocate a new chunk.
|
||||
let chunk_size = at_vec::capacity(self.head.data);
|
||||
let new_min_chunk_size = num::max(n_bytes, chunk_size);
|
||||
self.chunks = @mut MutCons(copy self.head, self.chunks);
|
||||
self.chunks = @mut MutCons(self.head, self.chunks);
|
||||
self.head =
|
||||
chunk(uint::next_power_of_two(new_min_chunk_size + 1u), false);
|
||||
|
||||
|
|
|
|||
|
|
@ -318,8 +318,12 @@ pub mod reader {
|
|||
let TaggedDoc { tag: r_tag, doc: r_doc } =
|
||||
doc_at(self.parent.data, self.pos);
|
||||
debug!("self.parent=%?-%? self.pos=%? r_tag=%? r_doc=%?-%?",
|
||||
copy self.parent.start, copy self.parent.end,
|
||||
copy self.pos, r_tag, r_doc.start, r_doc.end);
|
||||
self.parent.start,
|
||||
self.parent.end,
|
||||
self.pos,
|
||||
r_tag,
|
||||
r_doc.start,
|
||||
r_doc.end);
|
||||
if r_tag != (exp_tag as uint) {
|
||||
fail!("expected EBML doc with tag %? but found tag %?", exp_tag, r_tag);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -240,7 +240,7 @@ pub mod v4 {
|
|||
err_msg: ~"uv_ip4_name produced invalid result.",
|
||||
})
|
||||
} else {
|
||||
Ok(Ipv4(copy(new_addr)))
|
||||
Ok(Ipv4(new_addr))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -312,12 +312,10 @@ extern fn get_addr_cb(handle: *uv_getaddrinfo_t,
|
|||
let mut curr_addr = res;
|
||||
loop {
|
||||
let new_ip_addr = if ll::is_ipv4_addrinfo(curr_addr) {
|
||||
Ipv4(copy((
|
||||
*ll::addrinfo_as_sockaddr_in(curr_addr))))
|
||||
Ipv4(*ll::addrinfo_as_sockaddr_in(curr_addr))
|
||||
}
|
||||
else if ll::is_ipv6_addrinfo(curr_addr) {
|
||||
Ipv6(copy((
|
||||
*ll::addrinfo_as_sockaddr_in6(curr_addr))))
|
||||
Ipv6(*ll::addrinfo_as_sockaddr_in6(curr_addr))
|
||||
}
|
||||
else {
|
||||
debug!("curr_addr is not of family AF_INET or \
|
||||
|
|
|
|||
|
|
@ -682,8 +682,8 @@ fn listen_common(host_ip: ip::IpAddr,
|
|||
// will defeat a move sigil, as is done to the host_ip
|
||||
// arg above.. this same pattern works w/o complaint in
|
||||
// tcp::connect (because the iotask::interact cb isn't
|
||||
// nested within a std::comm::listen block)
|
||||
let loc_ip = copy(host_ip);
|
||||
// nested within a core::comm::listen block)
|
||||
let loc_ip = host_ip;
|
||||
do iotask::interact(iotask) |loop_ptr| {
|
||||
unsafe {
|
||||
match uv::ll::tcp_init(loop_ptr, server_stream_ptr) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue