diff options
Diffstat (limited to 'tokio-tls')
-rw-r--r-- | tokio-tls/Cargo.toml | 10 | ||||
-rw-r--r-- | tokio-tls/README.md | 3 | ||||
-rw-r--r-- | tokio-tls/examples/download-rust-lang.rs | 15 | ||||
-rw-r--r-- | tokio-tls/examples/echo.rs | 11 | ||||
-rw-r--r-- | tokio-tls/src/lib.rs | 14 | ||||
-rw-r--r-- | tokio-tls/tests/bad.rs | 27 | ||||
-rw-r--r-- | tokio-tls/tests/google.rs | 23 | ||||
-rw-r--r-- | tokio-tls/tests/smoke.rs | 32 |
8 files changed, 52 insertions, 83 deletions
diff --git a/tokio-tls/Cargo.toml b/tokio-tls/Cargo.toml index 3d48213d..f026a0bf 100644 --- a/tokio-tls/Cargo.toml +++ b/tokio-tls/Cargo.toml @@ -7,8 +7,9 @@ name = "tokio-tls" # - Cargo.toml # - README.md # - Update CHANGELOG.md. -# - Create "v0.2.x" git tag. -version = "0.2.1" +# - Create "v0.3.x" git tag. +version = "0.3.0" +edition = "2018" authors = ["Carl Lerche <me@carllerche.com>"] license = "MIT" repository = "https://github.com/tokio-rs/tokio" @@ -19,6 +20,7 @@ An implementation of TLS/SSL streams for Tokio giving an implementation of TLS for nonblocking I/O streams. """ categories = ["asynchronous", "network-programming"] +publish = false [badges] travis-ci = { repository = "tokio-rs/tokio-tls" } @@ -26,10 +28,10 @@ travis-ci = { repository = "tokio-rs/tokio-tls" } [dependencies] futures = "0.1.23" native-tls = "0.2" -tokio-io = "0.1.7" +tokio-io = { version = "0.2.0", path = "../tokio-io" } [dev-dependencies] -tokio = "0.1" +tokio = { version = "0.2.0", path = "../tokio" } cfg-if = "0.1" env_logger = { version = "0.5", default-features = false } diff --git a/tokio-tls/README.md b/tokio-tls/README.md index c82a78ca..f033ae1b 100644 --- a/tokio-tls/README.md +++ b/tokio-tls/README.md @@ -20,9 +20,6 @@ tokio-tls = "0.2" Next, add this to your crate: ```rust -extern crate native_tls; -extern crate tokio_tls; - use tokio_tls::{TlsConnector, TlsAcceptor}; ``` diff --git a/tokio-tls/examples/download-rust-lang.rs b/tokio-tls/examples/download-rust-lang.rs index 9d23dc78..08e463bf 100644 --- a/tokio-tls/examples/download-rust-lang.rs +++ b/tokio-tls/examples/download-rust-lang.rs @@ -1,18 +1,15 @@ -extern crate futures; -extern crate native_tls; -extern crate tokio; -extern crate tokio_io; -extern crate tokio_tls; - -use std::io; -use std::net::ToSocketAddrs; +#![deny(warnings, rust_2018_idioms)] use futures::Future; use native_tls::TlsConnector; +use std::io; +use std::net::ToSocketAddrs; use tokio::net::TcpStream; use tokio::runtime::Runtime; +use tokio_io; +use tokio_tls; -fn main() -> Result<(), Box<std::error::Error>> { +fn main() -> Result<(), Box<dyn std::error::Error>> { let mut runtime = Runtime::new()?; let addr = "www.rust-lang.org:443" .to_socket_addrs()? diff --git a/tokio-tls/examples/echo.rs b/tokio-tls/examples/echo.rs index c39d5873..7622eae0 100644 --- a/tokio-tls/examples/echo.rs +++ b/tokio-tls/examples/echo.rs @@ -1,14 +1,15 @@ -// A tiny async TLS echo server with Tokio -extern crate native_tls; -extern crate tokio; -extern crate tokio_tls; +#![deny(warnings, rust_2018_idioms)] +// A tiny async TLS echo server with Tokio +use native_tls; use native_tls::Identity; +use tokio; use tokio::io; use tokio::net::TcpListener; use tokio::prelude::*; +use tokio_tls; -fn main() -> Result<(), Box<std::error::Error>> { +fn main() -> Result<(), Box<dyn std::error::Error>> { // Bind the server's socket let addr = "127.0.0.1:12345".parse()?; let tcp = TcpListener::bind(&addr)?; diff --git a/tokio-tls/src/lib.rs b/tokio-tls/src/lib.rs index 66bc3964..21932799 100644 --- a/tokio-tls/src/lib.rs +++ b/tokio-tls/src/lib.rs @@ -1,5 +1,7 @@ -#![deny(missing_docs)] #![doc(html_root_url = "https://docs.rs/tokio-tls/0.2.1")] +#![deny(rust_2018_idioms)] +#![cfg_attr(test, deny(warnings))] +#![doc(test(no_crate_inject, attr(deny(rust_2018_idioms))))] //! Async TLS streams //! @@ -18,16 +20,10 @@ //! built. Configuration of TLS parameters is still primarily done through the //! `native-tls` crate. -extern crate futures; -extern crate native_tls; -#[macro_use] -extern crate tokio_io; - -use std::io::{self, Read, Write}; - use futures::{Async, Future, Poll}; use native_tls::{Error, HandshakeError}; -use tokio_io::{AsyncRead, AsyncWrite}; +use std::io::{self, Read, Write}; +use tokio_io::{try_nb, AsyncRead, AsyncWrite}; /// A wrapper around an underlying raw stream which implements the TLS or SSL /// protocol. diff --git a/tokio-tls/tests/bad.rs b/tokio-tls/tests/bad.rs index 8b010a2a..e72b2d23 100644 --- a/tokio-tls/tests/bad.rs +++ b/tokio-tls/tests/bad.rs @@ -1,19 +1,14 @@ -extern crate env_logger; -extern crate futures; -extern crate native_tls; -extern crate tokio; -extern crate tokio_tls; - -#[macro_use] -extern crate cfg_if; - -use std::io::{self, Error}; -use std::net::ToSocketAddrs; +#![deny(warnings, rust_2018_idioms)] +use cfg_if::cfg_if; +use env_logger; use futures::Future; use native_tls::TlsConnector; +use std::io::{self, Error}; +use std::net::ToSocketAddrs; use tokio::net::TcpStream; use tokio::runtime::Runtime; +use tokio_tls; macro_rules! t { ($e:expr) => { @@ -50,8 +45,6 @@ cfg_if! { all(not(target_os = "macos"), not(target_os = "windows"), not(target_os = "ios"))))] { - extern crate openssl; - fn verify_failed(err: &Error) { assert!(format!("{}", err).contains("certificate verify failed")) } @@ -66,10 +59,10 @@ cfg_if! { assert!(format!("{}", err).contains("was not trusted.")) } - use assert_invalid_cert_chain as assert_expired_error; - use assert_invalid_cert_chain as assert_wrong_host; - use assert_invalid_cert_chain as assert_self_signed; - use assert_invalid_cert_chain as assert_untrusted_root; + use crate::assert_invalid_cert_chain as assert_expired_error; + use crate::assert_invalid_cert_chain as assert_wrong_host; + use crate::assert_invalid_cert_chain as assert_self_signed; + use crate::assert_invalid_cert_chain as assert_untrusted_root; } else { fn assert_expired_error(err: &Error) { let s = err.to_string(); diff --git a/tokio-tls/tests/google.rs b/tokio-tls/tests/google.rs index aa4fc0f0..15346d4c 100644 --- a/tokio-tls/tests/google.rs +++ b/tokio-tls/tests/google.rs @@ -1,21 +1,16 @@ -extern crate env_logger; -extern crate futures; -extern crate native_tls; -extern crate tokio; -extern crate tokio_io; -extern crate tokio_tls; - -#[macro_use] -extern crate cfg_if; - -use std::io; -use std::net::ToSocketAddrs; +#![deny(warnings, rust_2018_idioms)] +use cfg_if::cfg_if; +use env_logger; use futures::Future; +use native_tls; use native_tls::TlsConnector; +use std::io; +use std::net::ToSocketAddrs; use tokio::net::TcpStream; use tokio::runtime::Runtime; use tokio_io::io::{flush, read_to_end, write_all}; +use tokio_tls; macro_rules! t { ($e:expr) => { @@ -36,8 +31,6 @@ cfg_if! { all(not(target_os = "macos"), not(target_os = "windows"), not(target_os = "ios"))))] { - extern crate openssl; - fn assert_bad_hostname_error(err: &io::Error) { let err = err.get_ref().unwrap(); let err = err.downcast_ref::<native_tls::Error>().unwrap(); @@ -92,7 +85,7 @@ fn fetch_google() { assert!(data.starts_with(b"HTTP/1.0 ")); let data = String::from_utf8_lossy(&data); - let data = data.trim_right(); + let data = data.trim_end(); assert!(data.ends_with("</html>") || data.ends_with("</HTML>")); } diff --git a/tokio-tls/tests/smoke.rs b/tokio-tls/tests/smoke.rs index 33a4a3a3..18d5dde8 100644 --- a/tokio-tls/tests/smoke.rs +++ b/tokio-tls/tests/smoke.rs @@ -1,23 +1,18 @@ -extern crate env_logger; -extern crate futures; -extern crate native_tls; -extern crate tokio; -extern crate tokio_io; -extern crate tokio_tls; - -#[macro_use] -extern crate cfg_if; - -use std::io::{self, Read, Write}; -use std::process::Command; +#![deny(warnings, rust_2018_idioms)] +use cfg_if::cfg_if; +use env_logger; use futures::stream::Stream; use futures::{Future, Poll}; +use native_tls; use native_tls::{Identity, TlsAcceptor, TlsConnector}; +use std::io::{self, Read, Write}; +use std::process::Command; use tokio::net::{TcpListener, TcpStream}; use tokio::runtime::Runtime; use tokio_io::io::{copy, read_to_end, shutdown}; use tokio_io::{AsyncRead, AsyncWrite}; +use tokio_tls; macro_rules! t { ($e:expr) => { @@ -130,9 +125,8 @@ fn openssl_keys() -> &'static Keys { cfg_if! { if #[cfg(feature = "rustls")] { - extern crate webpki; - extern crate untrusted; - + use webpki; + use untrusted; use std::env; use std::fs::File; use std::process::Command; @@ -230,8 +224,6 @@ cfg_if! { all(not(target_os = "macos"), not(target_os = "windows"), not(target_os = "ios"))))] { - extern crate openssl; - use std::fs::File; use std::env; use std::sync::{Once, ONCE_INIT}; @@ -250,8 +242,6 @@ cfg_if! { (t!(srv.build()).into(), t!(client.build()).into()) } } else if #[cfg(any(target_os = "macos", target_os = "ios"))] { - extern crate security_framework; - use std::env; use std::fs::File; use std::sync::{Once, ONCE_INIT}; @@ -269,8 +259,8 @@ cfg_if! { (t!(srv.build()).into(), t!(client.build()).into()) } } else { - extern crate schannel; - extern crate winapi; + use schannel; + use winapi; use std::env; use std::fs::File; |