Skip to content

Commit

Permalink
Remove deriving(ToStr)
Browse files Browse the repository at this point in the history
This has been superseded by deriving(Show).

cc #9806
  • Loading branch information
alexcrichton committed Feb 24, 2014
1 parent b78b749 commit 8761f79
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 159 deletions.
8 changes: 4 additions & 4 deletions src/libcollections/btree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -405,8 +405,8 @@ impl<K: fmt::Show + TotalOrd, V: fmt::Show> fmt::Show for Leaf<K, V> {
///Returns a string representation of a Leaf.
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
for (i, s) in self.elts.iter().enumerate() {
if i != 0 { if_ok!(write!(f.buf, " // ")) }
if_ok!(write!(f.buf, "{}", *s))
if i != 0 { try!(write!(f.buf, " // ")) }
try!(write!(f.buf, "{}", *s))
}
Ok(())
}
Expand Down Expand Up @@ -626,8 +626,8 @@ impl<K: fmt::Show + TotalOrd, V: fmt::Show> fmt::Show for Branch<K, V> {
///Returns a string representation of a Branch.
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
for (i, s) in self.elts.iter().enumerate() {
if i != 0 { if_ok!(write!(f.buf, " // ")) }
if_ok!(write!(f.buf, "{}", *s))
if i != 0 { try!(write!(f.buf, " // ")) }
try!(write!(f.buf, "{}", *s))
}
write!(f.buf, " // rightmost child: ({}) ", *self.rightmost_child)
}
Expand Down
14 changes: 7 additions & 7 deletions src/libcollections/lru_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -222,24 +222,24 @@ impl<A: fmt::Show + Hash + Eq, B: fmt::Show> fmt::Show for LruCache<A, B> {
/// Return a string that lists the key-value pairs from most-recently
/// used to least-recently used.
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
if_ok!(write!(f.buf, r"\{"));
try!(write!(f.buf, r"\{"));
let mut cur = self.head;
for i in range(0, self.len()) {
if i > 0 { if_ok!(write!(f.buf, ", ")) }
if i > 0 { try!(write!(f.buf, ", ")) }
unsafe {
cur = (*cur).next;
match (*cur).key {
// should never print nil
None => if_ok!(write!(f.buf, "nil")),
Some(ref k) => if_ok!(write!(f.buf, "{}", *k)),
None => try!(write!(f.buf, "nil")),
Some(ref k) => try!(write!(f.buf, "{}", *k)),
}
}
if_ok!(write!(f.buf, ": "));
try!(write!(f.buf, ": "));
unsafe {
match (*cur).value {
// should never print nil
None => if_ok!(write!(f.buf, "nil")),
Some(ref value) => if_ok!(write!(f.buf, "{}", *value)),
None => try!(write!(f.buf, "nil")),
Some(ref value) => try!(write!(f.buf, "{}", *value)),
}
}
}
Expand Down
18 changes: 9 additions & 9 deletions src/libextra/url.rs
Original file line number Diff line number Diff line change
Expand Up @@ -803,25 +803,25 @@ impl fmt::Show for Url {
* result in just "http://somehost.com".
*/
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
if_ok!(write!(f.buf, "{}:", self.scheme));
try!(write!(f.buf, "{}:", self.scheme));

if !self.host.is_empty() {
if_ok!(write!(f.buf, "//"));
try!(write!(f.buf, "//"));
match self.user {
Some(ref user) => if_ok!(write!(f.buf, "{}", *user)),
Some(ref user) => try!(write!(f.buf, "{}", *user)),
None => {}
}
match self.port {
Some(ref port) => if_ok!(write!(f.buf, "{}:{}", self.host,
Some(ref port) => try!(write!(f.buf, "{}:{}", self.host,
*port)),
None => if_ok!(write!(f.buf, "{}", self.host)),
None => try!(write!(f.buf, "{}", self.host)),
}
}

if_ok!(write!(f.buf, "{}", self.path));
try!(write!(f.buf, "{}", self.path));

if !self.query.is_empty() {
if_ok!(write!(f.buf, "?{}", query_to_str(&self.query)));
try!(write!(f.buf, "?{}", query_to_str(&self.query)));
}

match self.fragment {
Expand All @@ -834,9 +834,9 @@ impl fmt::Show for Url {

impl fmt::Show for Path {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
if_ok!(write!(f.buf, "{}", self.path));
try!(write!(f.buf, "{}", self.path));
if !self.query.is_empty() {
if_ok!(write!(f.buf, "?{}", self.query))
try!(write!(f.buf, "?{}", self.query))
}

match self.fragment {
Expand Down
2 changes: 1 addition & 1 deletion src/libsyntax/abi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ impl fmt::Show for Abi {

impl fmt::Show for AbiSet {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
if_ok!(write!(f.buf, "\""));
try!(write!(f.buf, "\""));
let mut first = true;
self.each(|abi| {
if first { first = false; }
Expand Down
2 changes: 1 addition & 1 deletion src/libsyntax/crateid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ pub struct CrateId {

impl fmt::Show for CrateId {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
if_ok!(write!(f.buf, "{}", self.path));
try!(write!(f.buf, "{}", self.path));
let version = match self.version {
None => "0.0",
Some(ref version) => version.as_slice(),
Expand Down
2 changes: 0 additions & 2 deletions src/libsyntax/ext/deriving/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ pub mod encodable;
pub mod decodable;
pub mod hash;
pub mod rand;
pub mod to_str;
pub mod show;
pub mod zero;
pub mod default;
Expand Down Expand Up @@ -85,7 +84,6 @@ pub fn expand_meta_deriving(cx: &mut ExtCtxt,

"Rand" => expand!(rand::expand_deriving_rand),

"ToStr" => expand!(to_str::expand_deriving_to_str),
"Show" => expand!(show::expand_deriving_show),

"Zero" => expand!(zero::expand_deriving_zero),
Expand Down
132 changes: 0 additions & 132 deletions src/libsyntax/ext/deriving/to_str.rs

This file was deleted.

6 changes: 3 additions & 3 deletions src/libuuid/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,15 @@ Examples of string representations:
extern crate test;
extern crate serialize;

use std::cast::{transmute,transmute_copy};
use std::cast::{transmute,transmute_copy};
use std::char::Char;
use std::cmp::Eq;
use std::cmp::Eq;
use std::fmt;
use std::hash::{Hash, sip};
use std::num::FromStrRadix;
use std::rand::Rng;
use std::rand;
use std::str;
use std::vec;

use serialize::{Encoder, Encodable, Decoder, Decodable};

Expand Down
2 changes: 2 additions & 0 deletions src/test/run-pass/super-fast-paren-parsing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// ignore-pretty

static a: int =
(((((((((((((((((((((((((((((((((((((((((((((((((((
(((((((((((((((((((((((((((((((((((((((((((((((((((
Expand Down

9 comments on commit 8761f79

@bors
Copy link
Contributor

@bors bors commented on 8761f79 Feb 24, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from huonw
at alexcrichton@8761f79

@bors
Copy link
Contributor

@bors bors commented on 8761f79 Feb 24, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging alexcrichton/rust/deriving-show = 8761f79 into auto

@bors
Copy link
Contributor

@bors bors commented on 8761f79 Feb 24, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

alexcrichton/rust/deriving-show = 8761f79 merged ok, testing candidate = 5ae9cfab

@bors
Copy link
Contributor

@bors bors commented on 8761f79 Feb 24, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bors
Copy link
Contributor

@bors bors commented on 8761f79 Feb 24, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from huonw
at alexcrichton@8761f79

@bors
Copy link
Contributor

@bors bors commented on 8761f79 Feb 24, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging alexcrichton/rust/deriving-show = 8761f79 into auto

@bors
Copy link
Contributor

@bors bors commented on 8761f79 Feb 24, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

alexcrichton/rust/deriving-show = 8761f79 merged ok, testing candidate = 6720977

@bors
Copy link
Contributor

@bors bors commented on 8761f79 Feb 24, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bors
Copy link
Contributor

@bors bors commented on 8761f79 Feb 24, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fast-forwarding master to auto = 6720977

Please sign in to comment.