summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2014-12-23 09:26:52 -0800
committerAlex Crichton <alex@alexcrichton.com>2014-12-23 09:26:52 -0800
commit509a8459e466ffa4705a0c686b80ac80b499f5d5 (patch)
treed59173b2ca24b7e846dc9d386d6860e06de88fbd /src
parent842cefa7e17807602b842d91b22140510699ea40 (diff)
downloadssh2-rs-509a8459e466ffa4705a0c686b80ac80b499f5d5.zip
Update to rust master
Diffstat (limited to 'src')
-rw-r--r--src/knownhosts.rs2
-rw-r--r--src/session.rs4
2 files changed, 3 insertions, 3 deletions
diff --git a/src/knownhosts.rs b/src/knownhosts.rs
index 52ee3b1..6fec25e 100644
--- a/src/knownhosts.rs
+++ b/src/knownhosts.rs
@@ -260,7 +260,7 @@ impl<'kh> Host<'kh> {
pub fn name(&self) -> Option<&str> {
unsafe {
::opt_bytes(self, (*self.raw).name as *const _)
- .and_then(str::from_utf8)
+ .and_then(|s| str::from_utf8(s).ok())
}
}
diff --git a/src/session.rs b/src/session.rs
index c22d8e6..7d983cb 100644
--- a/src/session.rs
+++ b/src/session.rs
@@ -47,7 +47,7 @@ impl Session {
///
/// May return `None` on invalid utf-8 or if an error has ocurred.
pub fn banner(&self) -> Option<&str> {
- self.banner_bytes().and_then(str::from_utf8)
+ self.banner_bytes().and_then(|s| str::from_utf8(s).ok())
}
/// See `banner`.
@@ -209,7 +209,7 @@ impl Session {
unsafe {
let ptr = raw::libssh2_session_methods(self.raw,
method_type as c_int);
- ::opt_bytes(self, ptr).and_then(str::from_utf8)
+ ::opt_bytes(self, ptr).and_then(|s| str::from_utf8(s).ok())
}
}