Fix a number of compile warnings
This commit is contained in:
parent
66a37a5182
commit
dd4c5131eb
|
@ -4,7 +4,6 @@
|
||||||
#![deny(warnings)]
|
#![deny(warnings)]
|
||||||
|
|
||||||
extern crate toml;
|
extern crate toml;
|
||||||
extern crate serde;
|
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate serde_derive;
|
extern crate serde_derive;
|
||||||
|
|
||||||
|
|
16
src/ser.rs
16
src/ser.rs
|
@ -784,7 +784,7 @@ impl<'a, 'b> ser::Serializer for &'b mut Serializer<'a> {
|
||||||
self.display(v, "integer")
|
self.display(v, "integer")
|
||||||
}
|
}
|
||||||
|
|
||||||
fn serialize_f32(mut self, v: f32) -> Result<(), Self::Error> {
|
fn serialize_f32(self, v: f32) -> Result<(), Self::Error> {
|
||||||
if !v.is_finite() {
|
if !v.is_finite() {
|
||||||
return Err(Error::NumberInvalid);
|
return Err(Error::NumberInvalid);
|
||||||
}
|
}
|
||||||
|
@ -800,7 +800,7 @@ impl<'a, 'b> ser::Serializer for &'b mut Serializer<'a> {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn serialize_f64(mut self, v: f64) -> Result<(), Self::Error> {
|
fn serialize_f64(self, v: f64) -> Result<(), Self::Error> {
|
||||||
if !v.is_finite() {
|
if !v.is_finite() {
|
||||||
return Err(Error::NumberInvalid);
|
return Err(Error::NumberInvalid);
|
||||||
}
|
}
|
||||||
|
@ -821,7 +821,7 @@ impl<'a, 'b> ser::Serializer for &'b mut Serializer<'a> {
|
||||||
self.serialize_str(v.encode_utf8(&mut buf))
|
self.serialize_str(v.encode_utf8(&mut buf))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn serialize_str(mut self, value: &str) -> Result<(), Self::Error> {
|
fn serialize_str(self, value: &str) -> Result<(), Self::Error> {
|
||||||
self.emit_key("string")?;
|
self.emit_key("string")?;
|
||||||
self.emit_str(value, false)?;
|
self.emit_str(value, false)?;
|
||||||
if let State::Table { .. } = self.state {
|
if let State::Table { .. } = self.state {
|
||||||
|
@ -881,7 +881,7 @@ impl<'a, 'b> ser::Serializer for &'b mut Serializer<'a> {
|
||||||
Err(Error::UnsupportedType)
|
Err(Error::UnsupportedType)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn serialize_seq(mut self, len: Option<usize>)
|
fn serialize_seq(self, len: Option<usize>)
|
||||||
-> Result<Self::SerializeSeq, Self::Error> {
|
-> Result<Self::SerializeSeq, Self::Error> {
|
||||||
self.array_type("array")?;
|
self.array_type("array")?;
|
||||||
Ok(SerializeSeq {
|
Ok(SerializeSeq {
|
||||||
|
@ -911,7 +911,7 @@ impl<'a, 'b> ser::Serializer for &'b mut Serializer<'a> {
|
||||||
Err(Error::UnsupportedType)
|
Err(Error::UnsupportedType)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn serialize_map(mut self, _len: Option<usize>)
|
fn serialize_map(self, _len: Option<usize>)
|
||||||
-> Result<Self::SerializeMap, Self::Error> {
|
-> Result<Self::SerializeMap, Self::Error> {
|
||||||
self.array_type("table")?;
|
self.array_type("table")?;
|
||||||
Ok(SerializeTable::Table {
|
Ok(SerializeTable::Table {
|
||||||
|
@ -922,7 +922,7 @@ impl<'a, 'b> ser::Serializer for &'b mut Serializer<'a> {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fn serialize_struct(mut self, name: &'static str, _len: usize)
|
fn serialize_struct(self, name: &'static str, _len: usize)
|
||||||
-> Result<Self::SerializeStruct, Self::Error> {
|
-> Result<Self::SerializeStruct, Self::Error> {
|
||||||
if name == SERDE_STRUCT_NAME {
|
if name == SERDE_STRUCT_NAME {
|
||||||
self.array_type("datetime")?;
|
self.array_type("datetime")?;
|
||||||
|
@ -1050,7 +1050,7 @@ impl<'a, 'b> ser::SerializeMap for SerializeTable<'a, 'b> {
|
||||||
fn end(self) -> Result<(), Error> {
|
fn end(self) -> Result<(), Error> {
|
||||||
match self {
|
match self {
|
||||||
SerializeTable::Datetime(_) => panic!(), // shouldn't be possible
|
SerializeTable::Datetime(_) => panic!(), // shouldn't be possible
|
||||||
SerializeTable::Table { mut ser, first, .. } => {
|
SerializeTable::Table { ser, first, .. } => {
|
||||||
if first.get() {
|
if first.get() {
|
||||||
let state = ser.state.clone();
|
let state = ser.state.clone();
|
||||||
ser.emit_table_header(&state)?;
|
ser.emit_table_header(&state)?;
|
||||||
|
@ -1106,7 +1106,7 @@ impl<'a, 'b> ser::SerializeStruct for SerializeTable<'a, 'b> {
|
||||||
fn end(self) -> Result<(), Error> {
|
fn end(self) -> Result<(), Error> {
|
||||||
match self {
|
match self {
|
||||||
SerializeTable::Datetime(_) => {},
|
SerializeTable::Datetime(_) => {},
|
||||||
SerializeTable::Table { mut ser, first, .. } => {
|
SerializeTable::Table { ser, first, .. } => {
|
||||||
if first.get() {
|
if first.get() {
|
||||||
let state = ser.state.clone();
|
let state = ser.state.clone();
|
||||||
ser.emit_table_header(&state)?;
|
ser.emit_table_header(&state)?;
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
extern crate serde;
|
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate serde_derive;
|
extern crate serde_derive;
|
||||||
extern crate toml;
|
extern crate toml;
|
||||||
|
|
Loading…
Reference in a new issue