summaryrefslogtreecommitdiff
path: root/src/sftp.rs
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2015-04-02 09:49:25 -0700
committerAlex Crichton <alex@alexcrichton.com>2015-04-02 09:49:25 -0700
commit77456e87ba3888d7a9fc62f3e87aeb3a09098f60 (patch)
tree0cdea4f6cbd7a02c9bc450227abcb1ed53454ff7 /src/sftp.rs
parent86c56ecb1d2c3d784020b25c0b00bc29fa5c0a66 (diff)
downloadssh2-rs-77456e87ba3888d7a9fc62f3e87aeb3a09098f60.zip
Update to rust master
Diffstat (limited to 'src/sftp.rs')
-rw-r--r--src/sftp.rs15
1 files changed, 5 insertions, 10 deletions
diff --git a/src/sftp.rs b/src/sftp.rs
index 0159c6d..918f4da 100644
--- a/src/sftp.rs
+++ b/src/sftp.rs
@@ -432,9 +432,8 @@ impl<'sftp> Read for File<'sftp> {
buf.as_mut_ptr() as *mut _,
buf.len() as size_t);
match rc {
- n if n < 0 => Err(io::Error::new(ErrorKind::Other, "read error",
- Some(self.sftp.last_error()
- .to_string()))),
+ n if n < 0 => Err(io::Error::new(ErrorKind::Other,
+ self.sftp.last_error())),
n => Ok(n as usize)
}
}
@@ -449,8 +448,7 @@ impl<'sftp> Write for File<'sftp> {
buf.len() as size_t)
};
if rc < 0 {
- Err(io::Error::new(ErrorKind::Other, "write error",
- Some(self.sftp.last_error().to_string())))
+ Err(io::Error::new(ErrorKind::Other, self.sftp.last_error()))
} else {
Ok(rc as usize)
}
@@ -481,14 +479,11 @@ impl<'sftp> Seek for File<'sftp> {
Some(size) => (size as i64 + offset) as u64,
None => {
return Err(io::Error::new(ErrorKind::Other,
- "no file size available",
- None))
+ "no file size available"))
}
},
Err(e) => {
- return Err(io::Error::new(ErrorKind::Other,
- "failed to stat remote file",
- Some(e.to_string())))
+ return Err(io::Error::new(ErrorKind::Other, e))
}
}
};