Remove some unnecessary type casts
Conflicts: src/librustc/middle/lint.rs
This commit is contained in:
parent
6be2bc817b
commit
8236550104
13 changed files with 25 additions and 25 deletions
|
@ -80,7 +80,7 @@ impl SmallBitv {
|
|||
self.bits |= 1<<i;
|
||||
}
|
||||
else {
|
||||
self.bits &= !(1<<i as uint);
|
||||
self.bits &= !(1<<i);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -647,7 +647,7 @@ pub mod writer {
|
|||
let cur_pos = self.writer.tell();
|
||||
self.writer.seek(last_size_pos as i64, io::SeekSet);
|
||||
let size = (cur_pos as uint - last_size_pos - 4);
|
||||
write_sized_vuint(self.writer, size as uint, 4u);
|
||||
write_sized_vuint(self.writer, size, 4u);
|
||||
self.writer.seek(cur_pos as i64, io::SeekSet);
|
||||
|
||||
debug!("End tag (size = {})", size);
|
||||
|
|
|
@ -929,8 +929,8 @@ fn calc_result(desc: &TestDesc, task_succeeded: bool) -> TestResult {
|
|||
impl ToJson for Metric {
|
||||
fn to_json(&self) -> json::Json {
|
||||
let mut map = ~TreeMap::new();
|
||||
map.insert(~"value", json::Number(self.value as f64));
|
||||
map.insert(~"noise", json::Number(self.noise as f64));
|
||||
map.insert(~"value", json::Number(self.value));
|
||||
map.insert(~"noise", json::Number(self.noise));
|
||||
json::Object(map)
|
||||
}
|
||||
}
|
||||
|
@ -1132,7 +1132,7 @@ impl BenchHarness {
|
|||
let loop_start = precise_time_ns();
|
||||
|
||||
for p in samples.mut_iter() {
|
||||
self.bench_n(n as u64, |x| f(x));
|
||||
self.bench_n(n, |x| f(x));
|
||||
*p = self.ns_per_iter() as f64;
|
||||
};
|
||||
|
||||
|
@ -1140,7 +1140,7 @@ impl BenchHarness {
|
|||
let summ = stats::Summary::new(samples);
|
||||
|
||||
for p in samples.mut_iter() {
|
||||
self.bench_n(5 * n as u64, |x| f(x));
|
||||
self.bench_n(5 * n, |x| f(x));
|
||||
*p = self.ns_per_iter() as f64;
|
||||
};
|
||||
|
||||
|
|
|
@ -767,13 +767,13 @@ pub fn strptime(s: &str, format: &str) -> Result<Tm, ~str> {
|
|||
|
||||
let mut buf = [0];
|
||||
let c = match rdr.read(buf) {
|
||||
Some(..) => buf[0] as u8 as char,
|
||||
Some(..) => buf[0] as char,
|
||||
None => break
|
||||
};
|
||||
match c {
|
||||
'%' => {
|
||||
let ch = match rdr.read(buf) {
|
||||
Some(..) => buf[0] as u8 as char,
|
||||
Some(..) => buf[0] as char,
|
||||
None => break
|
||||
};
|
||||
match parse_type(s, pos, ch, &mut tm) {
|
||||
|
|
|
@ -42,7 +42,7 @@ unsafe fn each_live_alloc(read_next_before: bool,
|
|||
let next_before = (*alloc).next;
|
||||
let uniq = (*alloc).ref_count == managed::RC_MANAGED_UNIQUE;
|
||||
|
||||
if !f(alloc as *mut raw::Box<()>, uniq) {
|
||||
if !f(alloc, uniq) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -725,7 +725,7 @@ pub trait Reader {
|
|||
///
|
||||
/// `u64`s are 8 bytes long.
|
||||
fn read_be_u64(&mut self) -> u64 {
|
||||
self.read_be_uint_n(8) as u64
|
||||
self.read_be_uint_n(8)
|
||||
}
|
||||
|
||||
/// Reads a big-endian `u32`.
|
||||
|
@ -746,7 +746,7 @@ pub trait Reader {
|
|||
///
|
||||
/// `i64`s are 8 bytes long.
|
||||
fn read_be_i64(&mut self) -> i64 {
|
||||
self.read_be_int_n(8) as i64
|
||||
self.read_be_int_n(8)
|
||||
}
|
||||
|
||||
/// Reads a big-endian `i32`.
|
||||
|
@ -785,7 +785,7 @@ pub trait Reader {
|
|||
///
|
||||
/// `u64`s are 8 bytes long.
|
||||
fn read_le_u64(&mut self) -> u64 {
|
||||
self.read_le_uint_n(8) as u64
|
||||
self.read_le_uint_n(8)
|
||||
}
|
||||
|
||||
/// Reads a little-endian `u32`.
|
||||
|
@ -806,7 +806,7 @@ pub trait Reader {
|
|||
///
|
||||
/// `i64`s are 8 bytes long.
|
||||
fn read_le_i64(&mut self) -> i64 {
|
||||
self.read_le_int_n(8) as i64
|
||||
self.read_le_int_n(8)
|
||||
}
|
||||
|
||||
/// Reads a little-endian `i32`.
|
||||
|
@ -846,7 +846,7 @@ pub trait Reader {
|
|||
/// `u8`s are 1 byte.
|
||||
fn read_u8(&mut self) -> u8 {
|
||||
match self.read_byte() {
|
||||
Some(b) => b as u8,
|
||||
Some(b) => b,
|
||||
None => 0
|
||||
}
|
||||
}
|
||||
|
|
|
@ -153,11 +153,11 @@ impl<'a> Parser<'a> {
|
|||
let c = c as u8;
|
||||
// assuming radix is either 10 or 16
|
||||
if c >= '0' as u8 && c <= '9' as u8 {
|
||||
Some((c - '0' as u8) as u8)
|
||||
Some(c - '0' as u8)
|
||||
} else if radix > 10 && c >= 'a' as u8 && c < 'a' as u8 + (radix - 10) {
|
||||
Some((c - 'a' as u8 + 10) as u8)
|
||||
Some(c - 'a' as u8 + 10)
|
||||
} else if radix > 10 && c >= 'A' as u8 && c < 'A' as u8 + (radix - 10) {
|
||||
Some((c - 'A' as u8 + 10) as u8)
|
||||
Some(c - 'A' as u8 + 10)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
|
|
|
@ -209,7 +209,7 @@ impl Reader for StdReader {
|
|||
io_error::cond.raise(standard_error(EndOfFile));
|
||||
None
|
||||
}
|
||||
Ok(amt) => Some(amt as uint),
|
||||
Ok(amt) => Some(amt),
|
||||
Err(e) => {
|
||||
io_error::cond.raise(e);
|
||||
None
|
||||
|
|
|
@ -344,7 +344,7 @@ pub fn float_to_str_bytes_common<T:NumCast+Zero+One+Eq+Ord+Float+Round+
|
|||
// round the remaining ones.
|
||||
if limit_digits && dig == digit_count {
|
||||
let ascii2value = |chr: u8| {
|
||||
char::to_digit(chr as char, radix).unwrap() as uint
|
||||
char::to_digit(chr as char, radix).unwrap()
|
||||
};
|
||||
let value2ascii = |val: uint| {
|
||||
char::from_digit(val, radix).unwrap() as u8
|
||||
|
|
|
@ -32,7 +32,7 @@ impl Rand for StandardNormal {
|
|||
fn rand<R:Rng>(rng: &mut R) -> StandardNormal {
|
||||
#[inline]
|
||||
fn pdf(x: f64) -> f64 {
|
||||
((-x*x/2.0) as f64).exp()
|
||||
(-x*x/2.0).exp()
|
||||
}
|
||||
#[inline]
|
||||
fn zero_case<R:Rng>(rng: &mut R, u: f64) -> f64 {
|
||||
|
|
|
@ -76,7 +76,7 @@ pub unsafe fn closure_exchange_malloc(td: *c_char, size: uintptr_t) -> *c_char {
|
|||
assert!(td.is_not_null());
|
||||
|
||||
let total_size = get_box_size(size, (*td).align);
|
||||
let p = malloc_raw(total_size as uint);
|
||||
let p = malloc_raw(total_size);
|
||||
|
||||
let alloc = p as *mut raw::Box<()>;
|
||||
(*alloc).type_desc = td;
|
||||
|
|
|
@ -901,7 +901,7 @@ pub fn utf16_chars(v: &[u16], f: |char|) {
|
|||
let mut c: u32 = (u - 0xD800_u16) as u32;
|
||||
c = c << 10;
|
||||
c |= (u2 - 0xDC00_u16) as u32;
|
||||
c |= 0x1_0000_u32 as u32;
|
||||
c |= 0x1_0000_u32;
|
||||
f(unsafe { cast::transmute(c) });
|
||||
i += 2u;
|
||||
}
|
||||
|
@ -987,7 +987,7 @@ pub mod raw {
|
|||
/// Create a Rust string from a *u8 buffer of the given length
|
||||
pub unsafe fn from_buf_len(buf: *u8, len: uint) -> ~str {
|
||||
let mut v: ~[u8] = vec::with_capacity(len);
|
||||
ptr::copy_memory(v.as_mut_ptr(), buf as *u8, len);
|
||||
ptr::copy_memory(v.as_mut_ptr(), buf, len);
|
||||
v.set_len(len);
|
||||
|
||||
assert!(is_utf8(v));
|
||||
|
|
|
@ -66,8 +66,8 @@ impl Mutex {
|
|||
/// Creates a new mutex, with the lock/condition variable pre-initialized
|
||||
pub unsafe fn new() -> Mutex {
|
||||
Mutex {
|
||||
lock: atomics::AtomicUint::new(imp::init_lock() as uint),
|
||||
cond: atomics::AtomicUint::new(imp::init_cond() as uint),
|
||||
lock: atomics::AtomicUint::new(imp::init_lock()),
|
||||
cond: atomics::AtomicUint::new(imp::init_cond()),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue