about summary refs log tree commit diff
path: root/src/libcore
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2015-02-02 11:01:12 -0800
committerAlex Crichton <alex@alexcrichton.com>2015-02-02 11:01:12 -0800
commit7335c7dd63cafe70ffca76677f9e33bc6eccefaa (patch)
tree3646a5159f74b47d8bdf471eff072ea71f395d82 /src/libcore
parent075588a4939acb47feea79779a9bdacce702d9c5 (diff)
parent3484706c38272828efc50b2553578afc62230dbb (diff)
downloadrust-7335c7dd63cafe70ffca76677f9e33bc6eccefaa.tar.gz
rust-7335c7dd63cafe70ffca76677f9e33bc6eccefaa.zip
rollup merge of #21830: japaric/for-cleanup
Conflicts:
	src/librustc/metadata/filesearch.rs
	src/librustc_back/target/mod.rs
	src/libstd/os.rs
	src/libstd/sys/windows/os.rs
	src/libsyntax/ext/tt/macro_parser.rs
	src/libsyntax/print/pprust.rs
	src/test/compile-fail/issue-2149.rs
Diffstat (limited to 'src/libcore')
-rw-r--r--src/libcore/array.rs3
-rw-r--r--src/libcore/fmt/mod.rs57
-rw-r--r--src/libcore/fmt/rt/v1.rs13
-rw-r--r--src/libcore/hash/mod.rs2
-rw-r--r--src/libcore/iter.rs14
-rw-r--r--src/libcore/lib.rs1
-rw-r--r--src/libcore/ops.rs17
-rw-r--r--src/libcore/prelude.rs3
-rw-r--r--src/libcore/result.rs2
-rw-r--r--src/libcore/slice.rs13
-rw-r--r--src/libcore/str/mod.rs10
11 files changed, 11 insertions, 124 deletions
diff --git a/src/libcore/array.rs b/src/libcore/array.rs
index ec3d9783255..5c4567e567b 100644
--- a/src/libcore/array.rs
+++ b/src/libcore/array.rs
@@ -20,9 +20,6 @@ use fmt;
 use hash::{Hash, Hasher, self};
 use iter::IntoIterator;
 use marker::Copy;
-#[cfg(stage0)]
-use ops::{Deref, FullRange};
-#[cfg(not(stage0))]
 use ops::Deref;
 use option::Option;
 use slice::{Iter, IterMut, SliceExt};
diff --git a/src/libcore/fmt/mod.rs b/src/libcore/fmt/mod.rs
index 2ff67ebd550..ead49af18d0 100644
--- a/src/libcore/fmt/mod.rs
+++ b/src/libcore/fmt/mod.rs
@@ -38,7 +38,6 @@ mod float;
 #[stable(feature = "rust1", since = "1.0.0")]
 #[doc(hidden)]
 pub mod rt {
-    #[cfg(stage0)] pub use self::v1::*;
     pub mod v1;
 }
 
@@ -191,20 +190,6 @@ impl<'a> Arguments<'a> {
         }
     }
 
-    /// When using the format_args!() macro, this function is used to generate the
-    /// Arguments structure.
-    #[doc(hidden)] #[inline]
-    #[cfg(stage0)]
-    #[stable(feature = "rust1", since = "1.0.0")]
-    pub fn new(pieces: &'a [&'a str],
-               args: &'a [ArgumentV1<'a>]) -> Arguments<'a> {
-        Arguments {
-            pieces: pieces,
-            fmt: None,
-            args: args
-        }
-    }
-
     /// This function is used to specify nonstandard formatting parameters.
     /// The `pieces` array must be at least as long as `fmt` to construct
     /// a valid Arguments structure. Also, any `Count` within `fmt` that is
@@ -212,25 +197,6 @@ impl<'a> Arguments<'a> {
     /// created with `argumentuint`. However, failing to do so doesn't cause
     /// unsafety, but will ignore invalid .
     #[doc(hidden)] #[inline]
-    #[cfg(stage0)]
-    #[stable(feature = "rust1", since = "1.0.0")]
-    pub fn with_placeholders(pieces: &'a [&'a str],
-                             fmt: &'a [rt::v1::Argument],
-                             args: &'a [ArgumentV1<'a>]) -> Arguments<'a> {
-        Arguments {
-            pieces: pieces,
-            fmt: Some(fmt),
-            args: args
-        }
-    }
-    /// This function is used to specify nonstandard formatting parameters.
-    /// The `pieces` array must be at least as long as `fmt` to construct
-    /// a valid Arguments structure. Also, any `Count` within `fmt` that is
-    /// `CountIsParam` or `CountIsNextParam` has to point to an argument
-    /// created with `argumentuint`. However, failing to do so doesn't cause
-    /// unsafety, but will ignore invalid .
-    #[doc(hidden)] #[inline]
-    #[cfg(not(stage0))]
     pub fn new_v1_formatted(pieces: &'a [&'a str],
                             args: &'a [ArgumentV1<'a>],
                             fmt: &'a [rt::v1::Argument]) -> Arguments<'a> {
@@ -516,7 +482,7 @@ impl<'a> Formatter<'a> {
 
         // Writes the sign if it exists, and then the prefix if it was requested
         let write_prefix = |&: f: &mut Formatter| {
-            for c in sign.into_iter() {
+            if let Some(c) = sign {
                 let mut b = [0; 4];
                 let n = c.encode_utf8(&mut b).unwrap_or(0);
                 let b = unsafe { str::from_utf8_unchecked(&b[..n]) };
@@ -684,25 +650,6 @@ impl Display for Error {
     }
 }
 
-/// This is a function which calls are emitted to by the compiler itself to
-/// create the Argument structures that are passed into the `format` function.
-#[doc(hidden)] #[inline]
-#[cfg(stage0)]
-#[stable(feature = "rust1", since = "1.0.0")]
-pub fn argument<'a, T>(f: fn(&T, &mut Formatter) -> Result,
-                       t: &'a T) -> ArgumentV1<'a> {
-    ArgumentV1::new(t, f)
-}
-
-/// When the compiler determines that the type of an argument *must* be a uint
-/// (such as for width and precision), then it invokes this method.
-#[doc(hidden)] #[inline]
-#[cfg(stage0)]
-#[stable(feature = "rust1", since = "1.0.0")]
-pub fn argumentuint<'a>(s: &'a uint) -> ArgumentV1<'a> {
-    ArgumentV1::from_uint(s)
-}
-
 // Implementations of the core formatting traits
 
 macro_rules! fmt_refs {
@@ -941,7 +888,7 @@ impl<T: Debug> Debug for [T] {
             try!(write!(f, "["));
         }
         let mut is_first = true;
-        for x in self.iter() {
+        for x in self {
             if is_first {
                 is_first = false;
             } else {
diff --git a/src/libcore/fmt/rt/v1.rs b/src/libcore/fmt/rt/v1.rs
index f0c82759b70..0c9bb6316e0 100644
--- a/src/libcore/fmt/rt/v1.rs
+++ b/src/libcore/fmt/rt/v1.rs
@@ -16,19 +16,6 @@
 
 #![stable(feature = "rust1", since = "1.0.0")]
 
-#[cfg(stage0)] pub use self::Position::*;
-
-#[cfg(stage0)] pub use self::Alignment::Left as AlignLeft;
-#[cfg(stage0)] pub use self::Alignment::Right as AlignRight;
-#[cfg(stage0)] pub use self::Alignment::Center as AlignCenter;
-#[cfg(stage0)] pub use self::Alignment::Unknown as AlignUnknown;
-#[cfg(stage0)] pub use self::Count::Is as CountIs;
-#[cfg(stage0)] pub use self::Count::Implied as CountImplied;
-#[cfg(stage0)] pub use self::Count::Param as CountIsParam;
-#[cfg(stage0)] pub use self::Count::NextParam as CountIsNextParam;
-#[cfg(stage0)] pub use self::Position::Next as ArgumentNext;
-#[cfg(stage0)] pub use self::Position::At as ArgumentIs;
-
 #[derive(Copy)]
 #[stable(feature = "rust1", since = "1.0.0")]
 pub struct Argument {
diff --git a/src/libcore/hash/mod.rs b/src/libcore/hash/mod.rs
index 5a4d2fffade..d73e6ed589f 100644
--- a/src/libcore/hash/mod.rs
+++ b/src/libcore/hash/mod.rs
@@ -205,7 +205,7 @@ impl<S: Writer + Hasher, T: Hash<S>> Hash<S> for [T] {
     #[inline]
     fn hash(&self, state: &mut S) {
         self.len().hash(state);
-        for elt in self.iter() {
+        for elt in self {
             elt.hash(state);
         }
     }
diff --git a/src/libcore/iter.rs b/src/libcore/iter.rs
index c782452d4cf..b954e69eaa8 100644
--- a/src/libcore/iter.rs
+++ b/src/libcore/iter.rs
@@ -174,7 +174,7 @@ pub trait IteratorExt: Iterator + Sized {
     /// ```
     #[inline]
     #[stable(feature = "rust1", since = "1.0.0")]
-    fn last(mut self) -> Option<Self::Item> {
+    fn last(self) -> Option<Self::Item> {
         let mut last = None;
         for x in self { last = Some(x); }
         last
@@ -588,7 +588,7 @@ pub trait IteratorExt: Iterator + Sized {
     /// ```
     #[unstable(feature = "core",
                reason = "recently added as part of collections reform")]
-    fn partition<B, F>(mut self, mut f: F) -> (B, B) where
+    fn partition<B, F>(self, mut f: F) -> (B, B) where
         B: Default + Extend<Self::Item>,
         F: FnMut(&Self::Item) -> bool
     {
@@ -617,7 +617,7 @@ pub trait IteratorExt: Iterator + Sized {
     /// ```
     #[inline]
     #[stable(feature = "rust1", since = "1.0.0")]
-    fn fold<B, F>(mut self, init: B, mut f: F) -> B where
+    fn fold<B, F>(self, init: B, mut f: F) -> B where
         F: FnMut(B, Self::Item) -> B,
     {
         let mut accum = init;
@@ -638,7 +638,7 @@ pub trait IteratorExt: Iterator + Sized {
     /// ```
     #[inline]
     #[stable(feature = "rust1", since = "1.0.0")]
-    fn all<F>(mut self, mut f: F) -> bool where F: FnMut(Self::Item) -> bool {
+    fn all<F>(self, mut f: F) -> bool where F: FnMut(Self::Item) -> bool {
         for x in self { if !f(x) { return false; } }
         true
     }
@@ -946,7 +946,7 @@ pub trait IteratorExt: Iterator + Sized {
     /// assert_eq!([2, 4], right);
     /// ```
     #[unstable(feature = "core", reason = "recent addition")]
-    fn unzip<A, B, FromA, FromB>(mut self) -> (FromA, FromB) where
+    fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB) where
         FromA: Default + Extend<A>,
         FromB: Default + Extend<B>,
         Self: Iterator<Item=(A, B)>,
@@ -2205,7 +2205,7 @@ impl<A, B, I, U, F> Iterator for FlatMap<A, B, I, U, F> where
     #[inline]
     fn next(&mut self) -> Option<B> {
         loop {
-            for inner in self.frontiter.iter_mut() {
+            if let Some(ref mut inner) = self.frontiter {
                 for x in inner.by_ref() {
                     return Some(x)
                 }
@@ -2238,7 +2238,7 @@ impl<A, B, I, U, F> DoubleEndedIterator for FlatMap<A, B, I, U, F> where
     #[inline]
     fn next_back(&mut self) -> Option<B> {
         loop {
-            for inner in self.backiter.iter_mut() {
+            if let Some(ref mut inner) = self.backiter {
                 match inner.next_back() {
                     None => (),
                     y => return y
diff --git a/src/libcore/lib.rs b/src/libcore/lib.rs
index d2bc30fa74a..5e9793f270d 100644
--- a/src/libcore/lib.rs
+++ b/src/libcore/lib.rs
@@ -59,7 +59,6 @@
 #![no_std]
 #![allow(raw_pointer_derive)]
 #![deny(missing_docs)]
-#![cfg_attr(not(stage0), allow(unused_mut))] // NOTE: remove after stage0 snap
 
 #![feature(int_uint)]
 #![feature(intrinsics, lang_items)]
diff --git a/src/libcore/ops.rs b/src/libcore/ops.rs
index f656fd4b8b9..7af94c73f32 100644
--- a/src/libcore/ops.rs
+++ b/src/libcore/ops.rs
@@ -947,28 +947,11 @@ pub trait IndexMut<Index: ?Sized> {
 }
 
 /// An unbounded range.
-#[cfg(stage0)]
-#[derive(Copy, Clone, PartialEq, Eq)]
-#[lang="full_range"]
-#[unstable(feature = "core", reason  = "may be renamed to RangeFull")]
-pub struct FullRange;
-
-/// An unbounded range.
-#[cfg(not(stage0))]
 #[derive(Copy, Clone, PartialEq, Eq)]
 #[lang="range_full"]
 #[stable(feature = "rust1", since = "1.0.0")]
 pub struct RangeFull;
 
-#[cfg(stage0)]
-#[stable(feature = "rust1", since = "1.0.0")]
-impl fmt::Debug for FullRange {
-    fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
-        fmt::Debug::fmt("..", fmt)
-    }
-}
-
-#[cfg(not(stage0))]
 #[stable(feature = "rust1", since = "1.0.0")]
 impl fmt::Debug for RangeFull {
     fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
diff --git a/src/libcore/prelude.rs b/src/libcore/prelude.rs
index 9d253178664..f4b1a0633de 100644
--- a/src/libcore/prelude.rs
+++ b/src/libcore/prelude.rs
@@ -26,9 +26,6 @@
 
 // Reexported core operators
 pub use marker::{Copy, Send, Sized, Sync};
-#[cfg(stage0)]
-pub use ops::{Drop, Fn, FnMut, FnOnce, FullRange};
-#[cfg(not(stage0))]
 pub use ops::{Drop, Fn, FnMut, FnOnce};
 
 // Reexported functions
diff --git a/src/libcore/result.rs b/src/libcore/result.rs
index fc7d4e868f7..d610962f862 100644
--- a/src/libcore/result.rs
+++ b/src/libcore/result.rs
@@ -956,7 +956,7 @@ pub fn fold<T,
             E,
             F: FnMut(V, T) -> V,
             Iter: Iterator<Item=Result<T, E>>>(
-            mut iterator: Iter,
+            iterator: Iter,
             mut init: V,
             mut f: F)
             -> Result<V, E> {
diff --git a/src/libcore/slice.rs b/src/libcore/slice.rs
index a368ddba9bc..a750e81bf59 100644
--- a/src/libcore/slice.rs
+++ b/src/libcore/slice.rs
@@ -43,9 +43,6 @@ use default::Default;
 use iter::*;
 use num::Int;
 use ops::{FnMut, self, Index};
-#[cfg(stage0)]
-use ops::FullRange as RangeFull;
-#[cfg(not(stage0))]
 use ops::RangeFull;
 use option::Option;
 use option::Option::{None, Some};
@@ -769,16 +766,6 @@ impl<'a, T> ops::Index<ops::RangeFrom<uint>> for Iter<'a, T> {
     }
 }
 
-#[cfg(stage0)]
-#[unstable(feature = "core")]
-impl<'a, T> ops::Index<ops::FullRange> for Iter<'a, T> {
-    type Output = [T];
-    #[inline]
-    fn index(&self, _index: &ops::FullRange) -> &[T] {
-        self.as_slice()
-    }
-}
-#[cfg(not(stage0))]
 #[unstable(feature = "core")]
 impl<'a, T> ops::Index<RangeFull> for Iter<'a, T> {
     type Output = [T];
diff --git a/src/libcore/str/mod.rs b/src/libcore/str/mod.rs
index cb7af3b3d35..026f708b305 100644
--- a/src/libcore/str/mod.rs
+++ b/src/libcore/str/mod.rs
@@ -1266,16 +1266,6 @@ mod traits {
         }
     }
 
-    #[cfg(stage0)]
-    #[stable(feature = "rust1", since = "1.0.0")]
-    impl ops::Index<ops::FullRange> for str {
-        type Output = str;
-        #[inline]
-        fn index(&self, _index: &ops::FullRange) -> &str {
-            self
-        }
-    }
-    #[cfg(not(stage0))]
     #[stable(feature = "rust1", since = "1.0.0")]
     impl ops::Index<ops::RangeFull> for str {
         type Output = str;