Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Enfoce no dbg! and todo! in Rust code via clippy lints in the CI job
Kirill Bulatov7b3e7ee3ccf9
diff --git a/.github/actions/check_formatting/action.yml b/.github/actions/check_formatting/action.ymldeleted file mode 100644index 7fef26407bd..00000000000--- a/.github/actions/check_formatting/action.yml+++ /dev/null@@ -1,15 +0,0 @@-name: 'Check formatting'-description: 'Checks code formatting use cargo fmt'--runs:- using: "composite"- steps:- - name: Install Rust- shell: bash -euxo pipefail {0}- run: |- rustup set profile minimal- rustup update stable-- - name: cargo fmt- shell: bash -euxo pipefail {0}- run: cargo fmt --all -- --checkdiff --git a/.github/actions/check_style/action.yml b/.github/actions/check_style/action.ymlnew file mode 100644index 00000000000..ff048198081--- /dev/null+++ b/.github/actions/check_style/action.yml@@ -0,0 +1,24 @@+name: "Check formatting"+description: "Checks code formatting use cargo fmt"++runs:+ using: "composite"+ steps:+ - name: Install Rust+ shell: bash -euxo pipefail {0}+ run: |+ rustup set profile minimal+ rustup update stable+ rustup component add clippy++ - name: cargo fmt+ shell: bash -euxo pipefail {0}+ run: cargo fmt --all -- --check++ - name: cargo clippy+ shell: bash -euxo pipefail {0}+ # clippy.toml is not currently supporting specifying allowed lints+ # so specify those here, and disable the rest until Zed's workspace+ # will have more fixes & suppression for the standard lint set+ run: |+ cargo clippy --workspace --all-targets --all-features -- -A clippy::all -D clippy::dbg_macro -D clippy::tododiff --git a/.github/workflows/ci.yml b/.github/workflows/ci.ymlindex 5ba25dbf947..3a92a744bb1 100644--- a/.github/workflows/ci.yml+++ b/.github/workflows/ci.yml@@ -22,8 +22,8 @@ env:RUST_BACKTRACE: 1jobs:- rustfmt:- name: Check formatting+ style:+ name: Check formatting and Clippy lintsruns-on:- self-hosted- test@@ -33,19 +33,20 @@ jobs:with:clean: falsesubmodules: "recursive"+ fetch-depth: 0- name: Set up default .cargo/config.tomlrun: cp ./.cargo/ci-config.toml ~/.cargo/config.toml- - name: Run rustfmt- uses: ./.github/actions/check_formatting+ - name: Run style checks+ uses: ./.github/actions/check_styletests:name: Run testsruns-on:- self-hosted- test- needs: rustfmt+ needs: stylesteps:- name: Checkout repouses: actions/checkout@v3diff --git a/.github/workflows/release_nightly.yml b/.github/workflows/release_nightly.ymlindex b7e6a0321e6..5d2dbe41f9a 100644--- a/.github/workflows/release_nightly.yml+++ b/.github/workflows/release_nightly.yml@@ -14,8 +14,8 @@ env:RUST_BACKTRACE: 1jobs:- rustfmt:- name: Check formatting+ style:+ name: Check formatting and Clippy lintsruns-on:- self-hosted- test@@ -25,16 +25,17 @@ jobs:with:clean: falsesubmodules: "recursive"+ fetch-depth: 0- - name: Run rustfmt- uses: ./.github/actions/check_formatting+ - name: Run style checks+ uses: ./.github/actions/check_styletests:name: Run testsruns-on:- self-hosted- test- needs: rustfmt+ needs: stylesteps:- name: Checkout repouses: actions/checkout@v3diff --git a/crates/collab/src/tests/channel_guest_tests.rs b/crates/collab/src/tests/channel_guest_tests.rsindex 9b68ce3922a..d5933235926 100644--- a/crates/collab/src/tests/channel_guest_tests.rs+++ b/crates/collab/src/tests/channel_guest_tests.rs@@ -104,12 +104,10 @@ async fn test_channel_guest_promotion(cx_a: &mut TestAppContext, cx_b: &mut Test});assert!(project_b.read_with(cx_b, |project, _| project.is_read_only()));assert!(editor_b.update(cx_b, |e, cx| e.read_only(cx)));- assert!(dbg!(- room_b- .update(cx_b, |room, cx| room.share_microphone(cx))- .await- )- .is_err());+ assert!(room_b+ .update(cx_b, |room, cx| room.share_microphone(cx))+ .await+ .is_err());// B is promotedactive_call_adiff --git a/crates/vim/src/editor_events.rs b/crates/vim/src/editor_events.rsindex e3ed076698d..e4057792796 100644--- a/crates/vim/src/editor_events.rs+++ b/crates/vim/src/editor_events.rs@@ -111,7 +111,6 @@ mod test {let mut cx1 = VisualTestContext::from_window(cx.window, &cx);let editor1 = cx.editor.clone();- dbg!(editor1.entity_id());let buffer = cx.new_model(|_| Buffer::new(0, 0, "a = 1\nb = 2\n"));let (editor2, cx2) = cx.add_window_view(|cx| Editor::for_buffer(buffer, None, cx));