Skip to content

Commit

Permalink
Adopt Rust edition 2021 (#1295)
Browse files Browse the repository at this point in the history
Update to Rust 1.56.0 and adopt the 2021 edition

(cherry picked from commit 23be602)
Signed-off-by: Oliver Gould <[email protected]>
  • Loading branch information
olix0r committed Mar 30, 2022
1 parent 27698fb commit af26feb
Show file tree
Hide file tree
Showing 95 changed files with 79 additions and 89 deletions.
2 changes: 1 addition & 1 deletion .github/actions/package/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG BASE_IMAGE=rust:1.55.0-buster
ARG BASE_IMAGE=rust:1.56.0-buster
FROM $BASE_IMAGE
WORKDIR /linkerd
RUN apt-get update && \
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/advisory.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
timeout-minutes: 40
runs-on: ubuntu-latest
container:
image: docker://rust:1.55.0-buster
image: docker://rust:1.56.0-buster
permissions:
contents: read
strategy:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 30
container:
image: docker://rust:1.55.0-buster
image: docker://rust:1.56.0-buster
options: --security-opt seccomp=unconfined
steps:
- uses: actions/checkout@1e204e9a9253d643386038d443f96446fa156a97
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
timeout-minutes: 5
runs-on: ubuntu-latest
container:
image: docker://rust:1.55.0-buster
image: docker://rust:1.56.0-buster
permissions:
contents: read
steps:
Expand All @@ -37,7 +37,7 @@ jobs:
timeout-minutes: 20
runs-on: ubuntu-latest
container:
image: docker://rust:1.55.0-buster
image: docker://rust:1.56.0-buster
permissions:
contents: read
steps:
Expand All @@ -49,7 +49,7 @@ jobs:
timeout-minutes: 5
runs-on: ubuntu-latest
container:
image: docker://rust:1.55.0-buster
image: docker://rust:1.56.0-buster
permissions:
contents: read
steps:
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
# :; docker buildx build . --load

# Please make changes via update-rust-version.sh
ARG RUST_IMAGE=rust:1.55.0-buster
ARG RUST_IMAGE=rust:1.56.0-buster

# Use an arbitrary ~recent edge release image to get the proxy
# identity-initializing and linkerd-await wrappers.
Expand All @@ -41,7 +41,7 @@ RUN --mount=type=cache,target=/var/lib/apt/lists \
WORKDIR /usr/src/linkerd2-proxy
COPY . .
RUN --mount=type=cache,target=target \
--mount=type=cache,from=rust:1.55.0-buster,source=/usr/local/cargo,target=/usr/local/cargo \
--mount=type=cache,from=rust:1.56.0-buster,source=/usr/local/cargo,target=/usr/local/cargo \
mkdir -p /out && \
if [ -n "$PROXY_UNOPTIMIZED" ]; then \
(cd linkerd2-proxy && /usr/bin/time -v cargo build --locked --features="$PROXY_FEATURES") && \
Expand Down
2 changes: 1 addition & 1 deletion hyper-balance/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "hyper-balance"
version = "0.1.0"
authors = ["Linkerd Developers <[email protected]>"]
license = "Apache-2.0"
edition = "2018"
edition = "2021"
publish = false

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion linkerd/addr/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "linkerd-addr"
version = "0.1.0"
authors = ["Linkerd Developers <[email protected]>"]
license = "Apache-2.0"
edition = "2018"
edition = "2021"
publish = false

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion linkerd/addr/fuzz/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "linkerd-addr-fuzz"
version = "0.0.0"
authors = ["Linkerd Developers <[email protected]>"]
publish = false
edition = "2018"
edition = "2021"

[package.metadata]
cargo-fuzz = true
Expand Down
2 changes: 1 addition & 1 deletion linkerd/app/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "linkerd-app"
version = "0.1.0"
authors = ["Linkerd Developers <[email protected]>"]
license = "Apache-2.0"
edition = "2018"
edition = "2021"
publish = false
description = """
Configures and executes the proxy
Expand Down
2 changes: 1 addition & 1 deletion linkerd/app/admin/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "linkerd-app-admin"
version = "0.1.0"
authors = ["Linkerd Developers <[email protected]>"]
license = "Apache-2.0"
edition = "2018"
edition = "2021"
publish = false
description = """
The linkerd proxy's admin server.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ mod tests {
.unwrap();
let f = admin.clone().oneshot(r);
timeout(TIMEOUT, f).await.expect("timeout").expect("call")
};};
}};
}

assert_eq!(call!().status(), StatusCode::SERVICE_UNAVAILABLE);
Expand Down
2 changes: 1 addition & 1 deletion linkerd/app/core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "linkerd-app-core"
version = "0.1.0"
authors = ["Linkerd Developers <[email protected]>"]
license = "Apache-2.0"
edition = "2018"
edition = "2021"
publish = false
description = """
Core infrastructure for the proxy application
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion linkerd/app/gateway/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "linkerd-app-gateway"
version = "0.1.0"
authors = ["Linkerd Developers <[email protected]>"]
license = "Apache-2.0"
edition = "2018"
edition = "2021"
publish = false

[dependencies]
Expand Down
5 changes: 1 addition & 4 deletions linkerd/app/gateway/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,7 @@ use linkerd_app_inbound::{
policy, Inbound,
};
use linkerd_app_outbound::{self as outbound, Outbound};
use std::{
convert::{TryFrom, TryInto},
fmt,
};
use std::fmt;
use thiserror::Error;
use tracing::debug_span;

Expand Down
2 changes: 1 addition & 1 deletion linkerd/app/inbound/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "linkerd-app-inbound"
version = "0.1.0"
authors = ["Linkerd Developers <[email protected]>"]
license = "Apache-2.0"
edition = "2018"
edition = "2021"
publish = false
description = """
Configures and runs the inbound proxy
Expand Down
2 changes: 1 addition & 1 deletion linkerd/app/inbound/fuzz/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ name = "linkerd-app-inbound-fuzz"
version = "0.0.0"
authors = ["Automatically generated"]
publish = false
edition = "2018"
edition = "2021"

[package.metadata]
cargo-fuzz = true
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion linkerd/app/inbound/src/http/router.rs
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ impl<A> svc::stack::RecognizeRoute<http::Request<A>> for LogicalPerRequest {
use linkerd_app_core::{
http_request_authority_addr, http_request_host_addr, CANONICAL_DST_HEADER,
};
use std::{convert::TryInto, str::FromStr};
use std::str::FromStr;

// Try to read a logical named address from the request. First check the canonical-dst
// header as set by the client proxy; otherwise fallback to the request's `:authority` or
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion linkerd/app/inbound/src/policy/discover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use linkerd_server_policy::{
Authentication, Authorization, Network, Protocol, ServerPolicy, Suffix,
};
use linkerd_tonic_watch::StreamWatch;
use std::{convert::TryInto, net::IpAddr};
use std::net::IpAddr;

#[derive(Clone, Debug)]
pub(super) struct Discover<S> {
Expand Down
2 changes: 1 addition & 1 deletion linkerd/app/integration/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "linkerd-app-integration"
version = "0.1.0"
authors = ["Linkerd Developers <[email protected]>"]
license = "Apache-2.0"
edition = "2018"
edition = "2021"
publish = false
description = """
Proxy integration tests
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion linkerd/app/outbound/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "linkerd-app-outbound"
version = "0.1.0"
authors = ["Linkerd Developers <[email protected]>"]
license = "Apache-2.0"
edition = "2018"
edition = "2021"
publish = false
description = """
Configures and runs the outbound proxy
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion linkerd/app/test/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "linkerd-app-test"
version = "0.1.0"
authors = ["Linkerd Developers <[email protected]>"]
license = "Apache-2.0"
edition = "2018"
edition = "2021"
publish = false
description = """
Proxy integration tests
Expand Down
2 changes: 1 addition & 1 deletion linkerd/cache/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "linkerd-cache"
version = "0.1.0"
authors = ["Linkerd Developers <[email protected]>"]
license = "Apache-2.0"
edition = "2018"
edition = "2021"
publish = false

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion linkerd/conditional/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ name = "linkerd-conditional"
version = "0.1.0"
authors = ["Linkerd Developers <[email protected]>"]
license = "Apache-2.0"
edition = "2018"
edition = "2021"

[dependencies]
2 changes: 1 addition & 1 deletion linkerd/detect/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "linkerd-detect"
version = "0.1.0"
authors = ["Linkerd Developers <[email protected]>"]
license = "Apache-2.0"
edition = "2018"
edition = "2021"
publish = false

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion linkerd/dns/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "linkerd-dns"
version = "0.1.0"
authors = ["Linkerd Developers <[email protected]>"]
license = "Apache-2.0"
edition = "2018"
edition = "2021"
publish = false

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion linkerd/dns/fuzz/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ name = "linkerd-dns-fuzz"
version = "0.0.0"
authors = ["Linkerd Developers <[email protected]>"]
publish = false
edition = "2018"
edition = "2021"

[package.metadata]
cargo-fuzz = true
Expand Down
2 changes: 1 addition & 1 deletion linkerd/dns/name/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "linkerd-dns-name"
version = "0.1.0"
authors = ["Linkerd Developers <[email protected]>"]
license = "Apache-2.0"
edition = "2018"
edition = "2021"
publish = false

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion linkerd/duplex/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "linkerd-duplex"
version = "0.1.0"
authors = ["Linkerd Developers <[email protected]>"]
license = "Apache-2.0"
edition = "2018"
edition = "2021"
publish = false

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion linkerd/errno/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ name = "linkerd-errno"
version = "0.1.0"
authors = ["Linkerd Developers <[email protected]>"]
license = "Apache-2.0"
edition = "2018"
edition = "2021"
publish = false
2 changes: 1 addition & 1 deletion linkerd/error-respond/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "linkerd-error-respond"
version = "0.1.0"
authors = ["Linkerd Developers <[email protected]>"]
license = "Apache-2.0"
edition = "2018"
edition = "2021"
publish = false


Expand Down
2 changes: 1 addition & 1 deletion linkerd/error/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "linkerd-error"
version = "0.1.0"
authors = ["Linkerd Developers <[email protected]>"]
license = "Apache-2.0"
edition = "2018"
edition = "2021"
publish = false

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion linkerd/exp-backoff/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "linkerd-exp-backoff"
version = "0.1.0"
authors = ["Linkerd Developers <[email protected]>"]
license = "Apache-2.0"
edition = "2018"
edition = "2021"
publish = false


Expand Down
2 changes: 1 addition & 1 deletion linkerd/http-box/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "linkerd-http-box"
version = "0.1.0"
authors = ["Linkerd Developers <[email protected]>"]
license = "Apache-2.0"
edition = "2018"
edition = "2021"
publish = false

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion linkerd/http-classify/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "linkerd-http-classify"
version = "0.1.0"
authors = ["Linkerd Developers <[email protected]>"]
license = "Apache-2.0"
edition = "2018"
edition = "2021"
publish = false

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion linkerd/http-metrics/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "linkerd-http-metrics"
version = "0.1.0"
authors = ["Linkerd Developers <[email protected]>"]
license = "Apache-2.0"
edition = "2018"
edition = "2021"
publish = false

[dependencies]
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion linkerd/http-retry/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "linkerd-http-retry"
version = "0.1.0"
authors = ["Linkerd Developers <[email protected]>"]
license = "Apache-2.0"
edition = "2018"
edition = "2021"
publish = false

[dependencies]
Expand Down
3 changes: 2 additions & 1 deletion linkerd/identity/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ name = "linkerd-identity"
version = "0.1.0"
authors = ["Linkerd Developers <[email protected]>"]
license = "Apache-2.0"
edition = "2018"
edition = "2021"
publish = false

[features]
default = []
Expand Down
2 changes: 1 addition & 1 deletion linkerd/io/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "linkerd-io"
version = "0.1.0"
authors = ["Linkerd Developers <[email protected]>"]
license = "Apache-2.0"
edition = "2018"
edition = "2021"
publish = false
description = """
General I/O primitives.
Expand Down
2 changes: 1 addition & 1 deletion linkerd/metrics/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "linkerd-metrics"
version = "0.1.0"
authors = ["Linkerd Developers <[email protected]>"]
license = "Apache-2.0"
edition = "2018"
edition = "2021"
publish = false

[features]
Expand Down
1 change: 0 additions & 1 deletion linkerd/metrics/src/latency.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ pub struct Us(Duration);

impl From<Us> for u64 {
fn from(Us(us): Us) -> u64 {
use std::convert::TryInto;
us.as_micros().try_into().unwrap_or_else(|_| {
// These measurements should never be long enough to overflow
tracing::warn!("Duration::as_micros would overflow u64");
Expand Down
2 changes: 1 addition & 1 deletion linkerd/opencensus/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "linkerd-opencensus"
version = "0.1.0"
authors = ["Linkerd Developers <[email protected]>"]
license = "Apache-2.0"
edition = "2018"
edition = "2021"
publish = false

[dependencies]
Expand Down
Loading

0 comments on commit af26feb

Please sign in to comment.