summaryrefslogtreecommitdiff
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
parent86c56ecb1d2c3d784020b25c0b00bc29fa5c0a66 (diff)
downloadssh2-rs-77456e87ba3888d7a9fc62f3e87aeb3a09098f60.zip
Update to rust master
-rw-r--r--Cargo.toml2
-rw-r--r--libssh2-sys/Cargo.toml2
-rw-r--r--libssh2-sys/build.rs2
-rw-r--r--src/channel.rs9
-rw-r--r--src/error.rs6
-rw-r--r--src/lib.rs1
-rw-r--r--src/sftp.rs15
-rw-r--r--tests/all.rs1
-rw-r--r--tests/sftp.rs4
9 files changed, 15 insertions, 27 deletions
diff --git a/Cargo.toml b/Cargo.toml
index ab1979a..40598e6 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "ssh2"
-version = "0.2.5"
+version = "0.2.6"
authors = ["Alex Crichton <alex@alexcrichton.com>"]
license = "MIT/Apache-2.0"
keywords = ["ssh"]
diff --git a/libssh2-sys/Cargo.toml b/libssh2-sys/Cargo.toml
index c9e7a64..69ed5cb 100644
--- a/libssh2-sys/Cargo.toml
+++ b/libssh2-sys/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "libssh2-sys"
-version = "0.1.15"
+version = "0.1.16"
authors = ["Alex Crichton <alex@alexcrichton.com>"]
links = "ssh2"
build = "build.rs"
diff --git a/libssh2-sys/build.rs b/libssh2-sys/build.rs
index fe2492b..9594eda 100644
--- a/libssh2-sys/build.rs
+++ b/libssh2-sys/build.rs
@@ -1,5 +1,3 @@
-#![feature(convert)]
-
extern crate pkg_config;
use std::env;
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<NulError> for Error {
- fn from_error(_: NulError) -> Error {
+impl From<NulError> 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))
}
}
};
diff --git a/tests/all.rs b/tests/all.rs
index 5930a8f..6ff6c5e 100644
--- a/tests/all.rs
+++ b/tests/all.rs
@@ -1,5 +1,4 @@
#![deny(warnings)]
-#![feature(convert)]
extern crate ssh2;
extern crate libc;
diff --git a/tests/sftp.rs b/tests/sftp.rs
index b28e549..595fdec 100644
--- a/tests/sftp.rs
+++ b/tests/sftp.rs
@@ -19,8 +19,8 @@ fn ops() {
sftp.opendir(&td.path().join("bar")).unwrap();
let mut foo = sftp.open(&td.path().join("foo")).unwrap();
sftp.mkdir(&td.path().join("bar2"), 0o755).unwrap();
- assert_eq!(fs::metadata(&td.path().join("bar2")).map(|m| m.is_dir()),
- Ok(true));
+ assert!(fs::metadata(&td.path().join("bar2")).map(|m| m.is_dir())
+ .unwrap_or(false));
sftp.rmdir(&td.path().join("bar2")).unwrap();
sftp.create(&td.path().join("foo5")).unwrap().write_all(b"foo").unwrap();