Skip to content

Commit

Permalink
fix: clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
hunjixin committed Aug 9, 2024
1 parent 7fb4352 commit 00444eb
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 31 deletions.
10 changes: 9 additions & 1 deletion .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,16 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: clippy rustfmt

- name: Run Clippy
run: cargo +nightly clippy --fix --workspace --exclude jiaozifs_client_rs --allow-dirty
run: |
rustup show
nightly-x86_64-unknown-linux-gnu
cargo +nightly clippy --fix --workspace --exclude jiaozifs_client_rs --allow-dirty
- name: Install Protoc
uses: arduino/setup-protoc@v3
Expand Down
10 changes: 1 addition & 9 deletions src/bin/jz-flow/job.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,4 @@
use std::{
io::{
self,
stdout,
},
iter,
os::linux::raw::stat,
str::FromStr,
};
use std::str::FromStr;

use crate::global::GlobalOptions;
use anyhow::Result;
Expand Down
3 changes: 1 addition & 2 deletions src/dbrepo/job_db_mongo.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use std::os::linux::raw::stat;

use crate::{
core::db::{
Expand Down Expand Up @@ -259,7 +258,7 @@ impl DataRepo for MongoRunDbRepo {
direction: Option<&Direction>,
) -> Result<usize> {
let mut query = doc! {"node_name":node_name};
if states.len() > 0 {
if !states.is_empty() {
let states: Vec<&str> = states.iter().map(to_variant_name).try_collect()?;
query.insert("state", doc! {"$in": states});
}
Expand Down
18 changes: 6 additions & 12 deletions src/driver/kube.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,22 +39,16 @@ use handlebars::{
RenderContext,
RenderError,
};
use k8s_metrics::{
v1beta1 as metricsv1,
QuantityExt,
};
use k8s_openapi::{
api::{
use k8s_metrics::v1beta1 as metricsv1;
use k8s_openapi::api::{
apps::v1::StatefulSet,
core::v1::{
Namespace,
PersistentVolumeClaim,
Pod,
Service,
},
},
apimachinery::pkg::api::resource::Quantity,
};
};
use kube::{
api::{
DeleteParams,
Expand Down Expand Up @@ -145,7 +139,7 @@ where
let mut node_status = NodeStatus {
name: self.node_name.clone(),
state: db_node.state,
data_count: data_count,
data_count,
replicas: statefulset
.spec
.as_ref()
Expand Down Expand Up @@ -280,7 +274,7 @@ where
let mut node_status = NodeStatus {
name: self.node_name.clone(),
state: db_node.state,
data_count: data_count,
data_count,
replicas: statefulset
.spec
.as_ref()
Expand Down Expand Up @@ -373,7 +367,7 @@ where
fn new(repo: R, client: Client,topo_sort_nodes: Vec<String>) -> Self {
Self {
_db_repo: repo,
topo_sort_nodes:topo_sort_nodes,
topo_sort_nodes,
_client: client,
handlers: Default::default(),
}
Expand Down
10 changes: 3 additions & 7 deletions src/job/job_mgr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,13 @@ use crate::{
};
use anyhow::Result;
use futures::future::try_join_all;
use k8s_openapi::api::node;
use kube::Client;
use mongodb::bson::oid::ObjectId;
use serde::{
Deserialize,
Serialize,
};
use std::{
collections::HashMap,
marker::PhantomData,
};
use std::marker::PhantomData;
use tokio::task::JoinSet;
use tokio_util::sync::CancellationToken;
use tracing::{
Expand Down Expand Up @@ -177,7 +173,7 @@ where
let namespace = format!("{}-{}", job.name, job.retry_number - 1);
self.db
.update(
&id,
id,
&JobUpdateInfo {
state: Some(JobState::Finish),
},
Expand All @@ -186,7 +182,7 @@ where
self.driver.clean(&namespace).await?;
self.db
.update(
&id,
id,
&JobUpdateInfo {
state: Some(JobState::Clean),
},
Expand Down

0 comments on commit 00444eb

Please sign in to comment.