From 77456e87ba3888d7a9fc62f3e87aeb3a09098f60 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Thu, 2 Apr 2015 09:49:25 -0700 Subject: Update to rust master --- src/channel.rs | 9 +++------ src/error.rs | 6 +++--- src/lib.rs | 1 - src/sftp.rs | 15 +++++---------- 4 files changed, 11 insertions(+), 20 deletions(-) (limited to 'src') diff --git a/src/channel.rs b/src/channel.rs index 5448333..73d7d9c 100644 --- a/src/channel.rs +++ b/src/channel.rs @@ -399,8 +399,7 @@ impl<'channel, 'sess> Read for Stream<'channel, 'sess> { } Ok(n) } - Err(e) => Err(io::Error::new(ErrorKind::Other, "ssh read error", - Some(e.to_string()))) + Err(e) => Err(io::Error::new(ErrorKind::Other, e)), } } } @@ -414,8 +413,7 @@ impl<'channel, 'sess> Write for Stream<'channel, 'sess> { data.len() as size_t); self.channel.sess.rc(rc).map(|()| rc as usize) }.map_err(|e| { - io::Error::new(ErrorKind::Other, "ssh write error", - Some(e.to_string())) + io::Error::new(ErrorKind::Other, e) }) } @@ -425,8 +423,7 @@ impl<'channel, 'sess> Write for Stream<'channel, 'sess> { self.id as c_int); self.channel.sess.rc(rc) }.map_err(|e| { - io::Error::new(ErrorKind::Other, "ssh flush error", - Some(e.to_string())) + io::Error::new(ErrorKind::Other, e) }) } } diff --git a/src/error.rs b/src/error.rs index d6d2a7b..7019aa9 100644 --- a/src/error.rs +++ b/src/error.rs @@ -1,4 +1,4 @@ -use std::error::{self, FromError}; +use std::error; use std::ffi::NulError; use std::fmt; use std::str; @@ -114,8 +114,8 @@ impl error::Error for Error { fn description(&self) -> &str { self.message() } } -impl FromError for Error { - fn from_error(_: NulError) -> Error { +impl From for Error { + fn from(_: NulError) -> Error { Error::new(raw::LIBSSH2_ERROR_INVAL, "provided data contained a nul byte and could not be used \ as as string") diff --git a/src/lib.rs b/src/lib.rs index 8849c6a..ea511f0 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -124,7 +124,6 @@ //! ``` #![doc(html_root_url = "http://alexcrichton.com/ssh2-rs")] -#![feature(io, io_ext, convert)] #![allow(trivial_numeric_casts)] #![deny(missing_docs, unused_results)] #![cfg_attr(test, deny(warnings))] 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)) } } }; -- cgit v1.2.3