From 13537d2e0ce54f88909e6f44006254490ae1d1ab Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Fri, 12 Apr 2013 01:10:01 -0400 Subject: core: remove unused 'mut' variables --- src/libcore/cell.rs | 2 +- src/libcore/flate.rs | 2 +- src/libcore/path.rs | 2 +- src/libcore/rand.rs | 2 +- src/libcore/repr.rs | 4 ++-- src/libcore/rt/uv/mod.rs | 2 +- src/libcore/rt/uv/net.rs | 2 +- src/libcore/rt/uvio.rs | 2 +- src/libcore/run.rs | 2 +- src/libcore/str.rs | 6 +++--- src/libcore/task/spawn.rs | 2 +- src/libcore/unstable/extfmt.rs | 4 ++-- src/libcore/vec.rs | 4 ++-- 13 files changed, 18 insertions(+), 18 deletions(-) (limited to 'src/libcore') diff --git a/src/libcore/cell.rs b/src/libcore/cell.rs index 1707bddc2b9..79125a67aa7 100644 --- a/src/libcore/cell.rs +++ b/src/libcore/cell.rs @@ -121,7 +121,7 @@ fn test_with_ref() { #[test] fn test_with_mut_ref() { let good = ~[1, 2, 3]; - let mut v = ~[1, 2]; + let v = ~[1, 2]; let c = Cell(v); do c.with_mut_ref() |v| { v.push(3); } let v = c.take(); diff --git a/src/libcore/flate.rs b/src/libcore/flate.rs index a4f12f7da7e..70c96c9c806 100644 --- a/src/libcore/flate.rs +++ b/src/libcore/flate.rs @@ -67,7 +67,7 @@ pub fn deflate_bytes(bytes: &const [u8]) -> ~[u8] { pub fn inflate_bytes(bytes: &const [u8]) -> ~[u8] { do vec::as_const_buf(bytes) |b, len| { unsafe { - let mut outsz : size_t = 0; + let outsz : size_t = 0; let res = rustrt::tinfl_decompress_mem_to_heap(b as *c_void, len as size_t, diff --git a/src/libcore/path.rs b/src/libcore/path.rs index 0e8dbd144b1..dbed4b8e0bf 100644 --- a/src/libcore/path.rs +++ b/src/libcore/path.rs @@ -844,7 +844,7 @@ pub mod windows { while i < s.len() { if is_sep(s[i]) { let pre = s.slice(2, i).to_owned(); - let mut rest = s.slice(i, s.len()).to_owned(); + let rest = s.slice(i, s.len()).to_owned(); return Some((pre, rest)); } i += 1; diff --git a/src/libcore/rand.rs b/src/libcore/rand.rs index 0a93a651a85..89062ff465b 100644 --- a/src/libcore/rand.rs +++ b/src/libcore/rand.rs @@ -693,7 +693,7 @@ struct XorShiftState { impl Rng for XorShiftState { fn next(&self) -> u32 { let x = self.x; - let mut t = x ^ (x << 11); + let t = x ^ (x << 11); self.x = self.y; self.y = self.z; self.z = self.w; diff --git a/src/libcore/repr.rs b/src/libcore/repr.rs index ca67e6366b5..03e44e00d88 100644 --- a/src/libcore/repr.rs +++ b/src/libcore/repr.rs @@ -210,7 +210,7 @@ pub impl ReprVisitor { #[inline(always)] fn visit_ptr_inner(&self, ptr: *c_void, inner: *TyDesc) -> bool { unsafe { - let mut u = ReprVisitor(ptr, self.writer); + let u = ReprVisitor(ptr, self.writer); let v = reflect::MovePtrAdaptor(u); visit_tydesc(inner, @v as @TyVisitor); true @@ -667,7 +667,7 @@ pub fn write_repr(writer: @Writer, object: &T) { unsafe { let ptr = ptr::to_unsafe_ptr(object) as *c_void; let tydesc = intrinsic::get_tydesc::(); - let mut u = ReprVisitor(ptr, writer); + let u = ReprVisitor(ptr, writer); let v = reflect::MovePtrAdaptor(u); visit_tydesc(tydesc, @v as @TyVisitor) } diff --git a/src/libcore/rt/uv/mod.rs b/src/libcore/rt/uv/mod.rs index 32757d6376e..4cbc8d70569 100644 --- a/src/libcore/rt/uv/mod.rs +++ b/src/libcore/rt/uv/mod.rs @@ -402,7 +402,7 @@ fn loop_smoke_test() { fn idle_new_then_close() { do run_in_bare_thread { let mut loop_ = Loop::new(); - let mut idle_watcher = { IdleWatcher::new(&mut loop_) }; + let idle_watcher = { IdleWatcher::new(&mut loop_) }; idle_watcher.close(); } } diff --git a/src/libcore/rt/uv/net.rs b/src/libcore/rt/uv/net.rs index b4a08c14928..bcfe8b2cfdf 100644 --- a/src/libcore/rt/uv/net.rs +++ b/src/libcore/rt/uv/net.rs @@ -393,7 +393,7 @@ fn connect_read() { let buf = vec_from_uv_buf(buf); rtdebug!("read cb!"); if status.is_none() { - let bytes = buf.unwrap(); + let _bytes = buf.unwrap(); rtdebug!("%s", bytes.slice(0, nread as uint).to_str()); } else { rtdebug!("status after read: %s", status.get().to_str()); diff --git a/src/libcore/rt/uvio.rs b/src/libcore/rt/uvio.rs index ff539739835..d4e547de383 100644 --- a/src/libcore/rt/uvio.rs +++ b/src/libcore/rt/uvio.rs @@ -206,7 +206,7 @@ impl TcpListener for UvTcpListener { let mut server_stream_watcher = server_stream_watcher; let mut loop_ = loop_from_watcher(&server_stream_watcher); let mut client_tcp_watcher = TcpWatcher::new(&mut loop_); - let mut client_tcp_watcher = client_tcp_watcher.as_stream(); + let client_tcp_watcher = client_tcp_watcher.as_stream(); // XXX: Need's to be surfaced in interface server_stream_watcher.accept(client_tcp_watcher); Some(~UvStream::new(client_tcp_watcher)) diff --git a/src/libcore/run.rs b/src/libcore/run.rs index 087ee6cdf85..f9d7f4a229c 100644 --- a/src/libcore/run.rs +++ b/src/libcore/run.rs @@ -343,7 +343,7 @@ pub fn start_program(prog: &str, args: &[~str]) -> @Program { fn force_destroy(&mut self) { destroy_repr(&mut self.r, true); } } - let mut repr = ProgRepr { + let repr = ProgRepr { pid: pid, in_fd: pipe_input.out, out_file: os::fdopen(pipe_output.in), diff --git a/src/libcore/str.rs b/src/libcore/str.rs index f1cacc6a348..38d68175679 100644 --- a/src/libcore/str.rs +++ b/src/libcore/str.rs @@ -673,7 +673,7 @@ pub fn levdistance(s: &str, t: &str) -> uint { for t.each_chari |j, tc| { - let mut next = dcol[j + 1]; + let next = dcol[j + 1]; if sc == tc { dcol[j + 1] = current; @@ -909,7 +909,7 @@ impl TotalOrd for @str { /// Bytewise slice less than fn lt(a: &str, b: &str) -> bool { let (a_len, b_len) = (a.len(), b.len()); - let mut end = uint::min(a_len, b_len); + let end = uint::min(a_len, b_len); let mut i = 0; while i < end { @@ -1715,7 +1715,7 @@ pub fn utf16_chars(v: &[u16], f: &fn(char)) { let len = vec::len(v); let mut i = 0u; while (i < len && v[i] != 0u16) { - let mut u = v[i]; + let u = v[i]; if u <= 0xD7FF_u16 || u >= 0xE000_u16 { f(u as char); diff --git a/src/libcore/task/spawn.rs b/src/libcore/task/spawn.rs index 118c4cc2312..d872d38a278 100644 --- a/src/libcore/task/spawn.rs +++ b/src/libcore/task/spawn.rs @@ -575,7 +575,7 @@ fn spawn_raw_oldsched(opts: TaskOpts, f: ~fn()) { }; assert!(!new_task.is_null()); // Getting killed after here would leak the task. - let mut notify_chan = if opts.notify_chan.is_none() { + let notify_chan = if opts.notify_chan.is_none() { None } else { Some(opts.notify_chan.swap_unwrap()) diff --git a/src/libcore/unstable/extfmt.rs b/src/libcore/unstable/extfmt.rs index ad3dce0a749..ee33e2ed20b 100644 --- a/src/libcore/unstable/extfmt.rs +++ b/src/libcore/unstable/extfmt.rs @@ -538,7 +538,7 @@ pub mod rt { pub fn conv_str(cv: Conv, s: &str, buf: &mut ~str) { // For strings, precision is the maximum characters // displayed - let mut unpadded = match cv.precision { + let unpadded = match cv.precision { CountImplied => s, CountIs(max) => if (max as uint) < str::char_len(s) { str::slice(s, 0, max as uint) @@ -596,7 +596,7 @@ pub mod rt { #[deriving(Eq)] pub enum PadMode { PadSigned, PadUnsigned, PadNozero, PadFloat } - pub fn pad(cv: Conv, mut s: &str, head: Option, mode: PadMode, + pub fn pad(cv: Conv, s: &str, head: Option, mode: PadMode, buf: &mut ~str) { let headsize = match head { Some(_) => 1, _ => 0 }; let uwidth : uint = match cv.width { diff --git a/src/libcore/vec.rs b/src/libcore/vec.rs index 1ef567e9cef..e478936ff65 100644 --- a/src/libcore/vec.rs +++ b/src/libcore/vec.rs @@ -1755,7 +1755,7 @@ impl TotalOrd for @[T] { fn lt(a: &[T], b: &[T]) -> bool { let (a_len, b_len) = (a.len(), b.len()); - let mut end = uint::min(a_len, b_len); + let end = uint::min(a_len, b_len); let mut i = 0; while i < end { @@ -3897,7 +3897,7 @@ mod tests { #[test] fn reversed_mut() { - let mut v2 = reversed::(~[10, 20]); + let v2 = reversed::(~[10, 20]); assert!(v2[0] == 20); assert!(v2[1] == 10); } -- cgit 1.4.1-3-g733a5