diff --git a/.circleci/config.yml b/.circleci/config.yml index 6b4b9417..0b1b9803 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -9,6 +9,7 @@ jobs: - image: rust:<< parameters.image >> environment: RUST_BACKTRACE: 1 + RUSTFLAGS: -D warnings steps: - checkout - restore_cache: @@ -36,6 +37,7 @@ jobs: xcode: "9.0" environment: RUST_BACKTRACE: 1 + RUSTFLAGS: -D warnings steps: - checkout - run: curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain << parameters.version >> @@ -61,6 +63,6 @@ workflows: jobs: - linux: name: openssl - image: 1.37.0-stretch + image: 1.37.0 - macos: version: 1.37.0 diff --git a/appveyor.yml b/appveyor.yml index e7cea7aa..473dd0e9 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,5 +1,5 @@ environment: - RUST_VERSION: 1.32.0 + RUST_VERSION: 1.37.0 TARGET: x86_64-pc-windows-msvc install: - ps: Start-FileDownload "https://static.rust-lang.org/dist/rust-${env:RUST_VERSION}-${env:TARGET}.exe" diff --git a/src/imp/openssl.rs b/src/imp/openssl.rs index cc83f2e6..421eda29 100644 --- a/src/imp/openssl.rs +++ b/src/imp/openssl.rs @@ -14,7 +14,7 @@ use self::openssl::x509::{X509, X509VerifyResult}; use std::error; use std::fmt; use std::io; -use std::sync::{Once, ONCE_INIT}; +use std::sync::Once; use {Protocol, TlsAcceptorBuilder, TlsConnectorBuilder}; use self::openssl::pkey::Private; @@ -90,7 +90,7 @@ fn supported_protocols( } fn init_trust() { - static ONCE: Once = ONCE_INIT; + static ONCE: Once = Once::new(); ONCE.call_once(|| openssl_probe::init_ssl_cert_env_vars()); } @@ -120,17 +120,10 @@ pub enum Error { } impl error::Error for Error { - fn description(&self) -> &str { + fn source(&self) -> Option<&(dyn error::Error + 'static)> { match *self { - Error::Normal(ref e) => error::Error::description(e), - Error::Ssl(ref e, _) => error::Error::description(e), - } - } - - fn cause(&self) -> Option<&error::Error> { - match *self { - Error::Normal(ref e) => error::Error::cause(e), - Error::Ssl(ref e, _) => error::Error::cause(e), + Error::Normal(ref e) => error::Error::source(e), + Error::Ssl(ref e, _) => error::Error::source(e), } } } diff --git a/src/imp/schannel.rs b/src/imp/schannel.rs index d38e6f37..5b0a3961 100644 --- a/src/imp/schannel.rs +++ b/src/imp/schannel.rs @@ -34,12 +34,8 @@ fn convert_protocols(min: Option<::Protocol>, max: Option<::Protocol>) -> &'stat pub struct Error(io::Error); impl error::Error for Error { - fn description(&self) -> &str { - error::Error::description(&self.0) - } - - fn cause(&self) -> Option<&error::Error> { - error::Error::cause(&self.0) + fn source(&self) -> Option<&(dyn error::Error + 'static)> { + error::Error::source(&self.0) } } diff --git a/src/imp/security_framework.rs b/src/imp/security_framework.rs index 4008b080..5060f410 100644 --- a/src/imp/security_framework.rs +++ b/src/imp/security_framework.rs @@ -16,7 +16,7 @@ use std::error; use std::fmt; use std::io; use std::sync::Mutex; -use std::sync::{Once, ONCE_INIT}; +use std::sync::Once; #[cfg(not(target_os = "ios"))] use self::security_framework::os::macos::certificate::{PropertyType, SecCertificateExt}; @@ -31,7 +31,7 @@ use self::security_framework_sys::base::errSecParam; use {Protocol, TlsAcceptorBuilder, TlsConnectorBuilder}; -static SET_AT_EXIT: Once = ONCE_INIT; +static SET_AT_EXIT: Once = Once::new(); #[cfg(not(target_os = "ios"))] lazy_static! { @@ -51,12 +51,8 @@ fn convert_protocol(protocol: Protocol) -> SslProtocol { pub struct Error(base::Error); impl error::Error for Error { - fn description(&self) -> &str { - error::Error::description(&self.0) - } - - fn cause(&self) -> Option<&error::Error> { - error::Error::cause(&self.0) + fn source(&self) -> Option<&(dyn error::Error + 'static)> { + error::Error::source(&self.0) } } @@ -97,7 +93,7 @@ impl Identity { let identity_cert = identity.certificate()?.to_der(); Ok(Identity { - identity: identity, + identity, chain: import .cert_chain .unwrap_or(vec![]) diff --git a/src/lib.rs b/src/lib.rs index 34f3fa0a..3edcb86f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -132,12 +132,8 @@ pub type Result = result::Result; pub struct Error(imp::Error); impl error::Error for Error { - fn description(&self) -> &str { - error::Error::description(&self.0) - } - - fn cause(&self) -> Option<&error::Error> { - error::Error::cause(&self.0) + fn source(&self) -> Option<&(dyn error::Error + 'static)> { + error::Error::source(&self.0) } } @@ -271,11 +267,7 @@ impl error::Error for HandshakeError where S: Any + fmt::Debug, { - fn description(&self) -> &str { - "handshake error" - } - - fn cause(&self) -> Option<&error::Error> { + fn source(&self) -> Option<&(dyn error::Error + 'static)> { match *self { HandshakeError::Failure(ref e) => Some(e), HandshakeError::WouldBlock(_) => None,