Merge pull request #24 from steveklabnik/master

fail -> panic
This commit is contained in:
Alex Crichton 2014-10-29 20:46:29 -05:00
commit 35804927ef
2 changed files with 10 additions and 10 deletions

View file

@ -217,13 +217,13 @@ impl serialize::Encoder<Error> for Encoder {
_f: |&mut Encoder| -> Result<(), Error>) _f: |&mut Encoder| -> Result<(), Error>)
-> Result<(), Error> -> Result<(), Error>
{ {
fail!() panic!()
} }
fn emit_enum_struct_variant_field(&mut self, _f_name: &str, _f_idx: uint, fn emit_enum_struct_variant_field(&mut self, _f_name: &str, _f_idx: uint,
_f: |&mut Encoder| -> Result<(), Error>) _f: |&mut Encoder| -> Result<(), Error>)
-> Result<(), Error> -> Result<(), Error>
{ {
fail!() panic!()
} }
fn emit_struct(&mut self, _name: &str, _len: uint, fn emit_struct(&mut self, _name: &str, _len: uint,
f: |&mut Encoder| -> Result<(), Error>) -> Result<(), Error> { f: |&mut Encoder| -> Result<(), Error>) -> Result<(), Error> {
@ -290,7 +290,7 @@ impl serialize::Encoder<Error> for Encoder {
match mem::replace(&mut self.state, Start) { match mem::replace(&mut self.state, Start) {
Start => unreachable!(), Start => unreachable!(),
NextKey(_) => Ok(()), NextKey(_) => Ok(()),
NextArray(..) => fail!("how to encode None in an array?"), NextArray(..) => panic!("how to encode None in an array?"),
NextMapKey => Err(InvalidMapKeyLocation), NextMapKey => Err(InvalidMapKeyLocation),
} }
} }
@ -523,7 +523,7 @@ impl serialize::Decoder<DecodeError> for Decoder {
-> Result<T, DecodeError>) -> Result<T, DecodeError>)
-> Result<T, DecodeError> -> Result<T, DecodeError>
{ {
fail!() panic!()
} }
fn read_enum_struct_variant_field<T>(&mut self, fn read_enum_struct_variant_field<T>(&mut self,
_f_name: &str, _f_name: &str,
@ -532,7 +532,7 @@ impl serialize::Decoder<DecodeError> for Decoder {
-> Result<T, DecodeError>) -> Result<T, DecodeError>)
-> Result<T, DecodeError> -> Result<T, DecodeError>
{ {
fail!() panic!()
} }
fn read_struct<T>(&mut self, _s_name: &str, _len: uint, fn read_struct<T>(&mut self, _s_name: &str, _len: uint,
@ -595,14 +595,14 @@ impl serialize::Decoder<DecodeError> for Decoder {
_f: |&mut Decoder, uint| -> Result<T, DecodeError>) _f: |&mut Decoder, uint| -> Result<T, DecodeError>)
-> Result<T, DecodeError> -> Result<T, DecodeError>
{ {
fail!() panic!()
} }
fn read_tuple_struct_arg<T>(&mut self, fn read_tuple_struct_arg<T>(&mut self,
_a_idx: uint, _a_idx: uint,
_f: |&mut Decoder| -> Result<T, DecodeError>) _f: |&mut Decoder| -> Result<T, DecodeError>)
-> Result<T, DecodeError> -> Result<T, DecodeError>
{ {
fail!() panic!()
} }
// Specialized types: // Specialized types:
@ -1000,7 +1000,7 @@ mod tests {
})); }));
let a: Result<Foo, DecodeError> = Decodable::decode(&mut d); let a: Result<Foo, DecodeError> = Decodable::decode(&mut d);
match a { match a {
Ok(..) => fail!("should not have decoded"), Ok(..) => panic!("should not have decoded"),
Err(e) => { Err(e) => {
assert_eq!(e.to_string().as_slice(), assert_eq!(e.to_string().as_slice(),
"expected a value of type `integer`, but \ "expected a value of type `integer`, but \
@ -1018,7 +1018,7 @@ mod tests {
})); }));
let a: Result<Foo, DecodeError> = Decodable::decode(&mut d); let a: Result<Foo, DecodeError> = Decodable::decode(&mut d);
match a { match a {
Ok(..) => fail!("should not have decoded"), Ok(..) => panic!("should not have decoded"),
Err(e) => { Err(e) => {
assert_eq!(e.to_string().as_slice(), assert_eq!(e.to_string().as_slice(),
"expected a value of type `integer` for the key `bar`"); "expected a value of type `integer` for the key `bar`");

View file

@ -85,7 +85,7 @@ impl<'a, 'b> Printer<'a, 'b> {
self.stack.connect("."))); self.stack.connect(".")));
match *inner { match *inner {
Table(ref inner) => try!(self.print(inner)), Table(ref inner) => try!(self.print(inner)),
_ => fail!("non-heterogeneous toml array"), _ => panic!("non-heterogeneous toml array"),
} }
} }
self.stack.pop(); self.stack.pop();