diff --git a/README.md b/README.md index fcc40af..13f60c3 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,7 @@ For IntelliJ IDEA users, please refer to [this](https://github.com/intellij-rust ### Rust Version -`tonic` currently works on Rust `1.60` and above as it requires support for the 2018 edition. +`tonic`'s MSRV is `1.60`. ```bash $ rustup update diff --git a/examples/Cargo.toml b/examples/Cargo.toml index ed83281..6a38803 100644 --- a/examples/Cargo.toml +++ b/examples/Cargo.toml @@ -1,6 +1,6 @@ [package] authors = ["Lucio Franco "] -edition = "2018" +edition = "2021" license = "MIT" name = "examples" publish = false diff --git a/examples/src/blocking/client.rs b/examples/src/blocking/client.rs index fe83348..3feb739 100644 --- a/examples/src/blocking/client.rs +++ b/examples/src/blocking/client.rs @@ -21,7 +21,7 @@ struct BlockingClient { impl BlockingClient { pub fn connect(dst: D) -> Result where - D: std::convert::TryInto, + D: TryInto, D::Error: Into, { let rt = Builder::new_multi_thread().enable_all().build().unwrap(); diff --git a/examples/src/mock/mock.rs b/examples/src/mock/mock.rs index ac5d2a0..6a28c74 100644 --- a/examples/src/mock/mock.rs +++ b/examples/src/mock/mock.rs @@ -1,4 +1,3 @@ -use std::convert::TryFrom; use tonic::{ transport::{Endpoint, Server, Uri}, Request, Response, Status, diff --git a/examples/src/uds/client.rs b/examples/src/uds/client.rs index efa04fb..e78531a 100644 --- a/examples/src/uds/client.rs +++ b/examples/src/uds/client.rs @@ -5,7 +5,6 @@ pub mod hello_world { } use hello_world::{greeter_client::GreeterClient, HelloRequest}; -use std::convert::TryFrom; #[cfg(unix)] use tokio::net::UnixStream; use tonic::transport::{Endpoint, Uri}; diff --git a/interop/Cargo.toml b/interop/Cargo.toml index 229d5e1..b1b722d 100644 --- a/interop/Cargo.toml +++ b/interop/Cargo.toml @@ -1,6 +1,6 @@ [package] authors = ["Lucio Franco "] -edition = "2018" +edition = "2021" license = "MIT" name = "interop" publish = false diff --git a/rustfmt.toml b/rustfmt.toml index 32a9786..3a26366 100644 --- a/rustfmt.toml +++ b/rustfmt.toml @@ -1 +1 @@ -edition = "2018" +edition = "2021" diff --git a/tests/ambiguous_methods/Cargo.toml b/tests/ambiguous_methods/Cargo.toml index 2a2789f..d0d193a 100644 --- a/tests/ambiguous_methods/Cargo.toml +++ b/tests/ambiguous_methods/Cargo.toml @@ -1,6 +1,6 @@ [package] authors = ["Yonathan Randolph "] -edition = "2018" +edition = "2021" license = "MIT" name = "ambiguous_methods" publish = false diff --git a/tests/compression/Cargo.toml b/tests/compression/Cargo.toml index 500df49..8f6e352 100644 --- a/tests/compression/Cargo.toml +++ b/tests/compression/Cargo.toml @@ -1,6 +1,6 @@ [package] authors = ["Lucio Franco "] -edition = "2018" +edition = "2021" license = "MIT" name = "compression" publish = false diff --git a/tests/compression/src/lib.rs b/tests/compression/src/lib.rs index 87e0544..00d735e 100644 --- a/tests/compression/src/lib.rs +++ b/tests/compression/src/lib.rs @@ -3,7 +3,6 @@ use self::util::*; use crate::util::mock_io_channel; use futures::{Stream, StreamExt}; -use std::convert::TryFrom; use std::{ pin::Pin, sync::{ diff --git a/tests/disable_comments/Cargo.toml b/tests/disable_comments/Cargo.toml index 3cc7dff..90bc0e4 100644 --- a/tests/disable_comments/Cargo.toml +++ b/tests/disable_comments/Cargo.toml @@ -1,6 +1,6 @@ [package] authors = ["bouzuya "] -edition = "2018" +edition = "2021" license = "MIT" name = "disable-comments" publish = false diff --git a/tests/extern_path/my_application/Cargo.toml b/tests/extern_path/my_application/Cargo.toml index 1787df8..06ad1bf 100644 --- a/tests/extern_path/my_application/Cargo.toml +++ b/tests/extern_path/my_application/Cargo.toml @@ -1,6 +1,6 @@ [package] authors = ["Danny Hua "] -edition = "2018" +edition = "2021" license = "MIT" name = "my_application" publish = false diff --git a/tests/extern_path/uuid/Cargo.toml b/tests/extern_path/uuid/Cargo.toml index 7ed3d64..b65b8fe 100644 --- a/tests/extern_path/uuid/Cargo.toml +++ b/tests/extern_path/uuid/Cargo.toml @@ -1,6 +1,6 @@ [package] authors = ["Danny Hua "] -edition = "2018" +edition = "2021" license = "MIT" name = "uuid1" publish = false diff --git a/tests/included_service/Cargo.toml b/tests/included_service/Cargo.toml index fe22fd0..77469fa 100644 --- a/tests/included_service/Cargo.toml +++ b/tests/included_service/Cargo.toml @@ -1,6 +1,6 @@ [package] authors = ["Lucio Franco "] -edition = "2018" +edition = "2021" license = "MIT" name = "included_service" publish = false diff --git a/tests/integration_tests/Cargo.toml b/tests/integration_tests/Cargo.toml index 17e8085..e52d1c6 100644 --- a/tests/integration_tests/Cargo.toml +++ b/tests/integration_tests/Cargo.toml @@ -1,6 +1,6 @@ [package] authors = ["Lucio Franco "] -edition = "2018" +edition = "2021" license = "MIT" name = "integration-tests" publish = false diff --git a/tests/integration_tests/tests/connect_info.rs b/tests/integration_tests/tests/connect_info.rs index cc57f6b..4b09a60 100644 --- a/tests/integration_tests/tests/connect_info.rs +++ b/tests/integration_tests/tests/connect_info.rs @@ -51,8 +51,6 @@ async fn getting_connect_info() { #[cfg(unix)] pub mod unix { - use std::convert::TryFrom as _; - use futures_util::FutureExt; use tokio::{ net::{UnixListener, UnixStream}, diff --git a/tests/integration_tests/tests/status.rs b/tests/integration_tests/tests/status.rs index 0c3920d..55182ec 100644 --- a/tests/integration_tests/tests/status.rs +++ b/tests/integration_tests/tests/status.rs @@ -6,7 +6,6 @@ use integration_tests::pb::{ test_client, test_server, test_stream_client, test_stream_server, Input, InputStream, Output, OutputStream, }; -use std::convert::TryFrom; use std::error::Error; use std::time::Duration; use tokio::sync::oneshot; diff --git a/tests/root-crate-path/Cargo.toml b/tests/root-crate-path/Cargo.toml index 5f2a657..50bb1fd 100644 --- a/tests/root-crate-path/Cargo.toml +++ b/tests/root-crate-path/Cargo.toml @@ -1,6 +1,6 @@ [package] authors = ["Lucio Franco "] -edition = "2018" +edition = "2021" license = "MIT" name = "root-crate-path" publish = false diff --git a/tests/same_name/Cargo.toml b/tests/same_name/Cargo.toml index b4e6f22..e2c69a7 100644 --- a/tests/same_name/Cargo.toml +++ b/tests/same_name/Cargo.toml @@ -1,6 +1,6 @@ [package] authors = ["Lucio Franco "] -edition = "2018" +edition = "2021" license = "MIT" name = "same_name" publish = false diff --git a/tests/service_named_service/Cargo.toml b/tests/service_named_service/Cargo.toml index 1e5ddb1..be97922 100644 --- a/tests/service_named_service/Cargo.toml +++ b/tests/service_named_service/Cargo.toml @@ -1,6 +1,6 @@ [package] authors = ["Lucio Franco "] -edition = "2018" +edition = "2021" license = "MIT" name = "service_named_service" publish = false diff --git a/tests/stream_conflict/Cargo.toml b/tests/stream_conflict/Cargo.toml index 180389d..866cba9 100644 --- a/tests/stream_conflict/Cargo.toml +++ b/tests/stream_conflict/Cargo.toml @@ -1,6 +1,6 @@ [package] authors = ["Ben Sully "] -edition = "2018" +edition = "2021" name = "stream_conflict" publish = false version = "0.1.0" diff --git a/tests/wellknown-compiled/Cargo.toml b/tests/wellknown-compiled/Cargo.toml index fc66698..2b816d8 100644 --- a/tests/wellknown-compiled/Cargo.toml +++ b/tests/wellknown-compiled/Cargo.toml @@ -1,6 +1,6 @@ [package] authors = ["Lucio Franco "] -edition = "2018" +edition = "2021" license = "MIT" name = "wellknown-compiled" publish = false diff --git a/tests/wellknown/Cargo.toml b/tests/wellknown/Cargo.toml index ea4bd93..194316e 100644 --- a/tests/wellknown/Cargo.toml +++ b/tests/wellknown/Cargo.toml @@ -1,6 +1,6 @@ [package] authors = ["Lucio Franco "] -edition = "2018" +edition = "2021" license = "MIT" name = "wellknown" publish = false diff --git a/tonic-build/Cargo.toml b/tonic-build/Cargo.toml index 7616706..74d096e 100644 --- a/tonic-build/Cargo.toml +++ b/tonic-build/Cargo.toml @@ -5,7 +5,7 @@ description = """ Codegen module of `tonic` gRPC implementation. """ documentation = "https://docs.rs/tonic-build/0.8.4/tonic_build/" -edition = "2018" +edition = "2021" homepage = "https://github.com/hyperium/tonic" keywords = ["rpc", "grpc", "async", "codegen", "protobuf"] license = "MIT" diff --git a/tonic-build/src/client.rs b/tonic-build/src/client.rs index 8bb8e60..6eb4f60 100644 --- a/tonic-build/src/client.rs +++ b/tonic-build/src/client.rs @@ -150,7 +150,7 @@ fn generate_connect(service_ident: &syn::Ident, enabled: bool) -> TokenStream { /// Attempt to create a new client by connecting to a given endpoint. pub async fn connect(dst: D) -> Result where - D: std::convert::TryInto, + D: TryInto, D::Error: Into, { let conn = tonic::transport::Endpoint::new(dst)?.connect().await?; diff --git a/tonic-health/Cargo.toml b/tonic-health/Cargo.toml index cf55fa5..7fc1fb4 100644 --- a/tonic-health/Cargo.toml +++ b/tonic-health/Cargo.toml @@ -5,7 +5,7 @@ description = """ Health Checking module of `tonic` gRPC implementation. """ documentation = "https://docs.rs/tonic-health/0.7.0/tonic-health/" -edition = "2018" +edition = "2021" homepage = "https://github.com/hyperium/tonic" keywords = ["rpc", "grpc", "async", "healthcheck"] license = "MIT" diff --git a/tonic-reflection/Cargo.toml b/tonic-reflection/Cargo.toml index 224e765..5dcfcc2 100644 --- a/tonic-reflection/Cargo.toml +++ b/tonic-reflection/Cargo.toml @@ -7,7 +7,7 @@ categories = ["network-programming", "asynchronous"] description = """ Server Reflection module of `tonic` gRPC implementation. """ -edition = "2018" +edition = "2021" homepage = "https://github.com/hyperium/tonic" documentation = "https://docs.rs/tonic-reflection/0.5.0/tonic-reflection/" keywords = ["rpc", "grpc", "async", "reflection"] diff --git a/tonic-types/Cargo.toml b/tonic-types/Cargo.toml index a958966..7665f14 100644 --- a/tonic-types/Cargo.toml +++ b/tonic-types/Cargo.toml @@ -5,7 +5,7 @@ description = """ A collection of useful protobuf types that can be used with `tonic`. """ documentation = "https://docs.rs/tonic-types/0.5.0/tonic-types/" -edition = "2018" +edition = "2021" homepage = "https://github.com/hyperium/tonic" keywords = ["rpc", "grpc", "protobuf"] license = "MIT" diff --git a/tonic-types/src/richer_error/std_messages/retry_info.rs b/tonic-types/src/richer_error/std_messages/retry_info.rs index ca0b363..4e1fe25 100644 --- a/tonic-types/src/richer_error/std_messages/retry_info.rs +++ b/tonic-types/src/richer_error/std_messages/retry_info.rs @@ -1,4 +1,4 @@ -use std::{convert::TryFrom, time}; +use std::time; use prost::{DecodeError, Message}; use prost_types::Any; diff --git a/tonic-web/Cargo.toml b/tonic-web/Cargo.toml index 5958909..26549bc 100644 --- a/tonic-web/Cargo.toml +++ b/tonic-web/Cargo.toml @@ -5,7 +5,7 @@ description = """ grpc-web protocol translation for tonic services. """ documentation = "https://docs.rs/tonic-web/0.4.0/tonic-web/" -edition = "2018" +edition = "2021" homepage = "https://github.com/hyperium/tonic" keywords = ["rpc", "grpc", "grpc-web"] license = "MIT" diff --git a/tonic-web/tests/integration/Cargo.toml b/tonic-web/tests/integration/Cargo.toml index 14d28e7..9e7facd 100644 --- a/tonic-web/tests/integration/Cargo.toml +++ b/tonic-web/tests/integration/Cargo.toml @@ -1,6 +1,6 @@ [package] authors = ["Juan Alvarez "] -edition = "2018" +edition = "2021" name = "integration" publish = false version = "0.1.0" diff --git a/tonic/Cargo.toml b/tonic/Cargo.toml index a88ad10..bfea98d 100644 --- a/tonic/Cargo.toml +++ b/tonic/Cargo.toml @@ -14,7 +14,7 @@ description = """ A gRPC over HTTP/2 implementation focused on high performance, interoperability, and flexibility. """ documentation = "https://docs.rs/tonic/0.8.2/tonic/" -edition = "2018" +edition = "2021" homepage = "https://github.com/hyperium/tonic" keywords = ["rpc", "grpc", "async", "futures", "protobuf"] license = "MIT" diff --git a/tonic/benches-disabled/benchmarks/compiled_protos/helloworld.rs b/tonic/benches-disabled/benchmarks/compiled_protos/helloworld.rs index 8230522..9dcb33a 100755 --- a/tonic/benches-disabled/benchmarks/compiled_protos/helloworld.rs +++ b/tonic/benches-disabled/benchmarks/compiled_protos/helloworld.rs @@ -22,7 +22,7 @@ pub mod client { #[doc = r" Attempt to create a new client by connecting to a given endpoint."] pub async fn connect(dst: D) -> Result where - D: std::convert::TryInto, + D: TryInto, D::Error: Into, { let conn = tonic::transport::Endpoint::new(dst)?.connect().await?; diff --git a/tonic/src/metadata/value.rs b/tonic/src/metadata/value.rs index 57e9719..31bcd4d 100644 --- a/tonic/src/metadata/value.rs +++ b/tonic/src/metadata/value.rs @@ -7,7 +7,6 @@ use super::key::MetadataKey; use bytes::Bytes; use http::header::HeaderValue; -use std::convert::TryFrom; use std::error::Error; use std::hash::{Hash, Hasher}; use std::marker::PhantomData; @@ -286,7 +285,6 @@ impl MetadataValue { /// /// ``` /// # use tonic::metadata::*; -/// # use std::convert::TryFrom; /// let val = AsciiMetadataValue::try_from(b"hello\xfa").unwrap(); /// assert_eq!(val, &b"hello\xfa"[..]); /// ``` @@ -295,7 +293,6 @@ impl MetadataValue { /// /// ``` /// # use tonic::metadata::*; -/// # use std::convert::TryFrom; /// let val = AsciiMetadataValue::try_from(b"\n"); /// assert!(val.is_err()); /// ``` @@ -324,7 +321,6 @@ impl<'a, VE: ValueEncoding> TryFrom<&'a [u8]> for MetadataValue { /// /// ``` /// # use tonic::metadata::*; -/// # use std::convert::TryFrom; /// let val = AsciiMetadataValue::try_from(b"hello\xfa").unwrap(); /// assert_eq!(val, &b"hello\xfa"[..]); /// ``` @@ -333,7 +329,6 @@ impl<'a, VE: ValueEncoding> TryFrom<&'a [u8]> for MetadataValue { /// /// ``` /// # use tonic::metadata::*; -/// # use std::convert::TryFrom; /// let val = AsciiMetadataValue::try_from(b"\n"); /// assert!(val.is_err()); /// ``` @@ -473,7 +468,6 @@ impl MetadataValue { /// /// ``` /// # use tonic::metadata::*; - /// # use std::convert::TryFrom; /// let val = AsciiMetadataValue::from_key::("accept".parse().unwrap()); /// assert_eq!(val, AsciiMetadataValue::try_from(b"accept").unwrap()); /// ``` diff --git a/tonic/src/transport/channel/endpoint.rs b/tonic/src/transport/channel/endpoint.rs index 1de3f1c..844add0 100644 --- a/tonic/src/transport/channel/endpoint.rs +++ b/tonic/src/transport/channel/endpoint.rs @@ -7,14 +7,7 @@ use crate::transport::service::TlsConnector; use crate::transport::{service::SharedExec, Error, Executor}; use bytes::Bytes; use http::{uri::Uri, HeaderValue}; -use std::{ - convert::{TryFrom, TryInto}, - fmt, - future::Future, - pin::Pin, - str::FromStr, - time::Duration, -}; +use std::{fmt, future::Future, pin::Pin, str::FromStr, time::Duration}; use tower::make::MakeConnection; // use crate::transport::E diff --git a/tonic/src/transport/service/connector.rs b/tonic/src/transport/service/connector.rs index 9d49d3e..158d98a 100644 --- a/tonic/src/transport/service/connector.rs +++ b/tonic/src/transport/service/connector.rs @@ -3,8 +3,6 @@ use super::io::BoxedIo; #[cfg(feature = "tls")] use super::tls::TlsConnector; use http::Uri; -#[cfg(feature = "tls-roots-common")] -use std::convert::TryInto; use std::fmt; use std::task::{Context, Poll}; use tower::make::MakeConnection; diff --git a/tonic/src/transport/service/tls.rs b/tonic/src/transport/service/tls.rs index 3851298..e3c23ff 100644 --- a/tonic/src/transport/service/tls.rs +++ b/tonic/src/transport/service/tls.rs @@ -5,8 +5,6 @@ use crate::transport::{ }; #[cfg(feature = "tls-roots")] use rustls_native_certs; -#[cfg(feature = "tls")] -use std::convert::TryInto; use std::{fmt, sync::Arc}; use tokio::io::{AsyncRead, AsyncWrite}; #[cfg(feature = "tls")]