Skip to content

Commit 9a0118f

Browse files
committed
fmt: make clippy happy
Signed-off-by: mon3stera <[email protected]>
1 parent 4a69550 commit 9a0118f

File tree

73 files changed

+856
-747
lines changed

Some content is hidden

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

73 files changed

+856
-747
lines changed

project/common/BUCK

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,15 @@ rust_library(
2424
visibility = ["PUBLIC"],
2525
deps = [
2626
"//project/libcni:libcni",
27+
"//project/libvault:libvault",
28+
"//third-party/rust/crates/anyhow/1.0.100:anyhow",
29+
"//third-party/rust/crates/async-trait/0.1.89:async-trait",
30+
"//third-party/rust/crates/bincode/1.3.3:bincode",
31+
"//third-party/rust/crates/bytes/1.10.1:bytes",
2732
"//third-party/rust/crates/chrono/0.4.42:chrono",
2833
"//third-party/rust/crates/ipnetwork/0.17.0:ipnetwork",
34+
"//third-party/rust/crates/log/0.4.28:log",
35+
"//third-party/rust/crates/quinn/0.11.9:quinn",
2936
"//third-party/rust/crates/serde/1.0.228:serde",
3037
"//third-party/rust/crates/serde_json/1.0.145:serde_json",
3138
],

project/common/src/lib.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,15 +143,13 @@ impl Toleration {
143143
}
144144
}
145145
}
146-
#[derive(Debug, Serialize, Deserialize, Clone)]
147-
#[derive(Default)]
146+
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
148147
pub enum TolerationOperator {
149148
Exists,
150149
#[default]
151150
Equal,
152151
}
153152

154-
155153
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq)]
156154
pub enum TaintEffect {
157155
NoSchedule,

project/distribution/BUCK

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ rust_binary(
3737
"//third-party/rust/crates/oci-spec/0.8.3:oci-spec",
3838
"//third-party/rust/crates/rand/0.9.2:rand",
3939
"//third-party/rust/crates/regex/1.12.1:regex",
40-
"//third-party/rust/crates/reqwest/0.12.23:reqwest",
40+
"//third-party/rust/crates/reqwest/0.12.24:reqwest",
4141
"//third-party/rust/crates/serde/1.0.228:serde",
4242
"//third-party/rust/crates/serde_json/1.0.145:serde_json",
4343
"//third-party/rust/crates/sha2/0.10.9:sha2",

project/libfuse-fs/BUCK

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ rust_library(
3434
"//third-party/rust/crates/moka/0.12.11:moka",
3535
"//third-party/rust/crates/nix/0.29.0:nix",
3636
"//third-party/rust/crates/radix_trie/0.2.1:radix_trie",
37-
"//third-party/rust/crates/reqwest/0.12.23:reqwest",
37+
"//third-party/rust/crates/reqwest/0.12.24:reqwest",
3838
"//third-party/rust/crates/rfuse3/0.0.4:rfuse3",
3939
"//third-party/rust/crates/serde/1.0.228:serde",
4040
"//third-party/rust/crates/serde_json/1.0.145:serde_json",

project/libfuse-fs/src/passthrough/async_io.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,9 @@ impl<S: BitmapSlice + Send + Sync> PassthroughFs<S> {
323323

324324
// kernel sends 0 as handle in case of no_open, and it depends on fuse server to handle
325325
// this case correctly.
326-
let st = if !self.no_open.load(Ordering::Relaxed) && let Some(handle_id) = handle {
326+
let st = if !self.no_open.load(Ordering::Relaxed)
327+
&& let Some(handle_id) = handle
328+
{
327329
let hd = self.handle_map.get(handle_id, inode).await?;
328330
// trace!("FS {} passthrough: do_getattr: before stat_fd", self.uuid);
329331
stat_fd(hd.get_file(), None)

project/libipam/BUCK

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -38,25 +38,13 @@ rust_binary(
3838
],
3939
)
4040

41-
cargo.rust_library(
41+
rust_library(
4242
name = "liblibipam",
4343
srcs = [":libipam-vendor"],
4444
crate = "libipam",
4545
crate_root = "vendor/src/lib.rs",
4646
edition = "2024",
47-
env = {
48-
"CARGO_CRATE_NAME": "libipam",
49-
"CARGO_MANIFEST_DIR": "vendor",
50-
"CARGO_PKG_AUTHORS": "rk8s-dev team",
51-
"CARGO_PKG_DESCRIPTION": "CNI Plugin IPAM",
52-
"CARGO_PKG_NAME": "libipam",
53-
"CARGO_PKG_REPOSITORY": "https://github.com/r2cn-dev/rk8s/tree/main/project/libipam",
54-
"CARGO_PKG_VERSION": "0.1.0",
55-
"CARGO_PKG_VERSION_MAJOR": "0",
56-
"CARGO_PKG_VERSION_MINOR": "1",
57-
"CARGO_PKG_VERSION_PATCH": "0",
58-
"CARGO_PKG_VERSION_PRE": "",
59-
},
47+
rustc_flags = ["@$(location :libipam-manifest[env_flags])"],
6048
visibility = ["PUBLIC"],
6149
deps = [
6250
"//third-party/rust/crates/anyhow/1.0.100:anyhow",

project/libscheduler/BUCK

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ rust_library(
2424
visibility = ["PUBLIC"],
2525
deps = [
2626
"//project/common:common",
27+
"//project/libvault:libvault",
2728
"//third-party/rust/crates/anyhow/1.0.100:anyhow",
2829
"//third-party/rust/crates/bitflags/2.9.4:bitflags",
2930
"//third-party/rust/crates/etcd-client/0.16.1:etcd-client",

project/libscheduler/src/models.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -152,22 +152,17 @@ impl NodeSelectorRequirement {
152152
}
153153
}
154154

155-
#[derive(Clone, Debug)]
155+
#[derive(Clone, Debug, Default)]
156156
pub enum NodeSelectorOperator {
157157
NodeSelectorOpIn,
158158
NodeSelectorOpNotIn,
159+
#[default]
159160
NodeSelectorOpExists,
160161
NodeSelectorOpDoesNotExist,
161162
NodeSelectorOpGt,
162163
NodeSelectorOpLt,
163164
}
164165

165-
impl Default for NodeSelectorOperator {
166-
fn default() -> Self {
167-
Self::NodeSelectorOpExists
168-
}
169-
}
170-
171166
#[derive(Clone, Default, Debug)]
172167
pub struct PreferredSchedulingTerm {
173168
pub match_label: NodeSelectorRequirement,

project/libscheduler/src/plugins/node_resources_fit.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,14 @@ pub struct Fit;
1212

1313
const SCORING_STRATEGY_CONFIG_KEY: &str = "ScoringStrategyConfig";
1414

15-
#[derive(Clone)]
15+
#[derive(Clone, Default)]
1616
pub enum ScoringStrategy {
17+
#[default]
1718
LeastAllocated,
1819
MostAllocated,
1920
RequestedToCapacityRatio,
2021
}
2122

22-
impl Default for ScoringStrategy {
23-
fn default() -> Self {
24-
Self::LeastAllocated
25-
}
26-
}
27-
2823
impl Plugin for Fit {
2924
fn name(&self) -> &str {
3025
"NodeResourcesFit"

project/libscheduler/src/with_xline/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ async fn handle_pod_update(
144144
}
145145
EventType::Delete => {
146146
let name = String::from_utf8_lossy(kv.key()).to_string();
147-
let node_name = name.split('/').filter(|s| !s.is_empty()).next_back();
147+
let node_name = name.split('/').rfind(|s| !s.is_empty());
148148
if let Some(n) = node_name {
149149
scheduler.remove_cache_pod(n).await;
150150
}
@@ -171,7 +171,7 @@ async fn handle_node_update(
171171
}
172172
EventType::Delete => {
173173
let name = String::from_utf8_lossy(kv.key()).to_string();
174-
let node_name = name.split('/').filter(|s| !s.is_empty()).next_back();
174+
let node_name = name.split('/').rfind(|s| !s.is_empty());
175175
if let Some(n) = node_name {
176176
scheduler.remove_cache_node(n).await;
177177
}

0 commit comments

Comments
 (0)