Skip to content

Commit b72cd36

Browse files
committed
style: 🎨 fix clippy
fix clippy warnings and bump to 2021 edition rust
1 parent 520b6b6 commit b72cd36

Some content is hidden

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

71 files changed

+402
-424
lines changed

‎.github/workflows/style.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ jobs:
3535
run: rustup component add rustfmt
3636
- name: "rustfmt --check"
3737
run: |
38-
if ! rustfmt --check --edition 2018 $(find . -name '*.rs' -print); then
39-
printf "Please run \`rustfmt --edition 2018 \$(find . -name '*.rs' -print)\` to fix rustfmt errors.\nSee CONTRIBUTING.md for more details.\n" >&2
38+
if ! rustfmt --check --edition 2021 $(find . -name '*.rs' -print); then
39+
printf "Please run \`rustfmt --edition 2021 \$(find . -name '*.rs' -print)\` to fix rustfmt errors.\nSee CONTRIBUTING.md for more details.\n" >&2
4040
exit 1
4141
fi
4242

‎Makefile‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ check:
55
cargo check --all-features
66

77
clippy:
8-
cargo clippy --all-targets
8+
cargo clippy --all-targets --all-features
99

1010
doc: clean
1111
cargo doc --lib --no-deps --all-features --document-private-items
@@ -14,7 +14,7 @@ clean:
1414
cargo clean
1515

1616
fmt:
17-
@rustfmt --edition 2018 $(SRC_FILES)
17+
@rustfmt --edition 2021 $(SRC_FILES)
1818

1919
unit: unit_single unit_parallel
2020

‎examples/datasources/consul.rs‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@
22
use consul::{kv::KVPair, kv::KV, Client, Config, QueryOptions};
33
use sentinel_core::{
44
base,
5-
datasource::{
6-
ds_consul::ConsulDataSource, new_flow_rule_handler, rule_json_array_parser, DataSource,
7-
},
5+
datasource::{ds_consul::ConsulDataSource, new_flow_rule_handler, rule_json_array_parser},
86
flow,
97
utils::sleep_for_ms,
108
EntryBuilder, Result,
@@ -34,7 +32,7 @@ fn main() -> Result<()> {
3432
};
3533

3634
client.put(&pair, None).unwrap();
37-
println!("list: {:?}", client.list(&key, None));
35+
println!("list: {:?}", client.list(key, None));
3836
}
3937

4038
// Sleep 3 seconds and then read the consul

‎examples/datasources/etcdv3.rs‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@
22
use etcd_rs::{Client, ClientConfig, PutRequest};
33
use sentinel_core::{
44
base,
5-
datasource::{
6-
ds_etcdv3::Etcdv3DataSource, new_flow_rule_handler, rule_json_array_parser, DataSource,
7-
},
5+
datasource::{ds_etcdv3::Etcdv3DataSource, new_flow_rule_handler, rule_json_array_parser},
86
flow, EntryBuilder, Result,
97
};
108
use std::sync::Arc;

‎examples/datasources/k8s.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ async fn dynamic_update(
131131
},
132132
);
133133

134-
let flow_rule: Api<flow::FlowResource> = Api::namespaced(client.clone(), namespace.into());
134+
let flow_rule: Api<flow::FlowResource> = Api::namespaced(client.clone(), namespace);
135135
flow_rule.create(&PostParams::default(), &cr).await?;
136136
println!(
137137
"Dynamically change custom resource: {} to: {:?}",

‎examples/exporter/prometheus/prometheus.rs‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![allow(clippy::needless_update)]
2+
13
use rand::prelude::*;
24
use sentinel_core::base::Snapshot;
35
use sentinel_core::circuitbreaker::{

‎middleware/actix/example/src/main.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use sentinel_actix::Sentinel;
99
use sentinel_core::flow;
1010
use std::sync::Arc;
1111

12-
const RESOURCE_NAME: &'static str = "actix_example";
12+
const RESOURCE_NAME: &str = "actix_example";
1313

1414
fn custom_extractor(_req: &ServiceRequest) -> String {
1515
RESOURCE_NAME.into()

‎middleware/axum/example/src/main.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use std::net::SocketAddr;
1313
use std::sync::Arc;
1414
use tower::ServiceBuilder;
1515

16-
const RESOURCE_NAME: &'static str = "axum_example";
16+
const RESOURCE_NAME: &str = "axum_example";
1717

1818
type Request = http::Request<Body>;
1919

‎middleware/motore/example/src/client.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use volo_grpc::{
1111
Request, Response,
1212
};
1313

14-
const RESOURCE_NAME: &'static str = "motore_example";
14+
const RESOURCE_NAME: &str = "motore_example";
1515

1616
fn custom_extractor(_cx: &ClientContext, _req: &Request<HelloServiceRequestSend>) -> String {
1717
RESOURCE_NAME.into()

‎middleware/motore/example/src/server.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use volo_grpc::{
1212
Request, Response,
1313
};
1414

15-
const RESOURCE_NAME: &'static str = "motore_example";
15+
const RESOURCE_NAME: &str = "motore_example";
1616

1717
fn custom_extractor(_cx: &ServerContext, _req: &Request<HelloServiceRequestRecv>) -> String {
1818
RESOURCE_NAME.into()

0 commit comments

Comments
 (0)