diff --git a/.cargo/config.toml b/.cargo/config.toml index a9bf1f9cc9..8750875d86 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -3,17 +3,24 @@ rustflags = ["-C", "symbol-mangling-version=v0", "--cfg", "tokio_unstable"] [alias] -xtask = "run --package xtask --" -perf-test = ["test", "--profile", "release-fast", "--lib", "--bins", "--tests", "--all-features", "--config", "target.'cfg(true)'.runner='cargo run -p perf --release'", "--config", "target.'cfg(true)'.rustflags=[\"--cfg\", \"perf_enabled\"]"] -# Keep similar flags here to share some ccache -perf-compare = ["run", "--profile", "release-fast", "-p", "perf", "--config", "target.'cfg(true)'.rustflags=[\"--cfg\", \"perf_enabled\"]", "--", "compare"] +lint = "clippy --workspace --all-targets -- -D warnings" +check-all = "check --workspace --all-targets" +test-all = "test --workspace --no-fail-fast" +test-doc = "test --workspace --doc" +build-all = "build --workspace --all-targets" +ci-fmt = "fmt --all -- --check" + +[profile.ci] +inherits = "dev" +debug = "limited" +incremental = false [target.'cfg(target_os = "windows")'] rustflags = [ "--cfg", "windows_slim_errors", # This cfg will reduce the size of `windows::core::Error` from 16 bytes to 4 bytes "-C", - "target-feature=+crt-static", # This fixes the linking issue when compiling livekit on Windows + "target-feature=+crt-static", # This fixes the linking issue when compiling livekit on Windows ] # We need lld to link libwebrtc.a successfully on aarch64-linux diff --git a/crates/gpui/examples/learn/layout.rs b/crates/gpui/examples/learn/layout.rs index 7879b83fd3..abadb9b67d 100644 --- a/crates/gpui/examples/learn/layout.rs +++ b/crates/gpui/examples/learn/layout.rs @@ -12,8 +12,8 @@ mod example_prelude; use example_prelude::init_example; use gpui::colors::Colors; use gpui::{ - App, Bounds, Context, Div, Hsla, Render, Rgba, Window, WindowBounds, WindowOptions, div, - prelude::*, px, size, + Bounds, Context, Div, Hsla, Render, Rgba, Window, WindowBounds, WindowOptions, div, prelude::*, + px, size, }; // Helper: Colored block for visualization diff --git a/crates/gpui/src/transition.rs b/crates/gpui/src/transition.rs index b9e5073af5..0bcfb94a96 100644 --- a/crates/gpui/src/transition.rs +++ b/crates/gpui/src/transition.rs @@ -43,7 +43,7 @@ use crate::{App, Entity, EntityId, Window, lerp::Lerp, linear}; /// ``` #[derive(Clone)] pub struct Transition { - /// The amount of time for which this transtion should run. + /// The amount of time for which this transition should run. duration_secs: f32, /// A function that takes a delta between 0 and 1 and returns a new delta diff --git a/crates/gpui_shared_string/Cargo.toml b/crates/gpui_shared_string/Cargo.toml index e1e975a550..04db5b23dc 100644 --- a/crates/gpui_shared_string/Cargo.toml +++ b/crates/gpui_shared_string/Cargo.toml @@ -3,6 +3,7 @@ name = "gpui_shared_string" version = "0.1.0" publish.workspace = true edition.workspace = true +license.workspace = true [lib] path = "gpui_shared_string.rs" diff --git a/crates/gpui_web/Cargo.toml b/crates/gpui_web/Cargo.toml index 5980fa5e85..290667ce6f 100644 --- a/crates/gpui_web/Cargo.toml +++ b/crates/gpui_web/Cargo.toml @@ -10,7 +10,7 @@ autoexamples = false workspace = true [features] -default = ["multithreaded"] +default = [] multithreaded = ["dep:wasm_thread"] [lib] diff --git a/crates/gpui_web/src/dispatcher.rs b/crates/gpui_web/src/dispatcher.rs index 9c45de1b0e..21283dc64c 100644 --- a/crates/gpui_web/src/dispatcher.rs +++ b/crates/gpui_web/src/dispatcher.rs @@ -11,16 +11,23 @@ use web_time::Instant; #[cfg(feature = "multithreaded")] const MIN_BACKGROUND_THREADS: usize = 2; -#[cfg(feature = "multithreaded")] fn shared_memory_supported() -> bool { - let global = js_sys::global(); - let has_shared_array_buffer = - js_sys::Reflect::has(&global, &JsValue::from_str("SharedArrayBuffer")).unwrap_or(false); - let has_atomics = js_sys::Reflect::has(&global, &JsValue::from_str("Atomics")).unwrap_or(false); - let memory = js_sys::WebAssembly::Memory::from(wasm_bindgen::memory()); - let buffer = memory.buffer(); - let is_shared_buffer = buffer.is_instance_of::(); - has_shared_array_buffer && has_atomics && is_shared_buffer + #[cfg(feature = "multithreaded")] + { + let global = js_sys::global(); + let has_shared_array_buffer = + js_sys::Reflect::has(&global, &JsValue::from_str("SharedArrayBuffer")).unwrap_or(false); + let has_atomics = + js_sys::Reflect::has(&global, &JsValue::from_str("Atomics")).unwrap_or(false); + let memory = js_sys::WebAssembly::Memory::from(wasm_bindgen::memory()); + let buffer = memory.buffer(); + let is_shared_buffer = buffer.is_instance_of::(); + has_shared_array_buffer && has_atomics && is_shared_buffer + } + #[cfg(not(feature = "multithreaded"))] + { + false + } } enum MainThreadItem { @@ -138,7 +145,7 @@ unsafe impl Send for WebDispatcher {} unsafe impl Sync for WebDispatcher {} impl WebDispatcher { - pub fn new(browser_window: web_sys::Window, allow_threads: bool) -> Self { + pub fn new(browser_window: web_sys::Window, _allow_threads: bool) -> Self { #[cfg(feature = "multithreaded")] let (background_sender, background_receiver) = PriorityQueueReceiver::new(); #[cfg(not(feature = "multithreaded"))] @@ -147,7 +154,7 @@ impl WebDispatcher { let main_thread_mailbox = Arc::new(MainThreadMailbox::new()); #[cfg(feature = "multithreaded")] - let supports_threads = allow_threads && shared_memory_supported(); + let supports_threads = _allow_threads && shared_memory_supported(); #[cfg(not(feature = "multithreaded"))] let supports_threads = false; diff --git a/crates/gpui_windows/src/directx_renderer.rs b/crates/gpui_windows/src/directx_renderer.rs index 61ec8355fc..47ea99d8c6 100644 --- a/crates/gpui_windows/src/directx_renderer.rs +++ b/crates/gpui_windows/src/directx_renderer.rs @@ -66,7 +66,7 @@ pub(crate) struct DirectXRenderer { width: u32, height: u32, - /// Whether we want to skip drwaing due to device lost events. + /// Whether we want to skip drawing due to device lost events. /// /// In that case we want to discard the first frame that we draw as we got reset in the middle of a frame /// meaning we lost all the allocated gpu textures and scene resources. diff --git a/crates/gpui_windows/src/events.rs b/crates/gpui_windows/src/events.rs index b04b819a02..51205946ef 100644 --- a/crates/gpui_windows/src/events.rs +++ b/crates/gpui_windows/src/events.rs @@ -938,7 +938,7 @@ impl WindowsWindowInner { unsafe { GetWindowRect(handle, &mut rect) }.log_err(); // right and bottom bounds of RECT are exclusive, thus `-1` let right = rect.right - rect.left - 1; - // the bounds include the padding frames, so accomodate for both of them + // the bounds include the padding frames, so accommodate for both of them if right - 2 * frame_x <= cursor_point.x { HTTOPRIGHT } else { diff --git a/typos.toml b/typos.toml index 2d718e47cc..87088a065a 100644 --- a/typos.toml +++ b/typos.toml @@ -3,15 +3,6 @@ ignore-files = true ignore-hidden = false extend-exclude = [ ".git/", - - # Windows likes its abbreviations. - "crates/gpui/src/platform/windows/directx_renderer.rs", - "crates/gpui/src/platform/windows/events.rs", - "crates/gpui/src/platform/windows/direct_write.rs", - "crates/gpui/src/platform/windows/window.rs", - - # macOS APIs - "crates/gpui/src/platform/mac/dispatcher.rs", ] [default] @@ -22,3 +13,18 @@ extend-ignore-re = [ "typ", ] check-filename = true + +[default.extend-words] +# Screen capture library (zed-scap) +scap = "scap" +# Win32 FORMATETC struct field: Pointer to DVTARGETDEVICE +ptd = "ptd" +# Part of mach_timebase_info_data_t (numerator) +numer = "numer" +# AMD GPU Services library +AGS = "AGS" +ags = "ags" +# Win32 TrackMouseEvent flags (e.g., TME_LEAVE) +TME = "TME" +# Level of Detail (DirectX/Graphics) +LOD = "LOD"