Skip to content

Commit

Permalink
2021 edition (#664)
Browse files Browse the repository at this point in the history
Signed-off-by: clux <[email protected]>
  • Loading branch information
clux authored Oct 22, 2021
1 parent 6a590b6 commit d6328d6
Show file tree
Hide file tree
Showing 14 changed files with 13 additions and 25 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ clippy:

fmt:
#rustup component add rustfmt --toolchain nightly
rustfmt +nightly --edition 2018 $$(find . -type f -iname *.rs)
rustfmt +nightly --edition 2021 $$(find . -type f -iname *.rs)

doc:
RUSTDOCFLAGS="--cfg docsrs" cargo +nightly doc --lib --workspace --features=derive,ws,oauth,jsonpatch,client,derive,runtime,admission --open
Expand All @@ -22,7 +22,7 @@ test:
cd kube && cargo test --lib --features=derive

readme:
rustdoc README.md --test --edition=2018
rustdoc README.md --test --edition=2021

kind-create:
kind create cluster
Expand Down
2 changes: 1 addition & 1 deletion examples/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ authors = [
"kazk <[email protected]>",
]
publish = false
edition = "2018"
edition = "2021"
license = "Apache-2.0"

[package.metadata.release]
Expand Down
5 changes: 1 addition & 4 deletions examples/admission_controller.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@ use kube::core::{
admission::{AdmissionRequest, AdmissionResponse, AdmissionReview},
DynamicObject, ResourceExt,
};
use std::{
convert::{Infallible, TryInto},
error::Error,
};
use std::{convert::Infallible, error::Error};
#[macro_use] extern crate log;
use warp::{reply, Filter, Reply};

Expand Down
2 changes: 1 addition & 1 deletion kube-client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ repository = "https://github.com/kube-rs/kube-rs"
readme = "../README.md"
keywords = ["kubernetes", "client",]
categories = ["web-programming::http-client"]
edition = "2018"
edition = "2021"

[features]
default = ["client", "native-tls"]
Expand Down
2 changes: 1 addition & 1 deletion kube-client/src/client/auth/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use std::{convert::TryFrom, process::Command, sync::Arc};
use std::{process::Command, sync::Arc};

use chrono::{DateTime, Duration, Utc};
use http::HeaderValue;
Expand Down
2 changes: 0 additions & 2 deletions kube-client/src/client/config_ext.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
use std::convert::TryFrom;

use tower::util::Either;

#[cfg(any(feature = "native-tls", feature = "rustls-tls"))] use super::tls;
Expand Down
2 changes: 1 addition & 1 deletion kube-client/src/client/middleware/refresh_token.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ where
mod tests {
use super::*;

use std::{convert::TryFrom, matches, sync::Arc};
use std::{matches, sync::Arc};

use chrono::{Duration, Utc};
use futures::pin_mut;
Expand Down
3 changes: 0 additions & 3 deletions kube-client/src/client/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@
//!
//! The [`Client`] can also be used with [`Discovery`](crate::Discovery) to dynamically
//! retrieve the resources served by the kubernetes API.
use std::convert::TryFrom;

use bytes::Bytes;
use either::{Either, Left, Right};
use futures::{self, Stream, StreamExt, TryStream, TryStreamExt};
Expand Down
2 changes: 1 addition & 1 deletion kube-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ authors = [
"clux <[email protected]>",
"kazk <[email protected]>",
]
edition = "2018"
edition = "2021"
license = "Apache-2.0"
repository = "https://github.com/kube-rs/kube-rs"
readme = "../README.md"
Expand Down
6 changes: 1 addition & 5 deletions kube-core/src/admission.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use crate::{
Error, Result,
};

use std::{collections::HashMap, convert::TryInto};
use std::collections::HashMap;

use k8s_openapi::{
api::authentication::v1::UserInfo,
Expand Down Expand Up @@ -64,7 +64,6 @@ impl<T: Resource> TryInto<AdmissionRequest<T>> for AdmissionReview<T> {
/// An incoming [`AdmissionReview`] request.
/// ```ignore
/// use kube::api::{admission::{AdmissionRequest, AdmissionReview}, DynamicObject};
/// use std::convert::TryInto;
///
/// // The incoming AdmissionReview received by the controller.
/// let body: AdmissionReview<DynamicObject>;
Expand Down Expand Up @@ -187,7 +186,6 @@ pub enum Operation {
/// admission::{AdmissionRequest, AdmissionResponse, AdmissionReview},
/// DynamicObject,
/// };
/// use std::convert::TryInto;
///
/// // The incoming AdmissionReview received by the controller.
/// let body: AdmissionReview<DynamicObject>;
Expand Down Expand Up @@ -335,8 +333,6 @@ pub enum PatchType {
mod test {
const WEBHOOK_BODY: &str = r#"{"kind":"AdmissionReview","apiVersion":"admission.k8s.io/v1","request":{"uid":"0c9a8d74-9cb7-44dd-b98e-09fd62def2f4","kind":{"group":"","version":"v1","kind":"Pod"},"resource":{"group":"","version":"v1","resource":"pods"},"requestKind":{"group":"","version":"v1","kind":"Pod"},"requestResource":{"group":"","version":"v1","resource":"pods"},"name":"echo-pod","namespace":"colin-coder","operation":"CREATE","userInfo":{"username":"[email protected]","groups":["system:authenticated"],"extra":{"iam.gke.io/user-assertion":["REDACTED"],"user-assertion.cloud.google.com":["REDACTED"]}},"object":{"kind":"Pod","apiVersion":"v1","metadata":{"name":"echo-pod","namespace":"colin-coder","creationTimestamp":null,"labels":{"app":"echo-server"},"annotations":{"kubectl.kubernetes.io/last-applied-configuration":"{\"apiVersion\":\"v1\",\"kind\":\"Pod\",\"metadata\":{\"annotations\":{},\"labels\":{\"app\":\"echo-server\"},\"name\":\"echo-pod\",\"namespace\":\"colin-coder\"},\"spec\":{\"containers\":[{\"image\":\"jmalloc/echo-server\",\"name\":\"echo-server\",\"ports\":[{\"containerPort\":8080,\"name\":\"http-port\"}]}]}}\n"},"managedFields":[{"manager":"kubectl","operation":"Update","apiVersion":"v1","time":"2021-03-29T23:02:16Z","fieldsType":"FieldsV1","fieldsV1":{"f:metadata":{"f:annotations":{".":{},"f:kubectl.kubernetes.io/last-applied-configuration":{}},"f:labels":{".":{},"f:app":{}}},"f:spec":{"f:containers":{"k:{\"name\":\"echo-server\"}":{".":{},"f:image":{},"f:imagePullPolicy":{},"f:name":{},"f:ports":{".":{},"k:{\"containerPort\":8080,\"protocol\":\"TCP\"}":{".":{},"f:containerPort":{},"f:name":{},"f:protocol":{}}},"f:resources":{},"f:terminationMessagePath":{},"f:terminationMessagePolicy":{}}},"f:dnsPolicy":{},"f:enableServiceLinks":{},"f:restartPolicy":{},"f:schedulerName":{},"f:securityContext":{},"f:terminationGracePeriodSeconds":{}}}}]},"spec":{"volumes":[{"name":"default-token-rxbqq","secret":{"secretName":"default-token-rxbqq"}}],"containers":[{"name":"echo-server","image":"jmalloc/echo-server","ports":[{"name":"http-port","containerPort":8080,"protocol":"TCP"}],"resources":{},"volumeMounts":[{"name":"default-token-rxbqq","readOnly":true,"mountPath":"/var/run/secrets/kubernetes.io/serviceaccount"}],"terminationMessagePath":"/dev/termination-log","terminationMessagePolicy":"File","imagePullPolicy":"Always"}],"restartPolicy":"Always","terminationGracePeriodSeconds":30,"dnsPolicy":"ClusterFirst","serviceAccountName":"default","serviceAccount":"default","securityContext":{},"schedulerName":"default-scheduler","tolerations":[{"key":"node.kubernetes.io/not-ready","operator":"Exists","effect":"NoExecute","tolerationSeconds":300},{"key":"node.kubernetes.io/unreachable","operator":"Exists","effect":"NoExecute","tolerationSeconds":300}],"priority":0,"enableServiceLinks":true},"status":{}},"oldObject":null,"dryRun":false,"options":{"kind":"CreateOptions","apiVersion":"meta.k8s.io/v1"}}}"#;

use std::convert::TryInto;

use crate::{
admission::{AdmissionResponse, AdmissionReview},
DynamicObject, Result,
Expand Down
2 changes: 1 addition & 1 deletion kube-derive/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ authors = [
"clux <[email protected]>",
"kazk <[email protected]>",
]
edition = "2018"
edition = "2021"
license = "Apache-2.0"
repository = "https://github.com/kube-rs/kube-rs"
readme = "../README.md"
Expand Down
2 changes: 1 addition & 1 deletion kube-runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ license = "Apache-2.0"
repository = "https://github.com/kube-rs/kube-rs"
keywords = ["kubernetes", "runtime", "reflector", "watcher", "controller"]
categories = ["web-programming::http-client"]
edition = "2018"
edition = "2021"

[dependencies]
futures = "0.3.17"
Expand Down
2 changes: 1 addition & 1 deletion kube/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ repository = "https://github.com/kube-rs/kube-rs"
readme = "../README.md"
keywords = ["kubernetes", "client", "runtime"]
categories = ["web-programming::http-client"]
edition = "2018"
edition = "2021"

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

[package.metadata.release]
Expand Down

0 comments on commit d6328d6

Please sign in to comment.