From 9dbe41f60d411ed28ac360b4585b473100d306de Mon Sep 17 00:00:00 2001 From: Till Hoeppner Date: Sun, 28 Jun 2015 21:50:00 +0200 Subject: Make openssl a required dependency --- Cargo.toml | 6 +----- src/client.rs | 8 -------- src/lib.rs | 4 ---- 3 files changed, 1 insertion(+), 17 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index d7f2c09..b23c4b9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,15 +13,11 @@ license = "MIT" log = "*" regex = "*" regex_macros = "*" +openssl = "*" [features] -ssl = ["openssl"] lints = ["clippy"] -[dependencies.openssl] -version = "*" -optional = true - [dependencies.carboxyl] git = "https://github.com/tilpner/carboxyl" diff --git a/src/client.rs b/src/client.rs index 339415b..e09532f 100644 --- a/src/client.rs +++ b/src/client.rs @@ -20,13 +20,11 @@ use reply::Reply; use event::Event; use ::{ DEBUG, Result, IrscError }; -#[cfg(feature = "ssl")] use openssl::ssl::{ Ssl, SslContext, SslMethod, SslStream }; /// Yes, I don't like the name either, but it's private, so... enum StreamKind { Plain(TcpStream), - #[cfg(feature = "ssl")] Ssl(SslStream) } @@ -34,7 +32,6 @@ impl Write for StreamKind { fn write(&mut self, buf: &[u8]) -> io::Result { match *self { StreamKind::Plain(ref mut s) => s.write(buf), - #[cfg(feature = "ssl")] StreamKind::Ssl(ref mut s) => s.write(buf) } } @@ -42,7 +39,6 @@ impl Write for StreamKind { fn flush(&mut self) -> io::Result<()> { match *self { StreamKind::Plain(ref mut s) => s.flush(), - #[cfg(feature = "ssl")] StreamKind::Ssl(ref mut s) => s.flush() } } @@ -52,7 +48,6 @@ impl Read for StreamKind { fn read(&mut self, buf: &mut [u8]) -> io::Result { match *self { StreamKind::Plain(ref mut s) => s.read(buf), - #[cfg(feature = "ssl")] StreamKind::Ssl(ref mut s) => s.read(buf) } } @@ -110,7 +105,6 @@ impl OwnedClient { Result(Ok(())) } - #[cfg(feature = "ssl")] pub fn connect_ssl(&mut self, host: &str, port: u16, ssl: Ssl) -> Result<()> { let s = &mut self.stream; if s.is_some() { return Result(Err(IrscError::AlreadyConnected)) }; @@ -152,7 +146,6 @@ impl OwnedClient { where F: Fn(&mut Client, &Message, Option) { let reader = BufReader::new(match self.stream { Some(StreamKind::Plain(ref s)) => StreamKind::Plain((*s).try_clone().unwrap()), - #[cfg(feature = "ssl")] Some(StreamKind::Ssl(ref s)) => StreamKind::Ssl((*s).try_clone().unwrap()), None => return Result(Err(IrscError::NotConnected)) }); @@ -183,7 +176,6 @@ impl OwnedClient { let mut s: &mut OwnedClient = unsafe { mem::transmute(self) }; let reader = BufReader::new(match self.stream { Some(StreamKind::Plain(ref s)) => StreamKind::Plain((*s).try_clone().unwrap()), - #[cfg(feature = "ssl")] Some(StreamKind::Ssl(ref s)) => StreamKind::Ssl((*s).try_clone().unwrap()), None => return Result(Err(IrscError::NotConnected)) }); diff --git a/src/lib.rs b/src/lib.rs index 32f153d..d624445 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -8,7 +8,6 @@ extern crate regex; #[macro_use] extern crate log; -#[cfg(feature = "ssl")] extern crate openssl; extern crate carboxyl; @@ -25,7 +24,6 @@ use std::io; use std::result; use std::ops::{ Deref, DerefMut }; -#[cfg(feature = "ssl")] use openssl::ssl::error::SslError; pub use ident::Ident; @@ -41,11 +39,9 @@ pub enum IrscError { AlreadyConnected, NotConnected, NotFound, - #[cfg(feature = "ssl")] Ssl(SslError) } -#[cfg(feature = "ssl")] impl From for IrscError { fn from(e: SslError) -> IrscError { IrscError::Ssl(e) } } -- cgit v1.2.3