From d45325dcf9c8fb979f6310f34eacd5e58dc8e90b Mon Sep 17 00:00:00 2001 From: Robert Straw Date: Thu, 18 Dec 2014 13:53:31 -0600 Subject: [PATCH 1/2] Use `FnMut` where appropriate in the decoder impl... --- src/lib.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index d7edbab..4e57ab8 100755 --- a/src/lib.rs +++ b/src/lib.rs @@ -393,8 +393,8 @@ impl<'a, R: Reader> serialize::Decoder for Decoder { f(self) } - fn read_enum_variant(&mut self, names: &[&str], f: F) -> IoResult - where F: FnOnce(&mut Decoder, uint) -> IoResult { + fn read_enum_variant(&mut self, names: &[&str], mut f: F) -> IoResult + where F: FnMut(&mut Decoder, uint) -> IoResult { let idx = try!(self.read_seq(|d, _len| { let name = try!(d.read_str()); match names.iter().position(|n| name.as_slice() == *n) { @@ -440,8 +440,8 @@ impl<'a, R: Reader> serialize::Decoder for Decoder { f(self) } - fn read_option(&mut self, f: F) -> IoResult - where F: FnOnce(&mut Decoder, bool) -> IoResult { + fn read_option(&mut self, mut f: F) -> IoResult + where F: FnMut(&mut Decoder, bool) -> IoResult { match try!(self._peek_byte()) { 0xc0 => f(self, false), _ => f(self, true) @@ -463,11 +463,11 @@ impl<'a, R: Reader> serialize::Decoder for Decoder { fn read_enum_struct_variant(&mut self, names: &[&str], - f: F) -> IoResult - where F: FnOnce(&mut Decoder, uint) -> IoResult { + f: F) -> IoResult + where F: FnMut(&mut Decoder, uint) -> IoResult { self.read_enum_variant(names, f) - } + } fn read_enum_struct_variant_field(&mut self, From c4dfab21523dce1949d2e9096a1c7b8682e84809 Mon Sep 17 00:00:00 2001 From: Robert Straw Date: Fri, 19 Dec 2014 08:23:48 -0600 Subject: [PATCH 2/2] Macros expanding to items need trailing semicolons --- src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index 4e57ab8..203d391 100755 --- a/src/lib.rs +++ b/src/lib.rs @@ -853,7 +853,7 @@ mod test { assert_eq!($inp, value) } ); - ) + ); #[test]