chore: Update to 2021 edition (#1188)

This commit is contained in:
tottoto
2022-12-13 15:16:49 -05:00
committed by GitHub
parent 25ea473abd
commit bf22a740c3
37 changed files with 29 additions and 52 deletions
+1 -1
View File
@@ -45,7 +45,7 @@ For IntelliJ IDEA users, please refer to [this](https://github.com/intellij-rust
### Rust Version ### 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 ```bash
$ rustup update $ rustup update
+1 -1
View File
@@ -1,6 +1,6 @@
[package] [package]
authors = ["Lucio Franco <[email protected]>"] authors = ["Lucio Franco <[email protected]>"]
edition = "2018" edition = "2021"
license = "MIT" license = "MIT"
name = "examples" name = "examples"
publish = false publish = false
+1 -1
View File
@@ -21,7 +21,7 @@ struct BlockingClient {
impl BlockingClient { impl BlockingClient {
pub fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error> pub fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
where where
D: std::convert::TryInto<tonic::transport::Endpoint>, D: TryInto<tonic::transport::Endpoint>,
D::Error: Into<StdError>, D::Error: Into<StdError>,
{ {
let rt = Builder::new_multi_thread().enable_all().build().unwrap(); let rt = Builder::new_multi_thread().enable_all().build().unwrap();
-1
View File
@@ -1,4 +1,3 @@
use std::convert::TryFrom;
use tonic::{ use tonic::{
transport::{Endpoint, Server, Uri}, transport::{Endpoint, Server, Uri},
Request, Response, Status, Request, Response, Status,
-1
View File
@@ -5,7 +5,6 @@ pub mod hello_world {
} }
use hello_world::{greeter_client::GreeterClient, HelloRequest}; use hello_world::{greeter_client::GreeterClient, HelloRequest};
use std::convert::TryFrom;
#[cfg(unix)] #[cfg(unix)]
use tokio::net::UnixStream; use tokio::net::UnixStream;
use tonic::transport::{Endpoint, Uri}; use tonic::transport::{Endpoint, Uri};
+1 -1
View File
@@ -1,6 +1,6 @@
[package] [package]
authors = ["Lucio Franco <[email protected]>"] authors = ["Lucio Franco <[email protected]>"]
edition = "2018" edition = "2021"
license = "MIT" license = "MIT"
name = "interop" name = "interop"
publish = false publish = false
+1 -1
View File
@@ -1 +1 @@
edition = "2018" edition = "2021"
+1 -1
View File
@@ -1,6 +1,6 @@
[package] [package]
authors = ["Yonathan Randolph <[email protected]>"] authors = ["Yonathan Randolph <[email protected]>"]
edition = "2018" edition = "2021"
license = "MIT" license = "MIT"
name = "ambiguous_methods" name = "ambiguous_methods"
publish = false publish = false
+1 -1
View File
@@ -1,6 +1,6 @@
[package] [package]
authors = ["Lucio Franco <[email protected]>"] authors = ["Lucio Franco <[email protected]>"]
edition = "2018" edition = "2021"
license = "MIT" license = "MIT"
name = "compression" name = "compression"
publish = false publish = false
-1
View File
@@ -3,7 +3,6 @@
use self::util::*; use self::util::*;
use crate::util::mock_io_channel; use crate::util::mock_io_channel;
use futures::{Stream, StreamExt}; use futures::{Stream, StreamExt};
use std::convert::TryFrom;
use std::{ use std::{
pin::Pin, pin::Pin,
sync::{ sync::{
+1 -1
View File
@@ -1,6 +1,6 @@
[package] [package]
authors = ["bouzuya <[email protected]>"] authors = ["bouzuya <[email protected]>"]
edition = "2018" edition = "2021"
license = "MIT" license = "MIT"
name = "disable-comments" name = "disable-comments"
publish = false publish = false
+1 -1
View File
@@ -1,6 +1,6 @@
[package] [package]
authors = ["Danny Hua <[email protected]>"] authors = ["Danny Hua <[email protected]>"]
edition = "2018" edition = "2021"
license = "MIT" license = "MIT"
name = "my_application" name = "my_application"
publish = false publish = false
+1 -1
View File
@@ -1,6 +1,6 @@
[package] [package]
authors = ["Danny Hua <[email protected]>"] authors = ["Danny Hua <[email protected]>"]
edition = "2018" edition = "2021"
license = "MIT" license = "MIT"
name = "uuid1" name = "uuid1"
publish = false publish = false
+1 -1
View File
@@ -1,6 +1,6 @@
[package] [package]
authors = ["Lucio Franco <[email protected]>"] authors = ["Lucio Franco <[email protected]>"]
edition = "2018" edition = "2021"
license = "MIT" license = "MIT"
name = "included_service" name = "included_service"
publish = false publish = false
+1 -1
View File
@@ -1,6 +1,6 @@
[package] [package]
authors = ["Lucio Franco <[email protected]>"] authors = ["Lucio Franco <[email protected]>"]
edition = "2018" edition = "2021"
license = "MIT" license = "MIT"
name = "integration-tests" name = "integration-tests"
publish = false publish = false
@@ -51,8 +51,6 @@ async fn getting_connect_info() {
#[cfg(unix)] #[cfg(unix)]
pub mod unix { pub mod unix {
use std::convert::TryFrom as _;
use futures_util::FutureExt; use futures_util::FutureExt;
use tokio::{ use tokio::{
net::{UnixListener, UnixStream}, net::{UnixListener, UnixStream},
-1
View File
@@ -6,7 +6,6 @@ use integration_tests::pb::{
test_client, test_server, test_stream_client, test_stream_server, Input, InputStream, Output, test_client, test_server, test_stream_client, test_stream_server, Input, InputStream, Output,
OutputStream, OutputStream,
}; };
use std::convert::TryFrom;
use std::error::Error; use std::error::Error;
use std::time::Duration; use std::time::Duration;
use tokio::sync::oneshot; use tokio::sync::oneshot;
+1 -1
View File
@@ -1,6 +1,6 @@
[package] [package]
authors = ["Lucio Franco <[email protected]>"] authors = ["Lucio Franco <[email protected]>"]
edition = "2018" edition = "2021"
license = "MIT" license = "MIT"
name = "root-crate-path" name = "root-crate-path"
publish = false publish = false
+1 -1
View File
@@ -1,6 +1,6 @@
[package] [package]
authors = ["Lucio Franco <[email protected]>"] authors = ["Lucio Franco <[email protected]>"]
edition = "2018" edition = "2021"
license = "MIT" license = "MIT"
name = "same_name" name = "same_name"
publish = false publish = false
+1 -1
View File
@@ -1,6 +1,6 @@
[package] [package]
authors = ["Lucio Franco <[email protected]>"] authors = ["Lucio Franco <[email protected]>"]
edition = "2018" edition = "2021"
license = "MIT" license = "MIT"
name = "service_named_service" name = "service_named_service"
publish = false publish = false
+1 -1
View File
@@ -1,6 +1,6 @@
[package] [package]
authors = ["Ben Sully <[email protected]>"] authors = ["Ben Sully <[email protected]>"]
edition = "2018" edition = "2021"
name = "stream_conflict" name = "stream_conflict"
publish = false publish = false
version = "0.1.0" version = "0.1.0"
+1 -1
View File
@@ -1,6 +1,6 @@
[package] [package]
authors = ["Lucio Franco <[email protected]>"] authors = ["Lucio Franco <[email protected]>"]
edition = "2018" edition = "2021"
license = "MIT" license = "MIT"
name = "wellknown-compiled" name = "wellknown-compiled"
publish = false publish = false
+1 -1
View File
@@ -1,6 +1,6 @@
[package] [package]
authors = ["Lucio Franco <[email protected]>"] authors = ["Lucio Franco <[email protected]>"]
edition = "2018" edition = "2021"
license = "MIT" license = "MIT"
name = "wellknown" name = "wellknown"
publish = false publish = false
+1 -1
View File
@@ -5,7 +5,7 @@ description = """
Codegen module of `tonic` gRPC implementation. Codegen module of `tonic` gRPC implementation.
""" """
documentation = "https://docs.rs/tonic-build/0.8.4/tonic_build/" documentation = "https://docs.rs/tonic-build/0.8.4/tonic_build/"
edition = "2018" edition = "2021"
homepage = "https://github.com/hyperium/tonic" homepage = "https://github.com/hyperium/tonic"
keywords = ["rpc", "grpc", "async", "codegen", "protobuf"] keywords = ["rpc", "grpc", "async", "codegen", "protobuf"]
license = "MIT" license = "MIT"
+1 -1
View File
@@ -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. /// Attempt to create a new client by connecting to a given endpoint.
pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error> pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
where where
D: std::convert::TryInto<tonic::transport::Endpoint>, D: TryInto<tonic::transport::Endpoint>,
D::Error: Into<StdError>, D::Error: Into<StdError>,
{ {
let conn = tonic::transport::Endpoint::new(dst)?.connect().await?; let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
+1 -1
View File
@@ -5,7 +5,7 @@ description = """
Health Checking module of `tonic` gRPC implementation. Health Checking module of `tonic` gRPC implementation.
""" """
documentation = "https://docs.rs/tonic-health/0.7.0/tonic-health/" documentation = "https://docs.rs/tonic-health/0.7.0/tonic-health/"
edition = "2018" edition = "2021"
homepage = "https://github.com/hyperium/tonic" homepage = "https://github.com/hyperium/tonic"
keywords = ["rpc", "grpc", "async", "healthcheck"] keywords = ["rpc", "grpc", "async", "healthcheck"]
license = "MIT" license = "MIT"
+1 -1
View File
@@ -7,7 +7,7 @@ categories = ["network-programming", "asynchronous"]
description = """ description = """
Server Reflection module of `tonic` gRPC implementation. Server Reflection module of `tonic` gRPC implementation.
""" """
edition = "2018" edition = "2021"
homepage = "https://github.com/hyperium/tonic" homepage = "https://github.com/hyperium/tonic"
documentation = "https://docs.rs/tonic-reflection/0.5.0/tonic-reflection/" documentation = "https://docs.rs/tonic-reflection/0.5.0/tonic-reflection/"
keywords = ["rpc", "grpc", "async", "reflection"] keywords = ["rpc", "grpc", "async", "reflection"]
+1 -1
View File
@@ -5,7 +5,7 @@ description = """
A collection of useful protobuf types that can be used with `tonic`. A collection of useful protobuf types that can be used with `tonic`.
""" """
documentation = "https://docs.rs/tonic-types/0.5.0/tonic-types/" documentation = "https://docs.rs/tonic-types/0.5.0/tonic-types/"
edition = "2018" edition = "2021"
homepage = "https://github.com/hyperium/tonic" homepage = "https://github.com/hyperium/tonic"
keywords = ["rpc", "grpc", "protobuf"] keywords = ["rpc", "grpc", "protobuf"]
license = "MIT" license = "MIT"
@@ -1,4 +1,4 @@
use std::{convert::TryFrom, time}; use std::time;
use prost::{DecodeError, Message}; use prost::{DecodeError, Message};
use prost_types::Any; use prost_types::Any;
+1 -1
View File
@@ -5,7 +5,7 @@ description = """
grpc-web protocol translation for tonic services. grpc-web protocol translation for tonic services.
""" """
documentation = "https://docs.rs/tonic-web/0.4.0/tonic-web/" documentation = "https://docs.rs/tonic-web/0.4.0/tonic-web/"
edition = "2018" edition = "2021"
homepage = "https://github.com/hyperium/tonic" homepage = "https://github.com/hyperium/tonic"
keywords = ["rpc", "grpc", "grpc-web"] keywords = ["rpc", "grpc", "grpc-web"]
license = "MIT" license = "MIT"
+1 -1
View File
@@ -1,6 +1,6 @@
[package] [package]
authors = ["Juan Alvarez <[email protected]>"] authors = ["Juan Alvarez <[email protected]>"]
edition = "2018" edition = "2021"
name = "integration" name = "integration"
publish = false publish = false
version = "0.1.0" version = "0.1.0"
+1 -1
View File
@@ -14,7 +14,7 @@ description = """
A gRPC over HTTP/2 implementation focused on high performance, interoperability, and flexibility. A gRPC over HTTP/2 implementation focused on high performance, interoperability, and flexibility.
""" """
documentation = "https://docs.rs/tonic/0.8.2/tonic/" documentation = "https://docs.rs/tonic/0.8.2/tonic/"
edition = "2018" edition = "2021"
homepage = "https://github.com/hyperium/tonic" homepage = "https://github.com/hyperium/tonic"
keywords = ["rpc", "grpc", "async", "futures", "protobuf"] keywords = ["rpc", "grpc", "async", "futures", "protobuf"]
license = "MIT" license = "MIT"
@@ -22,7 +22,7 @@ pub mod client {
#[doc = r" Attempt to create a new client by connecting to a given endpoint."] #[doc = r" Attempt to create a new client by connecting to a given endpoint."]
pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error> pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
where where
D: std::convert::TryInto<tonic::transport::Endpoint>, D: TryInto<tonic::transport::Endpoint>,
D::Error: Into<StdError>, D::Error: Into<StdError>,
{ {
let conn = tonic::transport::Endpoint::new(dst)?.connect().await?; let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
-6
View File
@@ -7,7 +7,6 @@ use super::key::MetadataKey;
use bytes::Bytes; use bytes::Bytes;
use http::header::HeaderValue; use http::header::HeaderValue;
use std::convert::TryFrom;
use std::error::Error; use std::error::Error;
use std::hash::{Hash, Hasher}; use std::hash::{Hash, Hasher};
use std::marker::PhantomData; use std::marker::PhantomData;
@@ -286,7 +285,6 @@ impl<VE: ValueEncoding> MetadataValue<VE> {
/// ///
/// ``` /// ```
/// # use tonic::metadata::*; /// # use tonic::metadata::*;
/// # use std::convert::TryFrom;
/// let val = AsciiMetadataValue::try_from(b"hello\xfa").unwrap(); /// let val = AsciiMetadataValue::try_from(b"hello\xfa").unwrap();
/// assert_eq!(val, &b"hello\xfa"[..]); /// assert_eq!(val, &b"hello\xfa"[..]);
/// ``` /// ```
@@ -295,7 +293,6 @@ impl<VE: ValueEncoding> MetadataValue<VE> {
/// ///
/// ``` /// ```
/// # use tonic::metadata::*; /// # use tonic::metadata::*;
/// # use std::convert::TryFrom;
/// let val = AsciiMetadataValue::try_from(b"\n"); /// let val = AsciiMetadataValue::try_from(b"\n");
/// assert!(val.is_err()); /// assert!(val.is_err());
/// ``` /// ```
@@ -324,7 +321,6 @@ impl<'a, VE: ValueEncoding> TryFrom<&'a [u8]> for MetadataValue<VE> {
/// ///
/// ``` /// ```
/// # use tonic::metadata::*; /// # use tonic::metadata::*;
/// # use std::convert::TryFrom;
/// let val = AsciiMetadataValue::try_from(b"hello\xfa").unwrap(); /// let val = AsciiMetadataValue::try_from(b"hello\xfa").unwrap();
/// assert_eq!(val, &b"hello\xfa"[..]); /// assert_eq!(val, &b"hello\xfa"[..]);
/// ``` /// ```
@@ -333,7 +329,6 @@ impl<'a, VE: ValueEncoding> TryFrom<&'a [u8]> for MetadataValue<VE> {
/// ///
/// ``` /// ```
/// # use tonic::metadata::*; /// # use tonic::metadata::*;
/// # use std::convert::TryFrom;
/// let val = AsciiMetadataValue::try_from(b"\n"); /// let val = AsciiMetadataValue::try_from(b"\n");
/// assert!(val.is_err()); /// assert!(val.is_err());
/// ``` /// ```
@@ -473,7 +468,6 @@ impl MetadataValue<Ascii> {
/// ///
/// ``` /// ```
/// # use tonic::metadata::*; /// # use tonic::metadata::*;
/// # use std::convert::TryFrom;
/// let val = AsciiMetadataValue::from_key::<Ascii>("accept".parse().unwrap()); /// let val = AsciiMetadataValue::from_key::<Ascii>("accept".parse().unwrap());
/// assert_eq!(val, AsciiMetadataValue::try_from(b"accept").unwrap()); /// assert_eq!(val, AsciiMetadataValue::try_from(b"accept").unwrap());
/// ``` /// ```
+1 -8
View File
@@ -7,14 +7,7 @@ use crate::transport::service::TlsConnector;
use crate::transport::{service::SharedExec, Error, Executor}; use crate::transport::{service::SharedExec, Error, Executor};
use bytes::Bytes; use bytes::Bytes;
use http::{uri::Uri, HeaderValue}; use http::{uri::Uri, HeaderValue};
use std::{ use std::{fmt, future::Future, pin::Pin, str::FromStr, time::Duration};
convert::{TryFrom, TryInto},
fmt,
future::Future,
pin::Pin,
str::FromStr,
time::Duration,
};
use tower::make::MakeConnection; use tower::make::MakeConnection;
// use crate::transport::E // use crate::transport::E
-2
View File
@@ -3,8 +3,6 @@ use super::io::BoxedIo;
#[cfg(feature = "tls")] #[cfg(feature = "tls")]
use super::tls::TlsConnector; use super::tls::TlsConnector;
use http::Uri; use http::Uri;
#[cfg(feature = "tls-roots-common")]
use std::convert::TryInto;
use std::fmt; use std::fmt;
use std::task::{Context, Poll}; use std::task::{Context, Poll};
use tower::make::MakeConnection; use tower::make::MakeConnection;
-2
View File
@@ -5,8 +5,6 @@ use crate::transport::{
}; };
#[cfg(feature = "tls-roots")] #[cfg(feature = "tls-roots")]
use rustls_native_certs; use rustls_native_certs;
#[cfg(feature = "tls")]
use std::convert::TryInto;
use std::{fmt, sync::Arc}; use std::{fmt, sync::Arc};
use tokio::io::{AsyncRead, AsyncWrite}; use tokio::io::{AsyncRead, AsyncWrite};
#[cfg(feature = "tls")] #[cfg(feature = "tls")]