From 400075d9d9b6410c9f7952ca52c35806b46b3177 Mon Sep 17 00:00:00 2001 From: Isaac van Bakel Date: Tue, 1 Aug 2017 13:03:03 +0100 Subject: Fixed all unnecessary muts in language core --- src/libcore/ops/function.rs | 2 +- src/libcore/option.rs | 2 +- src/libcore/result.rs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src/libcore') diff --git a/src/libcore/ops/function.rs b/src/libcore/ops/function.rs index 62bf69336a3..c5b3fbca1a6 100644 --- a/src/libcore/ops/function.rs +++ b/src/libcore/ops/function.rs @@ -187,7 +187,7 @@ mod impls { where F : FnMut { type Output = F::Output; - extern "rust-call" fn call_once(mut self, args: A) -> F::Output { + extern "rust-call" fn call_once(self, args: A) -> F::Output { (*self).call_mut(args) } } diff --git a/src/libcore/option.rs b/src/libcore/option.rs index ef41b679410..aecf2ee9325 100644 --- a/src/libcore/option.rs +++ b/src/libcore/option.rs @@ -872,7 +872,7 @@ impl<'a, T> IntoIterator for &'a mut Option { type Item = &'a mut T; type IntoIter = IterMut<'a, T>; - fn into_iter(mut self) -> IterMut<'a, T> { + fn into_iter(self) -> IterMut<'a, T> { self.iter_mut() } } diff --git a/src/libcore/result.rs b/src/libcore/result.rs index 88a93492de9..20cfb02afcc 100644 --- a/src/libcore/result.rs +++ b/src/libcore/result.rs @@ -909,7 +909,7 @@ impl<'a, T, E> IntoIterator for &'a mut Result { type Item = &'a mut T; type IntoIter = IterMut<'a, T>; - fn into_iter(mut self) -> IterMut<'a, T> { + fn into_iter(self) -> IterMut<'a, T> { self.iter_mut() } } -- cgit 1.4.1-3-g733a5 From 9c854db82b767ddd228dbff1e51bb3eed87464b4 Mon Sep 17 00:00:00 2001 From: Isaac van Bakel Date: Wed, 2 Aug 2017 15:16:20 +0100 Subject: Fixed errors in libstd. --- src/libcore/tests/slice.rs | 12 ++++++------ src/libstd/error.rs | 2 +- src/libstd/io/cursor.rs | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) (limited to 'src/libcore') diff --git a/src/libcore/tests/slice.rs b/src/libcore/tests/slice.rs index e5d6b53b570..8c31d2e83d3 100644 --- a/src/libcore/tests/slice.rs +++ b/src/libcore/tests/slice.rs @@ -105,27 +105,27 @@ fn test_chunks_last() { #[test] fn test_chunks_mut_count() { - let mut v: &mut [i32] = &mut [0, 1, 2, 3, 4, 5]; + let v: &mut [i32] = &mut [0, 1, 2, 3, 4, 5]; let c = v.chunks_mut(3); assert_eq!(c.count(), 2); - let mut v2: &mut [i32] = &mut [0, 1, 2, 3, 4]; + let v2: &mut [i32] = &mut [0, 1, 2, 3, 4]; let c2 = v2.chunks_mut(2); assert_eq!(c2.count(), 3); - let mut v3: &mut [i32] = &mut []; + let v3: &mut [i32] = &mut []; let c3 = v3.chunks_mut(2); assert_eq!(c3.count(), 0); } #[test] fn test_chunks_mut_nth() { - let mut v: &mut [i32] = &mut [0, 1, 2, 3, 4, 5]; + let v: &mut [i32] = &mut [0, 1, 2, 3, 4, 5]; let mut c = v.chunks_mut(2); assert_eq!(c.nth(1).unwrap()[1], 3); assert_eq!(c.next().unwrap()[0], 4); - let mut v2: &mut [i32] = &mut [0, 1, 2, 3, 4]; + let v2: &mut [i32] = &mut [0, 1, 2, 3, 4]; let mut c2 = v2.chunks_mut(3); assert_eq!(c2.nth(1).unwrap()[1], 4); assert_eq!(c2.next(), None); @@ -194,7 +194,7 @@ fn get_range() { #[test] fn get_mut_range() { - let mut v: &mut [i32] = &mut [0, 1, 2, 3, 4, 5]; + let v: &mut [i32] = &mut [0, 1, 2, 3, 4, 5]; assert_eq!(v.get_mut(..), Some(&mut [0, 1, 2, 3, 4, 5][..])); assert_eq!(v.get_mut(..2), Some(&mut [0, 1][..])); assert_eq!(v.get_mut(2..), Some(&mut [2, 3, 4, 5][..])); diff --git a/src/libstd/error.rs b/src/libstd/error.rs index d1c2bfb96b3..401552a6ec4 100644 --- a/src/libstd/error.rs +++ b/src/libstd/error.rs @@ -514,7 +514,7 @@ mod tests { #[test] fn downcasting() { let mut a = A; - let mut a = &mut a as &mut (Error + 'static); + let a = &mut a as &mut (Error + 'static); assert_eq!(a.downcast_ref::(), Some(&A)); assert_eq!(a.downcast_ref::(), None); assert_eq!(a.downcast_mut::(), Some(&mut A)); diff --git a/src/libstd/io/cursor.rs b/src/libstd/io/cursor.rs index 616b4f47ed3..d986021a18b 100644 --- a/src/libstd/io/cursor.rs +++ b/src/libstd/io/cursor.rs @@ -456,7 +456,7 @@ mod tests { #[test] fn test_slice_reader() { let in_buf = vec![0, 1, 2, 3, 4, 5, 6, 7]; - let mut reader = &mut &in_buf[..]; + let reader = &mut &in_buf[..]; let mut buf = []; assert_eq!(reader.read(&mut buf).unwrap(), 0); let mut buf = [0]; -- cgit 1.4.1-3-g733a5