CI: Enable clippy on Windows (#8240)

į™―åąąéĒĻéœē created

Release Notes:

- N/A

Change summary

.github/workflows/ci.yml                  |  8 ++--
Cargo.lock                                | 34 ------------------------
crates/cli/src/main.rs                    | 33 ++++++++++++++++++++++++
crates/collab/src/main.rs                 |  6 ++++
crates/gpui/src/platform.rs               |  5 ++
crates/gpui/src/platform/test/platform.rs |  3 +
crates/gpui/src/scene.rs                  |  3 ++
crates/project/src/project_tests.rs       |  1 
crates/storybook/Cargo.toml               |  2 -
crates/storybook/src/storybook.rs         |  2 -
10 files changed, 53 insertions(+), 44 deletions(-)

Detailed changes

.github/workflows/ci.yml 🔗

@@ -150,10 +150,10 @@ jobs:
             ~/.cargo/git/db/
             target/
           key: ${{ runner.os }}-cargo-${{ hashFiles('**/rust-toolchain.toml') }}-${{ hashFiles('**/Cargo.lock') }}
-      # todo!(windows): Actually run clippy
-      #- name: cargo clippy
-      #  shell: bash -euxo pipefail {0}
-      #  run: script/clippy
+
+      - name: cargo clippy
+        shell: bash -euxo pipefail {0}
+        run: script/clippy
 
       - name: Build Zed
         run: cargo build -p zed

Cargo.lock 🔗

@@ -1247,17 +1247,6 @@ dependencies = [
  "rustc-demangle",
 ]
 
-[[package]]
-name = "backtrace-on-stack-overflow"
-version = "0.3.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7fd2d70527f3737a1ad17355e260706c1badebabd1fa06a7a053407380df841b"
-dependencies = [
- "backtrace",
- "libc",
- "nix 0.23.2",
-]
-
 [[package]]
 name = "base16ct"
 version = "0.1.1"
@@ -5552,15 +5541,6 @@ dependencies = [
  "libc",
 ]
 
-[[package]]
-name = "memoffset"
-version = "0.6.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce"
-dependencies = [
- "autocfg",
-]
-
 [[package]]
 name = "memoffset"
 version = "0.7.1"
@@ -5899,19 +5879,6 @@ version = "1.0.4"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "e4a24736216ec316047a1fc4252e27dabb04218aa4a3f37c6e7ddbf1f9782b54"
 
-[[package]]
-name = "nix"
-version = "0.23.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8f3790c00a0150112de0f4cd161e3d7fc4b2d8a5542ffc35f099a2562aecb35c"
-dependencies = [
- "bitflags 1.3.2",
- "cc",
- "cfg-if 1.0.0",
- "libc",
- "memoffset 0.6.5",
-]
-
 [[package]]
 name = "nix"
 version = "0.24.3"
@@ -9249,7 +9216,6 @@ name = "storybook"
 version = "0.1.0"
 dependencies = [
  "anyhow",
- "backtrace-on-stack-overflow",
  "chrono",
  "clap 4.4.4",
  "collab_ui",

crates/cli/src/main.rs 🔗

@@ -156,6 +156,39 @@ mod linux {
     }
 }
 
+// todo!("windows")
+#[cfg(target_os = "windows")]
+mod windows {
+    use std::path::Path;
+
+    use cli::{CliRequest, CliResponse};
+    use ipc_channel::ipc::{IpcReceiver, IpcSender};
+
+    use crate::{Bundle, InfoPlist};
+
+    impl Bundle {
+        pub fn detect(_args_bundle_path: Option<&Path>) -> anyhow::Result<Self> {
+            unimplemented!()
+        }
+
+        pub fn plist(&self) -> &InfoPlist {
+            unimplemented!()
+        }
+
+        pub fn path(&self) -> &Path {
+            unimplemented!()
+        }
+
+        pub fn launch(&self) -> anyhow::Result<(IpcSender<CliRequest>, IpcReceiver<CliResponse>)> {
+            unimplemented!()
+        }
+
+        pub fn zed_version_string(&self) -> String {
+            unimplemented!()
+        }
+    }
+}
+
 #[cfg(target_os = "macos")]
 mod mac_os {
     use anyhow::Context;

crates/collab/src/main.rs 🔗

@@ -12,6 +12,7 @@ use std::{
     path::Path,
     sync::Arc,
 };
+#[cfg(unix)]
 use tokio::signal::unix::SignalKind;
 use tower_http::trace::{self, TraceLayer};
 use tracing::Level;
@@ -109,6 +110,7 @@ async fn main() -> Result<()> {
                         .on_response(trace::DefaultOnResponse::new().level(Level::INFO)),
                 );
 
+            #[cfg(unix)]
             axum::Server::from_tcp(listener)?
                 .serve(app.into_make_service_with_connect_info::<SocketAddr>())
                 .with_graceful_shutdown(async move {
@@ -127,6 +129,10 @@ async fn main() -> Result<()> {
                     }
                 })
                 .await?;
+
+            // todo!("windows")
+            #[cfg(windows)]
+            unimplemented!();
         }
         _ => {
             Err(anyhow!(

crates/gpui/src/platform.rs 🔗

@@ -1,5 +1,7 @@
 // todo!(linux): remove
 #![cfg_attr(target_os = "linux", allow(dead_code))]
+// todo!("windows"): remove
+#![cfg_attr(windows, allow(dead_code))]
 
 mod app_menu;
 mod keystroke;
@@ -61,9 +63,10 @@ pub(crate) fn current_platform() -> Rc<dyn Platform> {
 pub(crate) fn current_platform() -> Rc<dyn Platform> {
     Rc::new(LinuxPlatform::new())
 }
+// todo!("windows")
 #[cfg(target_os = "windows")]
 pub(crate) fn current_platform() -> Rc<dyn Platform> {
-    todo!("windows")
+    unimplemented!()
 }
 
 pub(crate) trait Platform: 'static {

crates/gpui/src/platform/test/platform.rs 🔗

@@ -126,8 +126,9 @@ impl Platform for TestPlatform {
         #[cfg(target_os = "macos")]
         return Arc::new(crate::platform::mac::MacTextSystem::new());
 
+        // todo!("windows")
         #[cfg(target_os = "windows")]
-        todo!("windows")
+        unimplemented!()
     }
 
     fn run(&self, _on_finish_launching: Box<dyn FnOnce()>) {

crates/gpui/src/scene.rs 🔗

@@ -1,3 +1,6 @@
+// todo!("windows"): remove
+#![cfg_attr(windows, allow(dead_code))]
+
 use crate::{
     point, AtlasTextureId, AtlasTile, Bounds, ContentMask, Corners, Edges, EntityId, Hsla, Pixels,
     Point, ScaledPixels, StackingOrder,

crates/project/src/project_tests.rs 🔗

@@ -45,6 +45,7 @@ async fn test_block_via_smol(cx: &mut gpui::TestAppContext) {
     task.await;
 }
 
+#[cfg(not(windows))]
 #[gpui::test]
 async fn test_symlinks(cx: &mut gpui::TestAppContext) {
     init_test(cx);

crates/storybook/Cargo.toml 🔗

@@ -11,8 +11,6 @@ path = "src/storybook.rs"
 
 [dependencies]
 anyhow.workspace = true
-# TODO: Remove after diagnosing stack overflow.
-backtrace-on-stack-overflow = "0.3.0"
 chrono = "0.4"
 clap = { version = "4.4", features = ["derive", "string"] }
 collab_ui = { workspace = true, features = ["stories"] }

crates/storybook/src/storybook.rs 🔗

@@ -37,8 +37,6 @@ struct Args {
 }
 
 fn main() {
-    // unsafe { backtrace_on_stack_overflow::enable() };
-
     SimpleLogger::init(LevelFilter::Info, Default::default()).expect("could not initialize logger");
 
     menu::init();