Skip to content

Commit

Permalink
chore: fix all clippy suggestions on the new version (#245)
Browse files Browse the repository at this point in the history
* chore: fix all clippy suggestions on the new version

* feat: improve CI times and caching by avoiding incremental builds and debug info
  • Loading branch information
Angelmmiguel authored Oct 19, 2023
1 parent c3a4aa9 commit 5e2e78a
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 10 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ on:
branches: [ "main", "v[0-9]+.[0-9]+" ]

env:
# Disabling debug info and incremental builds to speed up builds a bunch.
# See https://matklad.github.io/2021/09/04/fast-rust-builds.html#CI-Workflow
CARGO_INCREMENTAL: 0
CARGO_PROFILE_DEV_DEBUG: 0
CARGO_TERM_COLOR: always

jobs:
Expand Down Expand Up @@ -70,5 +74,7 @@ jobs:
run: make all
- name: Build wws on release mode
run: cargo build --verbose --release
- name: Compile test
run: cargo test --no-run --locked
- name: Test
run: cargo test --workspace -- --show-output
2 changes: 1 addition & 1 deletion crates/api-manage/src/models/worker_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ impl From<&Worker> for WorkerConfig {
.map(WorkerFolder::from)
.collect::<Vec<WorkerFolder>>()
})
.unwrap_or(Vec::new());
.unwrap_or_default();

Self {
id: value.id.clone(),
Expand Down
4 changes: 2 additions & 2 deletions crates/project/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ pub async fn prepare_project(
force_type: Option<ProjectType>,
options: Options,
) -> Result<PathBuf> {
let project_type = if force_type.is_some() {
force_type.unwrap()
let project_type = if let Some(new_type) = force_type {
new_type
} else {
identify_type(location)?
};
Expand Down
2 changes: 1 addition & 1 deletion crates/runtimes/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//// Copyright 2022 VMware, Inc.
// Copyright 2022-2023 VMware, Inc.
// SPDX-License-Identifier: Apache-2.0

pub mod errors;
Expand Down
14 changes: 8 additions & 6 deletions crates/server/src/handlers/worker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,12 +122,14 @@ pub async fn handle_worker(req: HttpRequest, body: Bytes) -> HttpResponse {
}

// Write to the state if required
if handler_success && kv_namespace.is_some() {
data_connectors
.write()
.expect("error locking data connectors lock for writing")
.kv
.replace_store(&kv_namespace.unwrap(), &handler_result.kv)
if handler_success {
if let Some(kv_namespace) = kv_namespace {
data_connectors
.write()
.expect("error locking data connectors lock for writing")
.kv
.replace_store(&kv_namespace, &handler_result.kv)
}
}

match handler_result.body() {
Expand Down

0 comments on commit 5e2e78a

Please sign in to comment.