Skip to content

Commit 13537d2

Browse files
committed
core: remove unused 'mut' variables
1 parent d1985c9 commit 13537d2

File tree

13 files changed

+18
-18
lines changed

13 files changed

+18
-18
lines changed

src/libcore/cell.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ fn test_with_ref() {
121121
#[test]
122122
fn test_with_mut_ref() {
123123
let good = ~[1, 2, 3];
124-
let mut v = ~[1, 2];
124+
let v = ~[1, 2];
125125
let c = Cell(v);
126126
do c.with_mut_ref() |v| { v.push(3); }
127127
let v = c.take();

src/libcore/flate.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ pub fn deflate_bytes(bytes: &const [u8]) -> ~[u8] {
6767
pub fn inflate_bytes(bytes: &const [u8]) -> ~[u8] {
6868
do vec::as_const_buf(bytes) |b, len| {
6969
unsafe {
70-
let mut outsz : size_t = 0;
70+
let outsz : size_t = 0;
7171
let res =
7272
rustrt::tinfl_decompress_mem_to_heap(b as *c_void,
7373
len as size_t,

src/libcore/path.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -844,7 +844,7 @@ pub mod windows {
844844
while i < s.len() {
845845
if is_sep(s[i]) {
846846
let pre = s.slice(2, i).to_owned();
847-
let mut rest = s.slice(i, s.len()).to_owned();
847+
let rest = s.slice(i, s.len()).to_owned();
848848
return Some((pre, rest));
849849
}
850850
i += 1;

src/libcore/rand.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -693,7 +693,7 @@ struct XorShiftState {
693693
impl Rng for XorShiftState {
694694
fn next(&self) -> u32 {
695695
let x = self.x;
696-
let mut t = x ^ (x << 11);
696+
let t = x ^ (x << 11);
697697
self.x = self.y;
698698
self.y = self.z;
699699
self.z = self.w;

src/libcore/repr.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ pub impl ReprVisitor {
210210
#[inline(always)]
211211
fn visit_ptr_inner(&self, ptr: *c_void, inner: *TyDesc) -> bool {
212212
unsafe {
213-
let mut u = ReprVisitor(ptr, self.writer);
213+
let u = ReprVisitor(ptr, self.writer);
214214
let v = reflect::MovePtrAdaptor(u);
215215
visit_tydesc(inner, @v as @TyVisitor);
216216
true
@@ -667,7 +667,7 @@ pub fn write_repr<T>(writer: @Writer, object: &T) {
667667
unsafe {
668668
let ptr = ptr::to_unsafe_ptr(object) as *c_void;
669669
let tydesc = intrinsic::get_tydesc::<T>();
670-
let mut u = ReprVisitor(ptr, writer);
670+
let u = ReprVisitor(ptr, writer);
671671
let v = reflect::MovePtrAdaptor(u);
672672
visit_tydesc(tydesc, @v as @TyVisitor)
673673
}

src/libcore/rt/uv/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ fn loop_smoke_test() {
402402
fn idle_new_then_close() {
403403
do run_in_bare_thread {
404404
let mut loop_ = Loop::new();
405-
let mut idle_watcher = { IdleWatcher::new(&mut loop_) };
405+
let idle_watcher = { IdleWatcher::new(&mut loop_) };
406406
idle_watcher.close();
407407
}
408408
}

src/libcore/rt/uv/net.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ fn connect_read() {
393393
let buf = vec_from_uv_buf(buf);
394394
rtdebug!("read cb!");
395395
if status.is_none() {
396-
let bytes = buf.unwrap();
396+
let _bytes = buf.unwrap();
397397
rtdebug!("%s", bytes.slice(0, nread as uint).to_str());
398398
} else {
399399
rtdebug!("status after read: %s", status.get().to_str());

src/libcore/rt/uvio.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ impl TcpListener for UvTcpListener {
206206
let mut server_stream_watcher = server_stream_watcher;
207207
let mut loop_ = loop_from_watcher(&server_stream_watcher);
208208
let mut client_tcp_watcher = TcpWatcher::new(&mut loop_);
209-
let mut client_tcp_watcher = client_tcp_watcher.as_stream();
209+
let client_tcp_watcher = client_tcp_watcher.as_stream();
210210
// XXX: Need's to be surfaced in interface
211211
server_stream_watcher.accept(client_tcp_watcher);
212212
Some(~UvStream::new(client_tcp_watcher))

src/libcore/run.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ pub fn start_program(prog: &str, args: &[~str]) -> @Program {
343343
fn force_destroy(&mut self) { destroy_repr(&mut self.r, true); }
344344
}
345345

346-
let mut repr = ProgRepr {
346+
let repr = ProgRepr {
347347
pid: pid,
348348
in_fd: pipe_input.out,
349349
out_file: os::fdopen(pipe_output.in),

src/libcore/str.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -673,7 +673,7 @@ pub fn levdistance(s: &str, t: &str) -> uint {
673673

674674
for t.each_chari |j, tc| {
675675

676-
let mut next = dcol[j + 1];
676+
let next = dcol[j + 1];
677677

678678
if sc == tc {
679679
dcol[j + 1] = current;
@@ -909,7 +909,7 @@ impl TotalOrd for @str {
909909
/// Bytewise slice less than
910910
fn lt(a: &str, b: &str) -> bool {
911911
let (a_len, b_len) = (a.len(), b.len());
912-
let mut end = uint::min(a_len, b_len);
912+
let end = uint::min(a_len, b_len);
913913

914914
let mut i = 0;
915915
while i < end {
@@ -1715,7 +1715,7 @@ pub fn utf16_chars(v: &[u16], f: &fn(char)) {
17151715
let len = vec::len(v);
17161716
let mut i = 0u;
17171717
while (i < len && v[i] != 0u16) {
1718-
let mut u = v[i];
1718+
let u = v[i];
17191719

17201720
if u <= 0xD7FF_u16 || u >= 0xE000_u16 {
17211721
f(u as char);

src/libcore/task/spawn.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -575,7 +575,7 @@ fn spawn_raw_oldsched(opts: TaskOpts, f: ~fn()) {
575575
};
576576
assert!(!new_task.is_null());
577577
// Getting killed after here would leak the task.
578-
let mut notify_chan = if opts.notify_chan.is_none() {
578+
let notify_chan = if opts.notify_chan.is_none() {
579579
None
580580
} else {
581581
Some(opts.notify_chan.swap_unwrap())

src/libcore/unstable/extfmt.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -538,7 +538,7 @@ pub mod rt {
538538
pub fn conv_str(cv: Conv, s: &str, buf: &mut ~str) {
539539
// For strings, precision is the maximum characters
540540
// displayed
541-
let mut unpadded = match cv.precision {
541+
let unpadded = match cv.precision {
542542
CountImplied => s,
543543
CountIs(max) => if (max as uint) < str::char_len(s) {
544544
str::slice(s, 0, max as uint)
@@ -596,7 +596,7 @@ pub mod rt {
596596
#[deriving(Eq)]
597597
pub enum PadMode { PadSigned, PadUnsigned, PadNozero, PadFloat }
598598
599-
pub fn pad(cv: Conv, mut s: &str, head: Option<char>, mode: PadMode,
599+
pub fn pad(cv: Conv, s: &str, head: Option<char>, mode: PadMode,
600600
buf: &mut ~str) {
601601
let headsize = match head { Some(_) => 1, _ => 0 };
602602
let uwidth : uint = match cv.width {

src/libcore/vec.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1755,7 +1755,7 @@ impl<T: TotalOrd> TotalOrd for @[T] {
17551755

17561756
fn lt<T:Ord>(a: &[T], b: &[T]) -> bool {
17571757
let (a_len, b_len) = (a.len(), b.len());
1758-
let mut end = uint::min(a_len, b_len);
1758+
let end = uint::min(a_len, b_len);
17591759

17601760
let mut i = 0;
17611761
while i < end {
@@ -3897,7 +3897,7 @@ mod tests {
38973897

38983898
#[test]
38993899
fn reversed_mut() {
3900-
let mut v2 = reversed::<int>(~[10, 20]);
3900+
let v2 = reversed::<int>(~[10, 20]);
39013901
assert!(v2[0] == 20);
39023902
assert!(v2[1] == 10);
39033903
}

0 commit comments

Comments
 (0)