Skip to content

Commit 16ae466

Browse files
authored
Merge pull request #153 from sfackler/fix-warnings
Fix warnings after version bump
2 parents 2799db3 + e3ebe77 commit 16ae466

File tree

6 files changed

+19
-40
lines changed

6 files changed

+19
-40
lines changed

.circleci/config.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ jobs:
99
- image: rust:<< parameters.image >>
1010
environment:
1111
RUST_BACKTRACE: 1
12+
RUSTFLAGS: -D warnings
1213
steps:
1314
- checkout
1415
- restore_cache:
@@ -36,6 +37,7 @@ jobs:
3637
xcode: "9.0"
3738
environment:
3839
RUST_BACKTRACE: 1
40+
RUSTFLAGS: -D warnings
3941
steps:
4042
- checkout
4143
- run: curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain << parameters.version >>
@@ -61,6 +63,6 @@ workflows:
6163
jobs:
6264
- linux:
6365
name: openssl
64-
image: 1.37.0-stretch
66+
image: 1.37.0
6567
- macos:
6668
version: 1.37.0

appveyor.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
environment:
2-
RUST_VERSION: 1.32.0
2+
RUST_VERSION: 1.37.0
33
TARGET: x86_64-pc-windows-msvc
44
install:
55
- ps: Start-FileDownload "https://static.rust-lang.org/dist/rust-${env:RUST_VERSION}-${env:TARGET}.exe"

src/imp/openssl.rs

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use self::openssl::x509::{X509, X509VerifyResult};
1414
use std::error;
1515
use std::fmt;
1616
use std::io;
17-
use std::sync::{Once, ONCE_INIT};
17+
use std::sync::Once;
1818

1919
use {Protocol, TlsAcceptorBuilder, TlsConnectorBuilder};
2020
use self::openssl::pkey::Private;
@@ -90,7 +90,7 @@ fn supported_protocols(
9090
}
9191

9292
fn init_trust() {
93-
static ONCE: Once = ONCE_INIT;
93+
static ONCE: Once = Once::new();
9494
ONCE.call_once(|| openssl_probe::init_ssl_cert_env_vars());
9595
}
9696

@@ -120,17 +120,10 @@ pub enum Error {
120120
}
121121

122122
impl error::Error for Error {
123-
fn description(&self) -> &str {
123+
fn source(&self) -> Option<&(dyn error::Error + 'static)> {
124124
match *self {
125-
Error::Normal(ref e) => error::Error::description(e),
126-
Error::Ssl(ref e, _) => error::Error::description(e),
127-
}
128-
}
129-
130-
fn cause(&self) -> Option<&error::Error> {
131-
match *self {
132-
Error::Normal(ref e) => error::Error::cause(e),
133-
Error::Ssl(ref e, _) => error::Error::cause(e),
125+
Error::Normal(ref e) => error::Error::source(e),
126+
Error::Ssl(ref e, _) => error::Error::source(e),
134127
}
135128
}
136129
}

src/imp/schannel.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,8 @@ fn convert_protocols(min: Option<::Protocol>, max: Option<::Protocol>) -> &'stat
3434
pub struct Error(io::Error);
3535

3636
impl error::Error for Error {
37-
fn description(&self) -> &str {
38-
error::Error::description(&self.0)
39-
}
40-
41-
fn cause(&self) -> Option<&error::Error> {
42-
error::Error::cause(&self.0)
37+
fn source(&self) -> Option<&(dyn error::Error + 'static)> {
38+
error::Error::source(&self.0)
4339
}
4440
}
4541

src/imp/security_framework.rs

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use std::error;
1616
use std::fmt;
1717
use std::io;
1818
use std::sync::Mutex;
19-
use std::sync::{Once, ONCE_INIT};
19+
use std::sync::Once;
2020

2121
#[cfg(not(target_os = "ios"))]
2222
use self::security_framework::os::macos::certificate::{PropertyType, SecCertificateExt};
@@ -31,7 +31,7 @@ use self::security_framework_sys::base::errSecParam;
3131

3232
use {Protocol, TlsAcceptorBuilder, TlsConnectorBuilder};
3333

34-
static SET_AT_EXIT: Once = ONCE_INIT;
34+
static SET_AT_EXIT: Once = Once::new();
3535

3636
#[cfg(not(target_os = "ios"))]
3737
lazy_static! {
@@ -51,12 +51,8 @@ fn convert_protocol(protocol: Protocol) -> SslProtocol {
5151
pub struct Error(base::Error);
5252

5353
impl error::Error for Error {
54-
fn description(&self) -> &str {
55-
error::Error::description(&self.0)
56-
}
57-
58-
fn cause(&self) -> Option<&error::Error> {
59-
error::Error::cause(&self.0)
54+
fn source(&self) -> Option<&(dyn error::Error + 'static)> {
55+
error::Error::source(&self.0)
6056
}
6157
}
6258

@@ -97,7 +93,7 @@ impl Identity {
9793
let identity_cert = identity.certificate()?.to_der();
9894

9995
Ok(Identity {
100-
identity: identity,
96+
identity,
10197
chain: import
10298
.cert_chain
10399
.unwrap_or(vec![])

src/lib.rs

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -132,12 +132,8 @@ pub type Result<T> = result::Result<T, Error>;
132132
pub struct Error(imp::Error);
133133

134134
impl error::Error for Error {
135-
fn description(&self) -> &str {
136-
error::Error::description(&self.0)
137-
}
138-
139-
fn cause(&self) -> Option<&error::Error> {
140-
error::Error::cause(&self.0)
135+
fn source(&self) -> Option<&(dyn error::Error + 'static)> {
136+
error::Error::source(&self.0)
141137
}
142138
}
143139

@@ -271,11 +267,7 @@ impl<S> error::Error for HandshakeError<S>
271267
where
272268
S: Any + fmt::Debug,
273269
{
274-
fn description(&self) -> &str {
275-
"handshake error"
276-
}
277-
278-
fn cause(&self) -> Option<&error::Error> {
270+
fn source(&self) -> Option<&(dyn error::Error + 'static)> {
279271
match *self {
280272
HandshakeError::Failure(ref e) => Some(e),
281273
HandshakeError::WouldBlock(_) => None,

0 commit comments

Comments
 (0)