From 7826651335b81f4630aa4d0d43a5de95b96d2311 Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Mon, 8 Jul 2013 17:22:51 -0700 Subject: [PATCH] Tidy --- src/libstd/rt/borrowck.rs | 8 ++++---- src/libstd/rt/global_heap.rs | 2 +- src/libstd/rt/uv/net.rs | 14 +++++++++----- src/libstd/vec.rs | 6 ++---- 4 files changed, 16 insertions(+), 14 deletions(-) diff --git a/src/libstd/rt/borrowck.rs b/src/libstd/rt/borrowck.rs index e057f6e9637..60df2d5c11b 100644 --- a/src/libstd/rt/borrowck.rs +++ b/src/libstd/rt/borrowck.rs @@ -147,15 +147,15 @@ impl DebugPrints for io::fd_t { fn write_hex(&self, mut i: uint) { let letters = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f']; - static uint_nibbles: uint = ::uint::bytes << 1; - let mut buffer = [0_u8, ..uint_nibbles+1]; - let mut c = uint_nibbles; + static UINT_NIBBLES: uint = ::uint::bytes << 1; + let mut buffer = [0_u8, ..UINT_NIBBLES+1]; + let mut c = UINT_NIBBLES; while c > 0 { c -= 1; buffer[c] = letters[i & 0xF] as u8; i >>= 4; } - self.write(buffer.slice(0, uint_nibbles)); + self.write(buffer.slice(0, UINT_NIBBLES)); } unsafe fn write_cstr(&self, p: *c_char) { diff --git a/src/libstd/rt/global_heap.rs b/src/libstd/rt/global_heap.rs index c9bf3b28530..53634f0cf86 100644 --- a/src/libstd/rt/global_heap.rs +++ b/src/libstd/rt/global_heap.rs @@ -80,7 +80,7 @@ pub unsafe fn exchange_malloc(td: *c_char, size: uintptr_t) -> *c_char { #[cfg(not(stage0), not(test))] #[lang="exchange_malloc"] #[inline] -pub unsafe fn exchange_malloc(align: u32, size: uintptr_t) -> *c_char { +pub unsafe fn exchange_malloc(_align: u32, size: uintptr_t) -> *c_char { malloc_raw(size as uint) as *c_char } diff --git a/src/libstd/rt/uv/net.rs b/src/libstd/rt/uv/net.rs index 2707b9ce7d7..a736d54d62a 100644 --- a/src/libstd/rt/uv/net.rs +++ b/src/libstd/rt/uv/net.rs @@ -97,7 +97,7 @@ fn uv_ip_as_ip(addr: UvIpAddr, f: &fn(IpAddr) -> T) -> T { let ip_str = str::from_bytes_slice(ip_name).trim_right_chars(&'\x00'); let ip = match addr { UvIpv4(*) => { - let ip: ~[u8] = + let ip: ~[u8] = ip_str.split_iter('.') .transform(|s: &str| -> u8 { FromStr::from_str(s).unwrap() }) .collect(); @@ -288,8 +288,10 @@ impl TcpWatcher { rtdebug!("connect_t: %x", connect_handle as uint); do ip_as_uv_ip(address) |addr| { let result = match addr { - UvIpv4(addr) => uvll::tcp_connect(connect_handle, self.native_handle(), addr, connect_cb), - UvIpv6(addr) => uvll::tcp_connect6(connect_handle, self.native_handle(), addr, connect_cb), + UvIpv4(addr) => uvll::tcp_connect(connect_handle, + self.native_handle(), addr, connect_cb), + UvIpv6(addr) => uvll::tcp_connect6(connect_handle, + self.native_handle(), addr, connect_cb), }; assert_eq!(0, result); } @@ -416,8 +418,10 @@ impl UdpWatcher { do ip_as_uv_ip(address) |addr| { let result = unsafe { match addr { - UvIpv4(addr) => uvll::udp_send(req.native_handle(), self.native_handle(), [buf], addr, send_cb), - UvIpv6(addr) => uvll::udp_send6(req.native_handle(), self.native_handle(), [buf], addr, send_cb), + UvIpv4(addr) => uvll::udp_send(req.native_handle(), + self.native_handle(), [buf], addr, send_cb), + UvIpv6(addr) => uvll::udp_send6(req.native_handle(), + self.native_handle(), [buf], addr, send_cb), } }; assert_eq!(0, result); diff --git a/src/libstd/vec.rs b/src/libstd/vec.rs index 2c1e913511e..1188cfbe595 100644 --- a/src/libstd/vec.rs +++ b/src/libstd/vec.rs @@ -32,14 +32,12 @@ use sys::size_of; use uint; use unstable::intrinsics; #[cfg(stage0)] -use intrinsic::{get_tydesc, TyDesc}; +use intrinsic::{get_tydesc}; #[cfg(not(stage0))] -use unstable::intrinsics::{get_tydesc, contains_managed, TyDesc}; +use unstable::intrinsics::{get_tydesc, contains_managed}; use vec; use util; -#[cfg(not(test))] use cmp::Equiv; - /// Returns true if two vectors have the same length pub fn same_length(xs: &[T], ys: &[U]) -> bool { xs.len() == ys.len()