Skip to content

Commit

Permalink
Fix build for Show/String->Debug/Display.
Browse files Browse the repository at this point in the history
  • Loading branch information
alexchandel committed Jan 23, 2015
1 parent d12983f commit 9fbf206
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions src/bench.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use std::fmt::Show;
use std::fmt::{Debug, Display};
use std::io::{self, ByRefReader};
use std::io::Reader as IoReader;
use stdtest::Bencher;
Expand All @@ -7,7 +7,7 @@ use Reader;

static CSV_DATA: &'static str = "./examples/data/bench.csv";

fn ordie<T, E: Show>(r: Result<T, E>) -> T {
fn ordie<T, E: Debug+Display>(r: Result<T, E>) -> T {
r.or_else(|e: E| -> Result<T, E> panic!(format!("{:?}", e))).unwrap()
}

Expand Down
2 changes: 1 addition & 1 deletion src/bytestr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ impl ByteString {
}
}

impl fmt::Show for ByteString {
impl fmt::Debug for ByteString {
/// Writes the underlying bytes as a `&[u8]`.
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
// XXX: Ideally, we could just do this:
Expand Down
4 changes: 2 additions & 2 deletions src/encoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ impl serialize::Encoder for Encoded {
fn emit_char(&mut self, v: char) -> CsvResult<()> {
let mut bytes = [0u8; 4];
let n = v.encode_utf8(bytes.as_mut_slice()).unwrap_or(0);
self.push_bytes(bytes.slice_to(n))
self.push_bytes(&bytes[..n])
}
fn emit_str(&mut self, v: &str) -> CsvResult<()> {
self.push_string(v)
Expand Down Expand Up @@ -153,7 +153,7 @@ impl serialize::Encoder for Encoded {
unimplemented!()
}
fn emit_map_elt_key<F>(&mut self, _: usize, _: F) -> CsvResult<()>
where F: FnMut(&mut Encoded) -> CsvResult<()> {
where F: FnOnce(&mut Encoded) -> CsvResult<()> {
unimplemented!()
}
fn emit_map_elt_val<F>(&mut self, _: usize, _: F) -> CsvResult<()>
Expand Down
8 changes: 4 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ pub enum ParseErrorKind {
InvalidUTF8,
}

impl fmt::String for Error {
impl fmt::Display for Error {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match *self {
Error::Encode(ref msg) => write!(f, "CSV encode error: {}", msg),
Expand All @@ -284,14 +284,14 @@ impl fmt::String for Error {
}
}

impl fmt::String for ParseError {
impl fmt::Display for ParseError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "CSV parse error:{}:{}: {}",
self.line, self.column, self.kind)
}
}

impl fmt::String for ParseErrorKind {
impl fmt::Display for ParseErrorKind {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match *self {
ParseErrorKind::UnequalLengths(first, cur) =>
Expand All @@ -314,7 +314,7 @@ impl StdError for Error {
}
}

fn detail(&self) -> Option<String> { Some(self.to_string()) }
// fn detail(&self) -> Option<String> { Some(self.to_string()) }

fn cause(&self) -> Option<&StdError> {
match *self {
Expand Down
4 changes: 2 additions & 2 deletions src/writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -431,15 +431,15 @@ impl<W: io::Writer> Writer<W> {
break
}
Some(next_quote) => {
buf.push_all(s.slice_to(next_quote));
buf.push_all(&s[..next_quote]);
if self.double_quote {
buf.push(self.quote);
buf.push(self.quote);
} else {
buf.push(self.escape);
buf.push(self.quote);
}
s = s.slice_from(next_quote + 1);
s = &s[next_quote + 1..];
}
}
}
Expand Down

0 comments on commit 9fbf206

Please sign in to comment.