Skip to content

Commit

Permalink
chore: Update to 2021 edition (#1188)
Browse files Browse the repository at this point in the history
  • Loading branch information
tottoto authored Dec 13, 2022
1 parent 25ea473 commit bf22a74
Show file tree
Hide file tree
Showing 37 changed files with 29 additions and 52 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion examples/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
authors = ["Lucio Franco <luciofranco14@gmail.com>"]
edition = "2018"
edition = "2021"
license = "MIT"
name = "examples"
publish = false
Expand Down
2 changes: 1 addition & 1 deletion examples/src/blocking/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ struct BlockingClient {
impl BlockingClient {
pub fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
where
D: std::convert::TryInto<tonic::transport::Endpoint>,
D: TryInto<tonic::transport::Endpoint>,
D::Error: Into<StdError>,
{
let rt = Builder::new_multi_thread().enable_all().build().unwrap();
Expand Down
1 change: 0 additions & 1 deletion examples/src/mock/mock.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use std::convert::TryFrom;
use tonic::{
transport::{Endpoint, Server, Uri},
Request, Response, Status,
Expand Down
1 change: 0 additions & 1 deletion examples/src/uds/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down
2 changes: 1 addition & 1 deletion interop/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
authors = ["Lucio Franco <luciofranco14@gmail.com>"]
edition = "2018"
edition = "2021"
license = "MIT"
name = "interop"
publish = false
Expand Down
2 changes: 1 addition & 1 deletion rustfmt.toml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
edition = "2018"
edition = "2021"
2 changes: 1 addition & 1 deletion tests/ambiguous_methods/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
authors = ["Yonathan Randolph <yonathan@gmail.com>"]
edition = "2018"
edition = "2021"
license = "MIT"
name = "ambiguous_methods"
publish = false
Expand Down
2 changes: 1 addition & 1 deletion tests/compression/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
authors = ["Lucio Franco <luciofranco14@gmail.com>"]
edition = "2018"
edition = "2021"
license = "MIT"
name = "compression"
publish = false
Expand Down
1 change: 0 additions & 1 deletion tests/compression/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::{
Expand Down
2 changes: 1 addition & 1 deletion tests/disable_comments/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
authors = ["bouzuya <m@bouzuya.net>"]
edition = "2018"
edition = "2021"
license = "MIT"
name = "disable-comments"
publish = false
Expand Down
2 changes: 1 addition & 1 deletion tests/extern_path/my_application/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
authors = ["Danny Hua <danny@42layers.io>"]
edition = "2018"
edition = "2021"
license = "MIT"
name = "my_application"
publish = false
Expand Down
2 changes: 1 addition & 1 deletion tests/extern_path/uuid/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
authors = ["Danny Hua <danny@42layers.io>"]
edition = "2018"
edition = "2021"
license = "MIT"
name = "uuid1"
publish = false
Expand Down
2 changes: 1 addition & 1 deletion tests/included_service/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
authors = ["Lucio Franco <luciofranco14@gmail.com>"]
edition = "2018"
edition = "2021"
license = "MIT"
name = "included_service"
publish = false
Expand Down
2 changes: 1 addition & 1 deletion tests/integration_tests/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
authors = ["Lucio Franco <luciofranco14@gmail.com>"]
edition = "2018"
edition = "2021"
license = "MIT"
name = "integration-tests"
publish = false
Expand Down
2 changes: 0 additions & 2 deletions tests/integration_tests/tests/connect_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand Down
1 change: 0 additions & 1 deletion tests/integration_tests/tests/status.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion tests/root-crate-path/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
authors = ["Lucio Franco <luciofranco14@gmail.com>"]
edition = "2018"
edition = "2021"
license = "MIT"
name = "root-crate-path"
publish = false
Expand Down
2 changes: 1 addition & 1 deletion tests/same_name/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
authors = ["Lucio Franco <luciofranco14@gmail.com>"]
edition = "2018"
edition = "2021"
license = "MIT"
name = "same_name"
publish = false
Expand Down
2 changes: 1 addition & 1 deletion tests/service_named_service/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
authors = ["Lucio Franco <luciofranco14@gmail.com>"]
edition = "2018"
edition = "2021"
license = "MIT"
name = "service_named_service"
publish = false
Expand Down
2 changes: 1 addition & 1 deletion tests/stream_conflict/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
authors = ["Ben Sully <ben@bsull.io>"]
edition = "2018"
edition = "2021"
name = "stream_conflict"
publish = false
version = "0.1.0"
Expand Down
2 changes: 1 addition & 1 deletion tests/wellknown-compiled/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
authors = ["Lucio Franco <luciofranco14@gmail.com>"]
edition = "2018"
edition = "2021"
license = "MIT"
name = "wellknown-compiled"
publish = false
Expand Down
2 changes: 1 addition & 1 deletion tests/wellknown/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
authors = ["Lucio Franco <luciofranco14@gmail.com>"]
edition = "2018"
edition = "2021"
license = "MIT"
name = "wellknown"
publish = false
Expand Down
2 changes: 1 addition & 1 deletion tonic-build/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion tonic-build/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<D>(dst: D) -> Result<Self, tonic::transport::Error>
where
D: std::convert::TryInto<tonic::transport::Endpoint>,
D: TryInto<tonic::transport::Endpoint>,
D::Error: Into<StdError>,
{
let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
Expand Down
2 changes: 1 addition & 1 deletion tonic-health/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion tonic-reflection/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down
2 changes: 1 addition & 1 deletion tonic-types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion tonic-types/src/richer_error/std_messages/retry_info.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use std::{convert::TryFrom, time};
use std::time;

use prost::{DecodeError, Message};
use prost_types::Any;
Expand Down
2 changes: 1 addition & 1 deletion tonic-web/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion tonic-web/tests/integration/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
authors = ["Juan Alvarez <j@yabit.io>"]
edition = "2018"
edition = "2021"
name = "integration"
publish = false
version = "0.1.0"
Expand Down
2 changes: 1 addition & 1 deletion tonic/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<D>(dst: D) -> Result<Self, tonic::transport::Error>
where
D: std::convert::TryInto<tonic::transport::Endpoint>,
D: TryInto<tonic::transport::Endpoint>,
D::Error: Into<StdError>,
{
let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
Expand Down
6 changes: 0 additions & 6 deletions tonic/src/metadata/value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -286,7 +285,6 @@ impl<VE: ValueEncoding> MetadataValue<VE> {
///
/// ```
/// # use tonic::metadata::*;
/// # use std::convert::TryFrom;
/// let val = AsciiMetadataValue::try_from(b"hello\xfa").unwrap();
/// assert_eq!(val, &b"hello\xfa"[..]);
/// ```
Expand All @@ -295,7 +293,6 @@ impl<VE: ValueEncoding> MetadataValue<VE> {
///
/// ```
/// # use tonic::metadata::*;
/// # use std::convert::TryFrom;
/// let val = AsciiMetadataValue::try_from(b"\n");
/// assert!(val.is_err());
/// ```
Expand Down Expand Up @@ -324,7 +321,6 @@ impl<'a, VE: ValueEncoding> TryFrom<&'a [u8]> for MetadataValue<VE> {
///
/// ```
/// # use tonic::metadata::*;
/// # use std::convert::TryFrom;
/// let val = AsciiMetadataValue::try_from(b"hello\xfa").unwrap();
/// assert_eq!(val, &b"hello\xfa"[..]);
/// ```
Expand All @@ -333,7 +329,6 @@ impl<'a, VE: ValueEncoding> TryFrom<&'a [u8]> for MetadataValue<VE> {
///
/// ```
/// # use tonic::metadata::*;
/// # use std::convert::TryFrom;
/// let val = AsciiMetadataValue::try_from(b"\n");
/// assert!(val.is_err());
/// ```
Expand Down Expand Up @@ -473,7 +468,6 @@ impl MetadataValue<Ascii> {
///
/// ```
/// # use tonic::metadata::*;
/// # use std::convert::TryFrom;
/// let val = AsciiMetadataValue::from_key::<Ascii>("accept".parse().unwrap());
/// assert_eq!(val, AsciiMetadataValue::try_from(b"accept").unwrap());
/// ```
Expand Down
9 changes: 1 addition & 8 deletions tonic/src/transport/channel/endpoint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 0 additions & 2 deletions tonic/src/transport/service/connector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 0 additions & 2 deletions tonic/src/transport/service/tls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
Expand Down

0 comments on commit bf22a74

Please sign in to comment.