about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2015-04-03 04:29:52 +0000
committerbors <bors@rust-lang.org>2015-04-03 04:29:52 +0000
commitfc98b19cf72ea45851ebb7b28af160be92b19128 (patch)
tree8a19d8c1f6e9a71eb5e0286954519b4b7ec3fbf8 /src/libstd
parent5e30f05a05326018357c6fffdfb872e8a8d2367c (diff)
parent883adc6763c3dd06b282368698b28a07cdd65fd6 (diff)
downloadrust-fc98b19cf72ea45851ebb7b28af160be92b19128.tar.gz
rust-fc98b19cf72ea45851ebb7b28af160be92b19128.zip
Auto merge of #23832 - petrochenkov:usize, r=aturon
These constants are small and can fit even in `u8`, but semantically they have type `usize` because they denote sizes and are almost always used in `usize` context. The change of their type to `u32` during the integer audit led only to the large amount of `as usize` noise (see the second commit, which removes this noise).

This is a minor [breaking-change] to an unstable interface.

r? @aturon 

Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/old_io/mod.rs16
-rw-r--r--src/libstd/sys/unix/c.rs4
2 files changed, 10 insertions, 10 deletions
diff --git a/src/libstd/old_io/mod.rs b/src/libstd/old_io/mod.rs
index 98ff6e82c6f..5e93757668c 100644
--- a/src/libstd/old_io/mod.rs
+++ b/src/libstd/old_io/mod.rs
@@ -726,28 +726,28 @@ pub trait Reader {
     ///
     /// The number of bytes returned is system-dependent.
     fn read_le_uint(&mut self) -> IoResult<usize> {
-        self.read_le_uint_n(usize::BYTES as usize).map(|i| i as usize)
+        self.read_le_uint_n(usize::BYTES).map(|i| i as usize)
     }
 
     /// Reads a little-endian integer.
     ///
     /// The number of bytes returned is system-dependent.
     fn read_le_int(&mut self) -> IoResult<isize> {
-        self.read_le_int_n(isize::BYTES as usize).map(|i| i as isize)
+        self.read_le_int_n(isize::BYTES).map(|i| i as isize)
     }
 
     /// Reads a big-endian unsigned integer.
     ///
     /// The number of bytes returned is system-dependent.
     fn read_be_uint(&mut self) -> IoResult<usize> {
-        self.read_be_uint_n(usize::BYTES as usize).map(|i| i as usize)
+        self.read_be_uint_n(usize::BYTES).map(|i| i as usize)
     }
 
     /// Reads a big-endian integer.
     ///
     /// The number of bytes returned is system-dependent.
     fn read_be_int(&mut self) -> IoResult<isize> {
-        self.read_be_int_n(isize::BYTES as usize).map(|i| i as isize)
+        self.read_be_int_n(isize::BYTES).map(|i| i as isize)
     }
 
     /// Reads a big-endian `u64`.
@@ -1110,25 +1110,25 @@ pub trait Writer {
     /// Write a little-endian usize (number of bytes depends on system).
     #[inline]
     fn write_le_uint(&mut self, n: usize) -> IoResult<()> {
-        extensions::u64_to_le_bytes(n as u64, usize::BYTES as usize, |v| self.write_all(v))
+        extensions::u64_to_le_bytes(n as u64, usize::BYTES, |v| self.write_all(v))
     }
 
     /// Write a little-endian isize (number of bytes depends on system).
     #[inline]
     fn write_le_int(&mut self, n: isize) -> IoResult<()> {
-        extensions::u64_to_le_bytes(n as u64, isize::BYTES as usize, |v| self.write_all(v))
+        extensions::u64_to_le_bytes(n as u64, isize::BYTES, |v| self.write_all(v))
     }
 
     /// Write a big-endian usize (number of bytes depends on system).
     #[inline]
     fn write_be_uint(&mut self, n: usize) -> IoResult<()> {
-        extensions::u64_to_be_bytes(n as u64, usize::BYTES as usize, |v| self.write_all(v))
+        extensions::u64_to_be_bytes(n as u64, usize::BYTES, |v| self.write_all(v))
     }
 
     /// Write a big-endian isize (number of bytes depends on system).
     #[inline]
     fn write_be_int(&mut self, n: isize) -> IoResult<()> {
-        extensions::u64_to_be_bytes(n as u64, isize::BYTES as usize, |v| self.write_all(v))
+        extensions::u64_to_be_bytes(n as u64, isize::BYTES, |v| self.write_all(v))
     }
 
     /// Write a big-endian u64 (8 bytes).
diff --git a/src/libstd/sys/unix/c.rs b/src/libstd/sys/unix/c.rs
index 2514d4bf4a3..5ae508e4610 100644
--- a/src/libstd/sys/unix/c.rs
+++ b/src/libstd/sys/unix/c.rs
@@ -194,12 +194,12 @@ mod select {
     #[repr(C)]
     pub struct fd_set {
         // FIXME: shouldn't this be a c_ulong?
-        fds_bits: [libc::uintptr_t; (FD_SETSIZE / usize::BITS as usize)]
+        fds_bits: [libc::uintptr_t; (FD_SETSIZE / usize::BITS)]
     }
 
     pub fn fd_set(set: &mut fd_set, fd: i32) {
         let fd = fd as usize;
-        set.fds_bits[fd / usize::BITS as usize] |= 1 << (fd % usize::BITS as usize);
+        set.fds_bits[fd / usize::BITS] |= 1 << (fd % usize::BITS);
     }
 }