transport, component, connection: Do not use unneeded return values
This commit is contained in:
parent
690e83725c
commit
5f9d91140d
3 changed files with 15 additions and 11 deletions
|
@ -152,7 +152,8 @@ impl Component {
|
||||||
sid = value.to_owned();
|
sid = value.to_owned();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
_ => (),
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,14 +29,14 @@ impl Connection for C2S {
|
||||||
elem.push_attribute(("id", id));
|
elem.push_attribute(("id", id));
|
||||||
elem.push_attribute(("xmlns", ns::CLIENT));
|
elem.push_attribute(("xmlns", ns::CLIENT));
|
||||||
elem.push_attribute(("xmlns:stream", ns::STREAM));
|
elem.push_attribute(("xmlns:stream", ns::STREAM));
|
||||||
transport.write_event(WriterEvent::Start(elem));
|
transport.write_event(WriterEvent::Start(elem))?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn close<T: Transport>(transport: &mut T) -> Result<(), Error> {
|
fn close<T: Transport>(transport: &mut T) -> Result<(), Error> {
|
||||||
let name = "stream:stream";
|
let name = "stream:stream";
|
||||||
let elem = BytesEnd::borrowed(name.as_bytes());
|
let elem = BytesEnd::borrowed(name.as_bytes());
|
||||||
transport.write_event(WriterEvent::End(elem));
|
transport.write_event(WriterEvent::End(elem))?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -56,14 +56,14 @@ impl Connection for Component2S {
|
||||||
elem.push_attribute(("id", id));
|
elem.push_attribute(("id", id));
|
||||||
elem.push_attribute(("xmlns", ns::COMPONENT_ACCEPT));
|
elem.push_attribute(("xmlns", ns::COMPONENT_ACCEPT));
|
||||||
elem.push_attribute(("xmlns:stream", ns::STREAM));
|
elem.push_attribute(("xmlns:stream", ns::STREAM));
|
||||||
transport.write_event(WriterEvent::Start(elem));
|
transport.write_event(WriterEvent::Start(elem))?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn close<T: Transport>(transport: &mut T) -> Result<(), Error> {
|
fn close<T: Transport>(transport: &mut T) -> Result<(), Error> {
|
||||||
let name = "stream:stream";
|
let name = "stream:stream";
|
||||||
let elem = BytesEnd::borrowed(name.as_bytes());
|
let elem = BytesEnd::borrowed(name.as_bytes());
|
||||||
transport.write_event(WriterEvent::End(elem));
|
transport.write_event(WriterEvent::End(elem))?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,7 @@ use sasl::common::ChannelBinding;
|
||||||
/// A trait which transports are required to implement.
|
/// A trait which transports are required to implement.
|
||||||
pub trait Transport {
|
pub trait Transport {
|
||||||
/// Writes a `quick_xml::events::Event` to the stream.
|
/// Writes a `quick_xml::events::Event` to the stream.
|
||||||
fn write_event<'a, E: Into<Event<'a>>>(&mut self, event: E) -> Result<usize, Error>;
|
fn write_event<'a, E: Into<Event<'a>>>(&mut self, event: E) -> Result<(), Error>;
|
||||||
|
|
||||||
/// Reads a `quick_xml::events::Event` from the stream.
|
/// Reads a `quick_xml::events::Event` from the stream.
|
||||||
fn read_event(&mut self) -> Result<Event, Error>;
|
fn read_event(&mut self) -> Result<Event, Error>;
|
||||||
|
@ -58,8 +58,9 @@ pub struct PlainTransport {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Transport for PlainTransport {
|
impl Transport for PlainTransport {
|
||||||
fn write_event<'a, E: Into<Event<'a>>>(&mut self, event: E) -> Result<usize, Error> {
|
fn write_event<'a, E: Into<Event<'a>>>(&mut self, event: E) -> Result<(), Error> {
|
||||||
Ok(self.writer.write(&event.into())?)
|
self.writer.write(&event.into())?;
|
||||||
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn read_event(&mut self) -> Result<Event, Error> {
|
fn read_event(&mut self) -> Result<Event, Error> {
|
||||||
|
@ -124,8 +125,9 @@ pub struct SslTransport {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Transport for SslTransport {
|
impl Transport for SslTransport {
|
||||||
fn write_event<'a, E: Into<Event<'a>>>(&mut self, event: E) -> Result<usize, Error> {
|
fn write_event<'a, E: Into<Event<'a>>>(&mut self, event: E) -> Result<(), Error> {
|
||||||
Ok(self.writer.write(&event.into())?)
|
self.writer.write(&event.into())?;
|
||||||
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn read_event(&mut self) -> Result<Event, Error> {
|
fn read_event(&mut self) -> Result<Event, Error> {
|
||||||
|
@ -179,7 +181,8 @@ impl SslTransport {
|
||||||
return Err(Error::StreamError);
|
return Err(Error::StreamError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
_ => (),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue