From 5f9d91140d49a66bf6ef68e2caf78e32b10ad3b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maxime=20=E2=80=9Cpep=E2=80=9D=20Buquet?= Date: Thu, 28 Dec 2017 06:19:07 +0100 Subject: [PATCH] transport, component, connection: Do not use unneeded return values --- src/component.rs | 3 ++- src/connection.rs | 8 ++++---- src/transport.rs | 15 +++++++++------ 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/src/component.rs b/src/component.rs index ff8526e7..c8ea7e03 100644 --- a/src/component.rs +++ b/src/component.rs @@ -152,7 +152,8 @@ impl Component { sid = value.to_owned(); } } - } + }, + _ => (), } break } diff --git a/src/connection.rs b/src/connection.rs index c209f37a..4b80cdc2 100644 --- a/src/connection.rs +++ b/src/connection.rs @@ -29,14 +29,14 @@ impl Connection for C2S { elem.push_attribute(("id", id)); elem.push_attribute(("xmlns", ns::CLIENT)); elem.push_attribute(("xmlns:stream", ns::STREAM)); - transport.write_event(WriterEvent::Start(elem)); + transport.write_event(WriterEvent::Start(elem))?; Ok(()) } fn close(transport: &mut T) -> Result<(), Error> { let name = "stream:stream"; let elem = BytesEnd::borrowed(name.as_bytes()); - transport.write_event(WriterEvent::End(elem)); + transport.write_event(WriterEvent::End(elem))?; Ok(()) } } @@ -56,14 +56,14 @@ impl Connection for Component2S { elem.push_attribute(("id", id)); elem.push_attribute(("xmlns", ns::COMPONENT_ACCEPT)); elem.push_attribute(("xmlns:stream", ns::STREAM)); - transport.write_event(WriterEvent::Start(elem)); + transport.write_event(WriterEvent::Start(elem))?; Ok(()) } fn close(transport: &mut T) -> Result<(), Error> { let name = "stream:stream"; let elem = BytesEnd::borrowed(name.as_bytes()); - transport.write_event(WriterEvent::End(elem)); + transport.write_event(WriterEvent::End(elem))?; Ok(()) } } diff --git a/src/transport.rs b/src/transport.rs index 288bfce2..2f147422 100644 --- a/src/transport.rs +++ b/src/transport.rs @@ -27,7 +27,7 @@ use sasl::common::ChannelBinding; /// A trait which transports are required to implement. pub trait Transport { /// Writes a `quick_xml::events::Event` to the stream. - fn write_event<'a, E: Into>>(&mut self, event: E) -> Result; + fn write_event<'a, E: Into>>(&mut self, event: E) -> Result<(), Error>; /// Reads a `quick_xml::events::Event` from the stream. fn read_event(&mut self) -> Result; @@ -58,8 +58,9 @@ pub struct PlainTransport { } impl Transport for PlainTransport { - fn write_event<'a, E: Into>>(&mut self, event: E) -> Result { - Ok(self.writer.write(&event.into())?) + fn write_event<'a, E: Into>>(&mut self, event: E) -> Result<(), Error> { + self.writer.write(&event.into())?; + Ok(()) } fn read_event(&mut self) -> Result { @@ -124,8 +125,9 @@ pub struct SslTransport { } impl Transport for SslTransport { - fn write_event<'a, E: Into>>(&mut self, event: E) -> Result { - Ok(self.writer.write(&event.into())?) + fn write_event<'a, E: Into>>(&mut self, event: E) -> Result<(), Error> { + self.writer.write(&event.into())?; + Ok(()) } fn read_event(&mut self) -> Result { @@ -179,7 +181,8 @@ impl SslTransport { return Err(Error::StreamError); } } - } + }, + _ => (), } } }