Skip to content

Commit dec8958

Browse files
authored
chore: update Rust toolchain to 1.52.1 (#1005)
This branch updates the Rust toolchain to 1.52.1. This includes a [major bugfix][1] for an issue effecting incremental compilation. Additionally, Rust 1.51 enabled the `resolver = "2"` feature in Cargo.toml, which can be used to fix the feature flagging issues with tracing in a more principled way than the current solution. A *very* large amount of new lints were added since Rust 1.49.0; in particular: * clippy now warns when an `Into` impl could be a `From` impl, because `From` impls provide `Into` impls for free, but the reverse is not the case * panic messages must now *always* be `format_args!` * exact comparisons of floating-point numbers (rather than within an error margin) now produce a warning This branch also fixes all the new warnings. [1]: https://blog.rust-lang.org/2021/05/10/Rust-1.52.1.html Signed-off-by: Eliza Weisman <eliza@buoyant.io>
1 parent 61f7e3a commit dec8958

File tree

72 files changed

+188
-118
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+188
-118
lines changed

.github/actions/package/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
ARG BASE_IMAGE=rust:1.49.0-buster
1+
ARG BASE_IMAGE=rust:1.52.1-buster
22
FROM $BASE_IMAGE
33
WORKDIR /linkerd
44
RUN apt-get update && \

.github/workflows/rust.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
timeout-minutes: 5
1212
runs-on: ubuntu-latest
1313
container:
14-
image: docker://rust:1.49.0-buster
14+
image: docker://rust:1.52.1-buster
1515
steps:
1616
- uses: actions/checkout@v2
1717
- run: rustup component add rustfmt
@@ -37,7 +37,7 @@ jobs:
3737
timeout-minutes: 5
3838
runs-on: ubuntu-latest
3939
container:
40-
image: docker://rust:1.49.0-buster
40+
image: docker://rust:1.52.1-buster
4141
steps:
4242
- uses: actions/checkout@v2
4343
- run: rustup component add clippy
@@ -47,7 +47,7 @@ jobs:
4747
timeout-minutes: 20
4848
runs-on: ubuntu-latest
4949
container:
50-
image: docker://rust:1.49.0-buster
50+
image: docker://rust:1.52.1-buster
5151
steps:
5252
- uses: actions/checkout@v2
5353
# Iterate through all subcrates to ensure each compiles indpendently.
@@ -57,7 +57,7 @@ jobs:
5757
timeout-minutes: 40
5858
runs-on: ubuntu-latest
5959
container:
60-
image: docker://rust:1.49.0-buster
60+
image: docker://rust:1.52.1-buster
6161
steps:
6262
- uses: actions/checkout@v2
6363
- run: rustup toolchain add nightly

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
# :; docker buildx build . --load
1818

1919
# Please make changes via update-rust-version.sh
20-
ARG RUST_IMAGE=rust:1.49.0-buster
20+
ARG RUST_IMAGE=rust:1.52.1-buster
2121

2222
# Use an arbitrary ~recent edge release image to get the proxy
2323
# identity-initializing and linkerd-await wrappers.
@@ -41,7 +41,7 @@ RUN --mount=type=cache,target=/var/lib/apt/lists \
4141
WORKDIR /usr/src/linkerd2-proxy
4242
COPY . .
4343
RUN --mount=type=cache,target=target \
44-
--mount=type=cache,from=rust:1.49.0-buster,source=/usr/local/cargo,target=/usr/local/cargo \
44+
--mount=type=cache,from=rust:1.52.1-buster,source=/usr/local/cargo,target=/usr/local/cargo \
4545
mkdir -p /out && \
4646
if [ -n "$PROXY_UNOPTIMIZED" ]; then \
4747
(cd linkerd2-proxy && /usr/bin/time -v cargo build --locked --features="$PROXY_FEATURES") && \

hyper-balance/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#![deny(warnings, rust_2018_idioms)]
2+
#![allow(clippy::inconsistent_struct_constructor)]
23

34
use hyper::body::HttpBody;
45
use pin_project::pin_project;

linkerd/addr/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#![deny(warnings, rust_2018_idioms)]
2+
#![allow(clippy::inconsistent_struct_constructor)]
23
use linkerd_dns_name::Name;
34
use std::{
45
fmt,

linkerd/app/core/src/addr_match.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,15 +68,15 @@ impl From<NameMatch> for AddrMatch {
6868
}
6969
}
7070

71-
impl Into<IpMatch> for AddrMatch {
72-
fn into(self) -> IpMatch {
73-
self.nets
71+
impl From<AddrMatch> for IpMatch {
72+
fn from(addrs: AddrMatch) -> Self {
73+
addrs.nets
7474
}
7575
}
7676

77-
impl Into<NameMatch> for AddrMatch {
78-
fn into(self) -> NameMatch {
79-
self.names
77+
impl From<AddrMatch> for NameMatch {
78+
fn from(addrs: AddrMatch) -> Self {
79+
addrs.names
8080
}
8181
}
8282

linkerd/app/core/src/classify.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -215,10 +215,12 @@ fn h2_error(err: &Error) -> String {
215215

216216
impl Class {
217217
pub(super) fn is_failure(&self) -> bool {
218-
matches!(self,
218+
matches!(
219+
self,
219220
Class::Default(SuccessOrFailure::Failure)
220-
| Class::Grpc(SuccessOrFailure::Failure, _)
221-
| Class::Stream(SuccessOrFailure::Failure, _))
221+
| Class::Grpc(SuccessOrFailure::Failure, _)
222+
| Class::Stream(SuccessOrFailure::Failure, _)
223+
)
222224
}
223225
}
224226

linkerd/app/core/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
//! - Metric labeling
99
1010
#![deny(warnings, rust_2018_idioms)]
11+
#![allow(clippy::inconsistent_struct_constructor)]
1112

1213
pub use linkerd_addr::{self as addr, Addr, NameAddr};
1314
pub use linkerd_cache as cache;

linkerd/app/gateway/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#![deny(warnings, rust_2018_idioms)]
2+
#![allow(clippy::inconsistent_struct_constructor)]
23

34
mod gateway;
45
#[cfg(test)]

linkerd/app/inbound/src/direct.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -247,8 +247,8 @@ impl svc::Param<tls::LocalId> for WithTransportHeaderAlpn {
247247

248248
// === impl RefusedNoHeader ===
249249

250-
impl Into<Error> for RefusedNoHeader {
251-
fn into(self) -> Error {
250+
impl From<RefusedNoHeader> for Error {
251+
fn from(_: RefusedNoHeader) -> Error {
252252
Error::from(io::Error::new(
253253
io::ErrorKind::ConnectionRefused,
254254
"Non-transport-header connection refused",

0 commit comments

Comments
 (0)