Skip to content

Commit

Permalink
Merge pull request #153 from sfackler/fix-warnings
Browse files Browse the repository at this point in the history
Fix warnings after version bump
  • Loading branch information
sfackler authored Mar 5, 2020
2 parents 2799db3 + e3ebe77 commit 16ae466
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 40 deletions.
4 changes: 3 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ jobs:
- image: rust:<< parameters.image >>
environment:
RUST_BACKTRACE: 1
RUSTFLAGS: -D warnings
steps:
- checkout
- restore_cache:
Expand Down Expand Up @@ -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 >>
Expand All @@ -61,6 +63,6 @@ workflows:
jobs:
- linux:
name: openssl
image: 1.37.0-stretch
image: 1.37.0
- macos:
version: 1.37.0
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
17 changes: 5 additions & 12 deletions src/imp/openssl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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());
}

Expand Down Expand Up @@ -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),
}
}
}
Expand Down
8 changes: 2 additions & 6 deletions src/imp/schannel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}

Expand Down
14 changes: 5 additions & 9 deletions src/imp/security_framework.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand All @@ -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! {
Expand All @@ -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)
}
}

Expand Down Expand Up @@ -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![])
Expand Down
14 changes: 3 additions & 11 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,12 +132,8 @@ pub type Result<T> = result::Result<T, Error>;
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)
}
}

Expand Down Expand Up @@ -271,11 +267,7 @@ impl<S> error::Error for HandshakeError<S>
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,
Expand Down

0 comments on commit 16ae466

Please sign in to comment.