diff options
| author | Brendan Zabarauskas <bjzaba@yahoo.com.au> | 2014-01-09 21:06:55 +1100 |
|---|---|---|
| committer | Brendan Zabarauskas <bjzaba@yahoo.com.au> | 2014-01-11 10:46:00 +1100 |
| commit | 4fc0452acef1355ba566a30c5bd04ccd3b9acef2 (patch) | |
| tree | a11738f6d30837655498a8b7d2197bf01452a8f3 /src/libstd | |
| parent | ff7ecca20e116b8365d8095fa9618dc11e54cfbe (diff) | |
| download | rust-4fc0452acef1355ba566a30c5bd04ccd3b9acef2.tar.gz rust-4fc0452acef1355ba566a30c5bd04ccd3b9acef2.zip | |
Remove re-exports of std::io::stdio::{print, println} in the prelude.
The `print!` and `println!` macros are now the preferred method of printing, and so there is no reason to export the `stdio` functions in the prelude. The functions have also been replaced by their macro counterparts in the tutorial and other documentation so that newcomers don't get confused about what they should be using.
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/bool.rs | 2 | ||||
| -rw-r--r-- | src/libstd/condition.rs | 4 | ||||
| -rw-r--r-- | src/libstd/io/mod.rs | 6 | ||||
| -rw-r--r-- | src/libstd/io/signal.rs | 2 | ||||
| -rw-r--r-- | src/libstd/iter.rs | 2 | ||||
| -rw-r--r-- | src/libstd/ops.rs | 32 | ||||
| -rw-r--r-- | src/libstd/option.rs | 2 | ||||
| -rw-r--r-- | src/libstd/prelude.rs | 1 | ||||
| -rw-r--r-- | src/libstd/rand/mod.rs | 2 | ||||
| -rw-r--r-- | src/libstd/rand/reseeding.rs | 2 | ||||
| -rw-r--r-- | src/libstd/repr.rs | 1 | ||||
| -rw-r--r-- | src/libstd/str.rs | 4 | ||||
| -rw-r--r-- | src/libstd/vec.rs | 2 |
13 files changed, 31 insertions, 31 deletions
diff --git a/src/libstd/bool.rs b/src/libstd/bool.rs index a20ddc14147..d080262ccc7 100644 --- a/src/libstd/bool.rs +++ b/src/libstd/bool.rs @@ -54,7 +54,7 @@ use num::FromPrimitive; /// /// ``` /// std::bool::all_values(|x: bool| { -/// println(x.to_str()); +/// println!("{}", x); /// }) /// ``` #[inline] diff --git a/src/libstd/condition.rs b/src/libstd/condition.rs index 2ecae8e85d0..e0dc5c8b65d 100644 --- a/src/libstd/condition.rs +++ b/src/libstd/condition.rs @@ -51,8 +51,8 @@ my_error::cond.trap(|raised_int| { // condition, then the above handler will be invoked (so long as there's no // other nested handler). - println(my_error::cond.raise(3)); // prints "three" - println(my_error::cond.raise(4)); // prints "oh well" + println!("{}", my_error::cond.raise(3)); // prints "three" + println!("{}", my_error::cond.raise(4)); // prints "oh well" }) diff --git a/src/libstd/io/mod.rs b/src/libstd/io/mod.rs index 3ab710e9356..2e33bef380c 100644 --- a/src/libstd/io/mod.rs +++ b/src/libstd/io/mod.rs @@ -32,7 +32,7 @@ Some examples of obvious things you might want to do # let _g = ::std::io::ignore_io_error(); let mut stdin = BufferedReader::new(stdin()); for line in stdin.lines() { - print(line); + print!("{}", line); } ``` @@ -67,7 +67,7 @@ Some examples of obvious things you might want to do let path = Path::new("message.txt"); let mut file = BufferedReader::new(File::open(&path)); for line in file.lines() { - print(line); + print!("{}", line); } ``` @@ -204,7 +204,7 @@ io_error::cond.trap(|e: IoError| { }); if error.is_some() { - println("failed to write my diary"); + println!("failed to write my diary"); } # ::std::io::fs::unlink(&Path::new("diary.txt")); ``` diff --git a/src/libstd/io/signal.rs b/src/libstd/io/signal.rs index 4cde35796a6..34b4ed5e1ef 100644 --- a/src/libstd/io/signal.rs +++ b/src/libstd/io/signal.rs @@ -68,7 +68,7 @@ pub enum Signum { /// do spawn { /// loop { /// match listener.port.recv() { -/// Interrupt => println("Got Interrupt'ed"), +/// Interrupt => println!("Got Interrupt'ed"), /// _ => (), /// } /// } diff --git a/src/libstd/iter.rs b/src/libstd/iter.rs index 8d2ed62feb8..2056f8b33ec 100644 --- a/src/libstd/iter.rs +++ b/src/libstd/iter.rs @@ -402,7 +402,7 @@ pub trait Iterator<A> { /// .filter(|&x| x % 2 == 0) /// .inspect(|&x| debug!("{} made it through", x)) /// .sum(); - /// println(sum.to_str()); + /// println!("{}", sum); /// ``` #[inline] fn inspect<'r>(self, f: 'r |&A|) -> Inspect<'r, A, Self> { diff --git a/src/libstd/ops.rs b/src/libstd/ops.rs index fbefce71e88..a15ce4f0102 100644 --- a/src/libstd/ops.rs +++ b/src/libstd/ops.rs @@ -47,8 +47,8 @@ * } * } * fn main() { - * println(format!("{:?}", Point {x: 1, y: 0} + Point {x: 2, y: 3})); - * println(format!("{:?}", Point {x: 1, y: 0} - Point {x: 2, y: 3})); + * println!("{:?}", Point {x: 1, y: 0} + Point {x: 2, y: 3}); + * println!("{:?}", Point {x: 1, y: 0} - Point {x: 2, y: 3}); * } * ``` * @@ -72,7 +72,7 @@ * * impl Drop for HasDrop { * fn drop(&mut self) { - * println("Dropping!"); + * println!("Dropping!"); * } * } * @@ -100,7 +100,7 @@ pub trait Drop { * * impl Add<Foo, Foo> for Foo { * fn add(&self, _rhs: &Foo) -> Foo { - * println("Adding!"); + * println!("Adding!"); * *self * } * } @@ -129,7 +129,7 @@ pub trait Add<RHS,Result> { * * impl Sub<Foo, Foo> for Foo { * fn sub(&self, _rhs: &Foo) -> Foo { - * println("Subtracting!"); + * println!("Subtracting!"); * *self * } * } @@ -158,7 +158,7 @@ pub trait Sub<RHS,Result> { * * impl Mul<Foo, Foo> for Foo { * fn mul(&self, _rhs: &Foo) -> Foo { - * println("Multiplying!"); + * println!("Multiplying!"); * *self * } * } @@ -187,7 +187,7 @@ pub trait Mul<RHS,Result> { * * impl Div<Foo, Foo> for Foo { * fn div(&self, _rhs: &Foo) -> Foo { - * println("Dividing!"); + * println!("Dividing!"); * *self * } * } @@ -216,7 +216,7 @@ pub trait Div<RHS,Result> { * * impl Rem<Foo, Foo> for Foo { * fn rem(&self, _rhs: &Foo) -> Foo { - * println("Remainder-ing!"); + * println!("Remainder-ing!"); * *self * } * } @@ -245,7 +245,7 @@ pub trait Rem<RHS,Result> { * * impl Neg<Foo> for Foo { * fn neg(&self) -> Foo { - * println("Negating!"); + * println!("Negating!"); * *self * } * } @@ -274,7 +274,7 @@ pub trait Neg<Result> { * * impl Not<Foo> for Foo { * fn not(&self) -> Foo { - * println("Not-ing!"); + * println!("Not-ing!"); * *self * } * } @@ -303,7 +303,7 @@ pub trait Not<Result> { * * impl BitAnd<Foo, Foo> for Foo { * fn bitand(&self, _rhs: &Foo) -> Foo { - * println("Bitwise And-ing!"); + * println!("Bitwise And-ing!"); * *self * } * } @@ -332,7 +332,7 @@ pub trait BitAnd<RHS,Result> { * * impl BitOr<Foo, Foo> for Foo { * fn bitor(&self, _rhs: &Foo) -> Foo { - * println("Bitwise Or-ing!"); + * println!("Bitwise Or-ing!"); * *self * } * } @@ -361,7 +361,7 @@ pub trait BitOr<RHS,Result> { * * impl BitXor<Foo, Foo> for Foo { * fn bitxor(&self, _rhs: &Foo) -> Foo { - * println("Bitwise Xor-ing!"); + * println!("Bitwise Xor-ing!"); * *self * } * } @@ -390,7 +390,7 @@ pub trait BitXor<RHS,Result> { * * impl Shl<Foo, Foo> for Foo { * fn shl(&self, _rhs: &Foo) -> Foo { - * println("Shifting left!"); + * println!("Shifting left!"); * *self * } * } @@ -419,7 +419,7 @@ pub trait Shl<RHS,Result> { * * impl Shr<Foo, Foo> for Foo { * fn shr(&self, _rhs: &Foo) -> Foo { - * println("Shifting right!"); + * println!("Shifting right!"); * *self * } * } @@ -449,7 +449,7 @@ pub trait Shr<RHS,Result> { * * impl Index<Foo, Foo> for Foo { * fn index(&self, _rhs: &Foo) -> Foo { - * println("Indexing!"); + * println!("Indexing!"); * *self * } * } diff --git a/src/libstd/option.rs b/src/libstd/option.rs index 7ce9873c2da..bdec67e5d9f 100644 --- a/src/libstd/option.rs +++ b/src/libstd/option.rs @@ -26,7 +26,7 @@ //! //! // Take a reference to the contained string //! match msg { -//! Some(ref m) => io::println(*m), +//! Some(ref m) => println!("{}", *m), //! None => () //! } //! diff --git a/src/libstd/prelude.rs b/src/libstd/prelude.rs index 36bcc81c06d..9045bafbe45 100644 --- a/src/libstd/prelude.rs +++ b/src/libstd/prelude.rs @@ -40,7 +40,6 @@ pub use result::{Result, Ok, Err}; // Reexported functions pub use from_str::from_str; pub use iter::range; -pub use io::stdio::{print, println}; // Reexported types and traits diff --git a/src/libstd/rand/mod.rs b/src/libstd/rand/mod.rs index e52a3850011..f9bd291fbf4 100644 --- a/src/libstd/rand/mod.rs +++ b/src/libstd/rand/mod.rs @@ -244,7 +244,7 @@ pub trait Rng { /// ```rust /// use std::rand::{task_rng, Rng}; /// - /// println(task_rng().gen_ascii_str(10)); + /// println!("{}", task_rng().gen_ascii_str(10)); /// ``` fn gen_ascii_str(&mut self, len: uint) -> ~str { static GEN_ASCII_STR_CHARSET: &'static [u8] = bytes!("ABCDEFGHIJKLMNOPQRSTUVWXYZ\ diff --git a/src/libstd/rand/reseeding.rs b/src/libstd/rand/reseeding.rs index c0a7d14bf70..758ca22e5c3 100644 --- a/src/libstd/rand/reseeding.rs +++ b/src/libstd/rand/reseeding.rs @@ -118,7 +118,7 @@ impl<S, R: SeedableRng<S>, Rsdr: Reseeder<R>> /// let mut rng = ReseedingRng::new(rand::StdRng::new(), 10, rsdr); /// /// // this will repeat, because it gets reseeded very regularly. -/// println(rng.gen_ascii_str(100)); +/// println!("{}", rng.gen_ascii_str(100)); /// } /// /// ``` diff --git a/src/libstd/repr.rs b/src/libstd/repr.rs index 888eed0e762..e0f96365edd 100644 --- a/src/libstd/repr.rs +++ b/src/libstd/repr.rs @@ -634,6 +634,7 @@ fn test_repr() { use prelude::*; use str; use str::Str; + use io::stdio::println; use util::swap; use char::is_alphabetic; diff --git a/src/libstd/str.rs b/src/libstd/str.rs index 35e188964c1..8b6e1520dc7 100644 --- a/src/libstd/str.rs +++ b/src/libstd/str.rs @@ -1591,8 +1591,8 @@ pub trait StrSlice<'a> { /// assert_eq!(d.len(), 23); /// /// // the two strings *look* the same - /// println(c); - /// println(d); + /// println!("{}", c); + /// println!("{}", d); /// ``` fn char_len(&self) -> uint; diff --git a/src/libstd/vec.rs b/src/libstd/vec.rs index 9964c6842ab..257a1e6340f 100644 --- a/src/libstd/vec.rs +++ b/src/libstd/vec.rs @@ -1317,7 +1317,7 @@ pub trait OwnedVector<T> { /// let v = ~[~"a", ~"b"]; /// for s in v.move_iter() { /// // s has type ~str, not &~str - /// println(s); + /// println!("{}", s); /// } /// ``` fn move_iter(self) -> MoveIterator<T>; |
