error handling cleanup
This commit is contained in:
parent
4a1ecdee35
commit
2995f6e48b
@ -29,9 +29,7 @@ impl<'payload> I3msg<'payload> {
|
||||
IoSlice::new(self.payload.as_bytes()),
|
||||
];
|
||||
|
||||
match self.buffer.write_vectored(bufs) {
|
||||
Ok(_) => return Ok(self.buffer.to_owned()),
|
||||
Err(e) => return Err(e),
|
||||
}
|
||||
self.buffer.write_vectored(bufs)?;
|
||||
Ok(self.buffer.to_owned())
|
||||
}
|
||||
}
|
@ -17,10 +17,8 @@ pub struct Sway {
|
||||
|
||||
impl Sway {
|
||||
pub fn new(socket: &str) -> Result<Sway> {
|
||||
match UnixStream::connect(socket) {
|
||||
Ok(stream) => return Ok(Sway{stream}),
|
||||
Err(e) => return Err(e),
|
||||
};
|
||||
let stream = UnixStream::connect(socket)?;
|
||||
Ok(Sway{stream})
|
||||
}
|
||||
|
||||
/// Runs the payload as sway commands
|
||||
@ -126,7 +124,7 @@ impl Sway {
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::Sway;
|
||||
use crate::i3msg::*;
|
||||
use crate::i3msg::I3msg;
|
||||
use crate::ipc::*;
|
||||
|
||||
fn sway_ipc() -> Sway {
|
||||
|
Loading…
Reference in New Issue
Block a user