Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Rust 1.78 (#11314)
Piotr Osiewicz1a9b0536a284
diff --git a/Dockerfile b/Dockerfileindex 0bd1b8dd7f9..0614ae589e2 100644--- a/Dockerfile+++ b/Dockerfile@@ -1,6 +1,6 @@# syntax = docker/dockerfile:1.2-FROM rust:1.77-bookworm as builder+FROM rust:1.78-bookworm as builderWORKDIR appCOPY . .diff --git a/crates/assistant2/src/ui/composer.rs b/crates/assistant2/src/ui/composer.rsindex b6515a95480..b08f0f6ec13 100644--- a/crates/assistant2/src/ui/composer.rs+++ b/crates/assistant2/src/ui/composer.rs@@ -144,7 +144,7 @@ impl RenderOnce for ModelSelector {let assistant_chat = self.assistant_chat.clone();move |cx| {_ = assistant_chat.update(cx, |assistant_chat, cx| {- assistant_chat.model = model.clone();+ assistant_chat.model.clone_from(&model);cx.notify();});}diff --git a/crates/client/src/client.rs b/crates/client/src/client.rsindex 77870895684..2144b1ed81b 100644--- a/crates/client/src/client.rs+++ b/crates/client/src/client.rs@@ -100,7 +100,7 @@ impl Settings for ClientSettings {fn load(sources: SettingsSources<Self::FileContent>, _: &mut AppContext) -> Result<Self> {let mut result = sources.json_merge::<Self>()?;if let Some(server_url) = &*ZED_SERVER_URL {- result.server_url = server_url.clone()+ result.server_url.clone_from(&server_url)}Ok(result)}diff --git a/crates/client/src/telemetry.rs b/crates/client/src/telemetry.rsindex 96198c44b4d..8b296097737 100644--- a/crates/client/src/telemetry.rs+++ b/crates/client/src/telemetry.rs@@ -217,7 +217,7 @@ impl Telemetry {}let metrics_id: Option<Arc<str>> = metrics_id.map(|id| id.into());- state.metrics_id = metrics_id.clone();+ state.metrics_id.clone_from(&metrics_id);state.is_staff = Some(is_staff);drop(state);}diff --git a/crates/collab/src/api.rs b/crates/collab/src/api.rsindex 51cbc581527..f5663db2472 100644--- a/crates/collab/src/api.rs+++ b/crates/collab/src/api.rs@@ -116,13 +116,6 @@ struct CreateUserParams {invite_count: i32,}-#[derive(Serialize, Debug)]-struct CreateUserResponse {- user: User,- signup_device_id: Option<String>,- metrics_id: String,-}-async fn get_rpc_server_snapshot(Extension(rpc_server): Extension<Option<Arc<rpc::Server>>>,) -> Result<ErasedJson> {diff --git a/crates/collab_ui/src/notifications/incoming_call_notification.rs b/crates/collab_ui/src/notifications/incoming_call_notification.rsindex 7afa85f694c..4279841f53f 100644--- a/crates/collab_ui/src/notifications/incoming_call_notification.rs+++ b/crates/collab_ui/src/notifications/incoming_call_notification.rs@@ -55,11 +55,6 @@ pub fn init(app_state: &Arc<AppState>, cx: &mut AppContext) {.detach();}-#[derive(Clone, PartialEq)]-struct RespondToCall {- accept: bool,-}-struct IncomingCallNotificationState {call: IncomingCall,app_state: Weak<AppState>,diff --git a/crates/editor/src/display_map/fold_map.rs b/crates/editor/src/display_map/fold_map.rsindex 3bac418602d..e773bc86040 100644--- a/crates/editor/src/display_map/fold_map.rs+++ b/crates/editor/src/display_map/fold_map.rs@@ -6,7 +6,6 @@ use gpui::{ElementId, HighlightStyle, Hsla};use language::{Chunk, Edit, Point, TextSummary};use multi_buffer::{Anchor, AnchorRangeExt, MultiBufferSnapshot, ToOffset};use std::{- any::TypeId,cmp::{self, Ordering},iter,ops::{Add, AddAssign, Deref, DerefMut, Range, Sub},@@ -1066,28 +1065,6 @@ impl<'a> Iterator for FoldChunks<'a> {}}-#[derive(Copy, Clone, Eq, PartialEq)]-struct HighlightEndpoint {- offset: InlayOffset,- is_start: bool,- tag: Option<TypeId>,- style: HighlightStyle,-}--impl PartialOrd for HighlightEndpoint {- fn partial_cmp(&self, other: &Self) -> Option<Ordering> {- Some(self.cmp(other))- }-}--impl Ord for HighlightEndpoint {- fn cmp(&self, other: &Self) -> Ordering {- self.offset- .cmp(&other.offset)- .then_with(|| other.is_start.cmp(&self.is_start))- }-}-#[derive(Copy, Clone, Debug, Default, Eq, Ord, PartialOrd, PartialEq)]pub struct FoldOffset(pub usize);diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rsindex d1d8c697fa7..e03ef6c08d4 100644--- a/crates/editor/src/editor.rs+++ b/crates/editor/src/editor.rs@@ -1167,7 +1167,7 @@ impl CompletionsMenu {for mat in &mut matches {let completion = &completions[mat.candidate_id];- mat.string = completion.label.text.clone();+ mat.string.clone_from(&completion.label.text);for position in &mut mat.positions {*position += completion.label.filter_range.start;}@@ -10837,34 +10837,12 @@ impl ViewInputHandler for Editor {}trait SelectionExt {- fn offset_range(&self, buffer: &MultiBufferSnapshot) -> Range<usize>;- fn point_range(&self, buffer: &MultiBufferSnapshot) -> Range<Point>;fn display_range(&self, map: &DisplaySnapshot) -> Range<DisplayPoint>;fn spanned_rows(&self, include_end_if_at_line_start: bool, map: &DisplaySnapshot)-> Range<u32>;}impl<T: ToPoint + ToOffset> SelectionExt for Selection<T> {- fn point_range(&self, buffer: &MultiBufferSnapshot) -> Range<Point> {- let start = self.start.to_point(buffer);- let end = self.end.to_point(buffer);- if self.reversed {- end..start- } else {- start..end- }- }-- fn offset_range(&self, buffer: &MultiBufferSnapshot) -> Range<usize> {- let start = self.start.to_offset(buffer);- let end = self.end.to_offset(buffer);- if self.reversed {- end..start- } else {- start..end- }- }-fn display_range(&self, map: &DisplaySnapshot) -> Range<DisplayPoint> {let start = self.startdiff --git a/crates/editor/src/selections_collection.rs b/crates/editor/src/selections_collection.rsindex d4d40b8563d..137cff4827a 100644--- a/crates/editor/src/selections_collection.rs+++ b/crates/editor/src/selections_collection.rs@@ -69,7 +69,7 @@ impl SelectionsCollection {self.next_selection_id = other.next_selection_id;self.line_mode = other.line_mode;self.disjoint = other.disjoint.clone();- self.pending = other.pending.clone();+ self.pending.clone_from(&other.pending);}pub fn count(&self) -> usize {diff --git a/crates/git/src/blame.rs b/crates/git/src/blame.rsindex 6b9848609d2..516918c6ba2 100644--- a/crates/git/src/blame.rs+++ b/crates/git/src/blame.rs@@ -255,15 +255,21 @@ fn parse_git_blame(output: &str) -> Result<Vec<BlameEntry>> {.get(&new_entry.sha).and_then(|slot| entries.get(*slot)){- new_entry.author = existing_entry.author.clone();- new_entry.author_mail = existing_entry.author_mail.clone();+ new_entry.author.clone_from(&existing_entry.author);+ new_entry+ .author_mail+ .clone_from(&existing_entry.author_mail);new_entry.author_time = existing_entry.author_time;- new_entry.author_tz = existing_entry.author_tz.clone();- new_entry.committer = existing_entry.committer.clone();- new_entry.committer_mail = existing_entry.committer_mail.clone();+ new_entry.author_tz.clone_from(&existing_entry.author_tz);+ new_entry.committer.clone_from(&existing_entry.committer);+ new_entry+ .committer_mail+ .clone_from(&existing_entry.committer_mail);new_entry.committer_time = existing_entry.committer_time;- new_entry.committer_tz = existing_entry.committer_tz.clone();- new_entry.summary = existing_entry.summary.clone();+ new_entry+ .committer_tz+ .clone_from(&existing_entry.committer_tz);+ new_entry.summary.clone_from(&existing_entry.summary);}current_entry.replace(new_entry);diff --git a/crates/gpui/src/app/async_context.rs b/crates/gpui/src/app/async_context.rsindex b251c638f5b..a0e463d7196 100644--- a/crates/gpui/src/app/async_context.rs+++ b/crates/gpui/src/app/async_context.rs@@ -25,10 +25,7 @@ impl Context for AsyncAppContext {fn new_model<T: 'static>(&mut self,build_model: impl FnOnce(&mut ModelContext<'_, T>) -> T,- ) -> Self::Result<Model<T>>- where- T: 'static,- {+ ) -> Self::Result<Model<T>> {let app = self.app.upgrade()diff --git a/crates/gpui/src/app/test_context.rs b/crates/gpui/src/app/test_context.rsindex 98512e6d814..0c6fb888e1e 100644--- a/crates/gpui/src/app/test_context.rs+++ b/crates/gpui/src/app/test_context.rs@@ -35,10 +35,7 @@ impl Context for TestAppContext {fn new_model<T: 'static>(&mut self,build_model: impl FnOnce(&mut ModelContext<'_, T>) -> T,- ) -> Self::Result<Model<T>>- where- T: 'static,- {+ ) -> Self::Result<Model<T>> {let mut app = self.app.borrow_mut();app.new_model(build_model)}diff --git a/crates/gpui/src/elements/div.rs b/crates/gpui/src/elements/div.rsindex 989bab7c672..e77d42bafe5 100644--- a/crates/gpui/src/elements/div.rs+++ b/crates/gpui/src/elements/div.rs@@ -708,10 +708,7 @@ pub trait InteractiveElement: Sized {fn on_drag_move<T: 'static>(mut self,listener: impl Fn(&DragMoveEvent<T>, &mut WindowContext) + 'static,- ) -> Self- where- T: 'static,- {+ ) -> Self {self.interactivity().on_drag_move(listener);self}diff --git a/crates/gpui/src/platform.rs b/crates/gpui/src/platform.rsindex b6415a6e501..6c234c3c34f 100644--- a/crates/gpui/src/platform.rs+++ b/crates/gpui/src/platform.rs@@ -41,7 +41,6 @@ use std::borrow::Cow;use std::hash::{Hash, Hasher};use std::time::Duration;use std::{- any::Any,fmt::{self, Debug},ops::Range,path::{Path, PathBuf},@@ -107,7 +106,6 @@ pub(crate) trait Platform: 'static {fn displays(&self) -> Vec<Rc<dyn PlatformDisplay>>;fn primary_display(&self) -> Option<Rc<dyn PlatformDisplay>>;- fn display(&self, id: DisplayId) -> Option<Rc<dyn PlatformDisplay>>;fn active_window(&self) -> Option<AnyWindowHandle>;fn open_window(&self,@@ -129,11 +127,8 @@ pub(crate) trait Platform: 'static {fn prompt_for_new_path(&self, directory: &Path) -> oneshot::Receiver<Option<PathBuf>>;fn reveal_path(&self, path: &Path);- fn on_become_active(&self, callback: Box<dyn FnMut()>);- fn on_resign_active(&self, callback: Box<dyn FnMut()>);fn on_quit(&self, callback: Box<dyn FnMut()>);fn on_reopen(&self, callback: Box<dyn FnMut()>);- fn on_event(&self, callback: Box<dyn FnMut(PlatformInput) -> bool>);fn set_menus(&self, menus: Vec<Menu>, keymap: &Keymap);fn add_recent_document(&self, _path: &Path) {}@@ -196,7 +191,6 @@ pub(crate) trait PlatformWindow: HasWindowHandle + HasDisplayHandle {fn display(&self) -> Rc<dyn PlatformDisplay>;fn mouse_position(&self) -> Point<Pixels>;fn modifiers(&self) -> Modifiers;- fn as_any_mut(&mut self) -> &mut dyn Any;fn set_input_handler(&mut self, input_handler: PlatformInputHandler);fn take_input_handler(&mut self) -> Option<PlatformInputHandler>;fn prompt(@@ -221,12 +215,10 @@ pub(crate) trait PlatformWindow: HasWindowHandle + HasDisplayHandle {fn on_input(&self, callback: Box<dyn FnMut(PlatformInput) -> DispatchEventResult>);fn on_active_status_change(&self, callback: Box<dyn FnMut(bool)>);fn on_resize(&self, callback: Box<dyn FnMut(Size<Pixels>, f32)>);- fn on_fullscreen(&self, callback: Box<dyn FnMut(bool)>);fn on_moved(&self, callback: Box<dyn FnMut()>);fn on_should_close(&self, callback: Box<dyn FnMut() -> bool>);fn on_close(&self, callback: Box<dyn FnOnce()>);fn on_appearance_changed(&self, callback: Box<dyn FnMut()>);- fn is_topmost_for_position(&self, position: Point<Pixels>) -> bool;fn draw(&self, scene: &Scene);fn completed_frame(&self) {}fn sprite_atlas(&self) -> Arc<dyn PlatformAtlas>;@@ -274,13 +266,6 @@ pub(crate) trait PlatformTextSystem: Send + Sync {raster_bounds: Bounds<DevicePixels>,) -> Result<(Size<DevicePixels>, Vec<u8>)>;fn layout_line(&self, text: &str, font_size: Pixels, runs: &[FontRun]) -> LineLayout;- fn wrap_line(- &self,- text: &str,- font_id: FontId,- font_size: Pixels,- width: Pixels,- ) -> Vec<usize>;}/// Basic metadata about the current application and operating system.@@ -566,7 +551,6 @@ pub struct WindowOptions {/// The variables that can be configured when creating a new window#[derive(Debug)]pub(crate) struct WindowParams {- ///pub bounds: Bounds<DevicePixels>,/// The titlebar configuration of the windowdiff --git a/crates/gpui/src/platform/cosmic_text/text_system.rs b/crates/gpui/src/platform/cosmic_text/text_system.rsindex a6f131ff7f3..c1c5f5aa803 100644--- a/crates/gpui/src/platform/cosmic_text/text_system.rs+++ b/crates/gpui/src/platform/cosmic_text/text_system.rs@@ -176,17 +176,6 @@ impl PlatformTextSystem for CosmicTextSystem {fn layout_line(&self, text: &str, font_size: Pixels, runs: &[FontRun]) -> LineLayout {self.0.write().layout_line(text, font_size, runs)}-- // todo(linux) Confirm that this has been superseded by the LineWrapper- fn wrap_line(- &self,- _text: &str,- _font_id: FontId,- _font_size: Pixels,- _width: Pixels,- ) -> Vec<usize> {- unimplemented!()- }}impl CosmicTextSystemState {diff --git a/crates/gpui/src/platform/linux/platform.rs b/crates/gpui/src/platform/linux/platform.rsindex 99d77c76a14..696421714ba 100644--- a/crates/gpui/src/platform/linux/platform.rs+++ b/crates/gpui/src/platform/linux/platform.rs@@ -199,10 +199,6 @@ impl<P: LinuxClient + 'static> Platform for P {self.displays()}- fn display(&self, id: DisplayId) -> Option<Rc<dyn PlatformDisplay>> {- self.display(id)- }-// todo(linux)fn active_window(&self) -> Option<AnyWindowHandle> {None@@ -306,18 +302,6 @@ impl<P: LinuxClient + 'static> Platform for P {open::that(dir);}- fn on_become_active(&self, callback: Box<dyn FnMut()>) {- self.with_common(|common| {- common.callbacks.become_active = Some(callback);- });- }-- fn on_resign_active(&self, callback: Box<dyn FnMut()>) {- self.with_common(|common| {- common.callbacks.resign_active = Some(callback);- });- }-fn on_quit(&self, callback: Box<dyn FnMut()>) {self.with_common(|common| {common.callbacks.quit = Some(callback);@@ -330,12 +314,6 @@ impl<P: LinuxClient + 'static> Platform for P {});}- fn on_event(&self, callback: Box<dyn FnMut(PlatformInput) -> bool>) {- self.with_common(|common| {- common.callbacks.event = Some(callback);- });- }-fn on_app_menu_action(&self, callback: Box<dyn FnMut(&dyn Action)>) {self.with_common(|common| {common.callbacks.app_menu_action = Some(callback);diff --git a/crates/gpui/src/platform/linux/wayland/window.rs b/crates/gpui/src/platform/linux/wayland/window.rsindex da312459a52..05e9e29bdc0 100644--- a/crates/gpui/src/platform/linux/wayland/window.rs+++ b/crates/gpui/src/platform/linux/wayland/window.rs@@ -580,10 +580,6 @@ impl PlatformWindow for WaylandWindow {crate::Modifiers::default()}- fn as_any_mut(&mut self) -> &mut dyn Any {- self- }-fn set_input_handler(&mut self, input_handler: PlatformInputHandler) {self.borrow_mut().input_handler = Some(input_handler);}@@ -668,10 +664,6 @@ impl PlatformWindow for WaylandWindow {self.0.callbacks.borrow_mut().resize = Some(callback);}- fn on_fullscreen(&self, callback: Box<dyn FnMut(bool)>) {- self.0.callbacks.borrow_mut().fullscreen = Some(callback);- }-fn on_moved(&self, callback: Box<dyn FnMut()>) {self.0.callbacks.borrow_mut().moved = Some(callback);}@@ -688,11 +680,6 @@ impl PlatformWindow for WaylandWindow {// todo(linux)}- // todo(linux)- fn is_topmost_for_position(&self, position: Point<Pixels>) -> bool {- false- }-fn draw(&self, scene: &Scene) {let mut state = self.borrow_mut();state.renderer.draw(scene);diff --git a/crates/gpui/src/platform/linux/x11/window.rs b/crates/gpui/src/platform/linux/x11/window.rsindex 33b8f594d6c..b28391a587d 100644--- a/crates/gpui/src/platform/linux/x11/window.rs+++ b/crates/gpui/src/platform/linux/x11/window.rs@@ -460,10 +460,6 @@ impl PlatformWindow for X11Window {Modifiers::default()}- fn as_any_mut(&mut self) -> &mut dyn std::any::Any {- self- }-fn set_input_handler(&mut self, input_handler: PlatformInputHandler) {self.0.state.borrow_mut().input_handler = Some(input_handler);}@@ -587,10 +583,6 @@ impl PlatformWindow for X11Window {self.0.callbacks.borrow_mut().resize = Some(callback);}- fn on_fullscreen(&self, callback: Box<dyn FnMut(bool)>) {- self.0.callbacks.borrow_mut().fullscreen = Some(callback);- }-fn on_moved(&self, callback: Box<dyn FnMut()>) {self.0.callbacks.borrow_mut().moved = Some(callback);}@@ -607,11 +599,6 @@ impl PlatformWindow for X11Window {self.0.callbacks.borrow_mut().appearance_changed = Some(callback);}- // todo(linux)- fn is_topmost_for_position(&self, _position: Point<Pixels>) -> bool {- unimplemented!()- }-fn draw(&self, scene: &Scene) {let mut inner = self.0.state.borrow_mut();inner.renderer.draw(scene);diff --git a/crates/gpui/src/platform/mac/platform.rs b/crates/gpui/src/platform/mac/platform.rsindex 57728986935..d541d78e813 100644--- a/crates/gpui/src/platform/mac/platform.rs+++ b/crates/gpui/src/platform/mac/platform.rs@@ -1,9 +1,9 @@use super::{events::key_to_native, BoolExt};use crate::{- Action, AnyWindowHandle, BackgroundExecutor, ClipboardItem, CursorStyle, DisplayId,- ForegroundExecutor, Keymap, MacDispatcher, MacDisplay, MacTextSystem, MacWindow, Menu,- MenuItem, PathPromptOptions, Platform, PlatformDisplay, PlatformInput, PlatformTextSystem,- PlatformWindow, Result, SemanticVersion, Task, WindowAppearance, WindowParams,+ Action, AnyWindowHandle, BackgroundExecutor, ClipboardItem, CursorStyle, ForegroundExecutor,+ Keymap, MacDispatcher, MacDisplay, MacTextSystem, MacWindow, Menu, MenuItem, PathPromptOptions,+ Platform, PlatformDisplay, PlatformInput, PlatformTextSystem, PlatformWindow, Result,+ SemanticVersion, Task, WindowAppearance, WindowParams,};use anyhow::{anyhow, bail};use block::ConcreteBlock;@@ -487,10 +487,6 @@ impl Platform for MacPlatform {.collect()}- fn display(&self, id: DisplayId) -> Option<Rc<dyn PlatformDisplay>> {- MacDisplay::find_by_id(id).map(|screen| Rc::new(screen) as Rc<_>)- }-fn active_window(&self) -> Option<AnyWindowHandle> {MacWindow::active_window()}@@ -679,14 +675,6 @@ impl Platform for MacPlatform {}}- fn on_become_active(&self, callback: Box<dyn FnMut()>) {- self.0.lock().become_active = Some(callback);- }-- fn on_resign_active(&self, callback: Box<dyn FnMut()>) {- self.0.lock().resign_active = Some(callback);- }-fn on_quit(&self, callback: Box<dyn FnMut()>) {self.0.lock().quit = Some(callback);}@@ -695,10 +683,6 @@ impl Platform for MacPlatform {self.0.lock().reopen = Some(callback);}- fn on_event(&self, callback: Box<dyn FnMut(PlatformInput) -> bool>) {- self.0.lock().event = Some(callback);- }-fn on_app_menu_action(&self, callback: Box<dyn FnMut(&dyn Action)>) {self.0.lock().menu_command = Some(callback);}diff --git a/crates/gpui/src/platform/mac/text_system.rs b/crates/gpui/src/platform/mac/text_system.rsindex 6c4a10af00d..8806d1bd18c 100644--- a/crates/gpui/src/platform/mac/text_system.rs+++ b/crates/gpui/src/platform/mac/text_system.rs@@ -7,8 +7,7 @@ use anyhow::anyhow;use cocoa::appkit::{CGFloat, CGPoint};use collections::{BTreeSet, HashMap};use core_foundation::{- array::CFIndex,- attributed_string::{CFAttributedStringRef, CFMutableAttributedString},+ attributed_string::CFMutableAttributedString,base::{CFRange, TCFType},number::CFNumber,string::CFString,@@ -42,7 +41,7 @@ use pathfinder_geometry::{vector::{Vector2F, Vector2I},};use smallvec::SmallVec;-use std::{borrow::Cow, char, cmp, convert::TryFrom, ffi::c_void, sync::Arc};+use std::{borrow::Cow, char, cmp, convert::TryFrom, sync::Arc};use super::open_type;@@ -186,16 +185,6 @@ impl PlatformTextSystem for MacTextSystem {fn layout_line(&self, text: &str, font_size: Pixels, font_runs: &[FontRun]) -> LineLayout {self.0.write().layout_line(text, font_size, font_runs)}-- fn wrap_line(- &self,- text: &str,- font_id: FontId,- font_size: Pixels,- width: Pixels,- ) -> Vec<usize> {- self.0.read().wrap_line(text, font_id, font_size, width)- }}impl MacTextSystemState {@@ -527,43 +516,6 @@ impl MacTextSystemState {len: text.len(),}}-- fn wrap_line(- &self,- text: &str,- font_id: FontId,- font_size: Pixels,- width: Pixels,- ) -> Vec<usize> {- let mut string = CFMutableAttributedString::new();- string.replace_str(&CFString::new(text), CFRange::init(0, 0));- let cf_range = CFRange::init(0, text.encode_utf16().count() as isize);- let font = &self.fonts[font_id.0];- unsafe {- string.set_attribute(- cf_range,- kCTFontAttributeName,- &font.native_font().clone_with_font_size(font_size.into()),- );-- let typesetter = CTTypesetterCreateWithAttributedString(string.as_concrete_TypeRef());- let mut ix_converter = StringIndexConverter::new(text);- let mut break_indices = Vec::new();- while ix_converter.utf8_ix < text.len() {- let utf16_len = CTTypesetterSuggestLineBreak(- typesetter,- ix_converter.utf16_ix as isize,- width.into(),- ) as usize;- ix_converter.advance_to_utf16_ix(ix_converter.utf16_ix + utf16_len);- if ix_converter.utf8_ix >= text.len() {- break;- }- break_indices.push(ix_converter.utf8_ix);- }- break_indices- }- }}#[derive(Clone)]@@ -605,22 +557,6 @@ impl<'a> StringIndexConverter<'a> {}}-#[repr(C)]-pub(crate) struct __CFTypesetter(c_void);--type CTTypesetterRef = *const __CFTypesetter;--#[link(name = "CoreText", kind = "framework")]-extern "C" {- fn CTTypesetterCreateWithAttributedString(string: CFAttributedStringRef) -> CTTypesetterRef;-- fn CTTypesetterSuggestLineBreak(- typesetter: CTTypesetterRef,- start_index: CFIndex,- width: f64,- ) -> CFIndex;-}-impl From<Metrics> for FontMetrics {fn from(metrics: Metrics) -> Self {FontMetrics {@@ -741,23 +677,6 @@ mod lenient_font_attributes {mod tests {use crate::{font, px, FontRun, GlyphId, MacTextSystem, PlatformTextSystem};- #[test]- fn test_wrap_line() {- let fonts = MacTextSystem::new();- let font_id = fonts.font_id(&font("Helvetica")).unwrap();-- let line = "one two three four five\n";- let wrap_boundaries = fonts.wrap_line(line, font_id, px(16.), px(64.0));- assert_eq!(wrap_boundaries, &["one two ".len(), "one two three ".len()]);-- let line = "aaa ααα ✋✋✋ 🎉🎉🎉\n";- let wrap_boundaries = fonts.wrap_line(line, font_id, px(16.), px(64.0));- assert_eq!(- wrap_boundaries,- &["aaa ααα ".len(), "aaa ααα ✋✋✋ ".len(),]- );- }-#[test]fn test_layout_line_bom_char() {let fonts = MacTextSystem::new();diff --git a/crates/gpui/src/platform/mac/window.rs b/crates/gpui/src/platform/mac/window.rsindex 66bb6bd40f9..75584196c09 100644--- a/crates/gpui/src/platform/mac/window.rs+++ b/crates/gpui/src/platform/mac/window.rs@@ -34,7 +34,6 @@ use parking_lot::Mutex;use raw_window_handle as rwh;use smallvec::SmallVec;use std::{- any::Any,cell::Cell,ffi::{c_void, CStr},mem,@@ -504,16 +503,6 @@ impl MacWindowState {px((frame.size.height - content_layout_rect.size.height) as f32)}}-- fn to_screen_ns_point(&self, point: Point<Pixels>) -> NSPoint {- unsafe {- let point = NSPoint::new(- point.x.into(),- (self.content_size().height - point.y).into(),- );- msg_send![self.native_window, convertPointToScreen: point]- }- }}unsafe impl Send for MacWindowState {}@@ -863,10 +852,6 @@ impl PlatformWindow for MacWindow {}}- fn as_any_mut(&mut self) -> &mut dyn Any {- self- }-fn set_input_handler(&mut self, input_handler: PlatformInputHandler) {self.0.as_ref().lock().input_handler = Some(input_handler);}@@ -1102,10 +1087,6 @@ impl PlatformWindow for MacWindow {self.0.as_ref().lock().resize_callback = Some(callback);}- fn on_fullscreen(&self, callback: Box<dyn FnMut(bool)>) {- self.0.as_ref().lock().fullscreen_callback = Some(callback);- }-fn on_moved(&self, callback: Box<dyn FnMut()>) {self.0.as_ref().lock().moved_callback = Some(callback);}@@ -1122,31 +1103,6 @@ impl PlatformWindow for MacWindow {self.0.lock().appearance_changed_callback = Some(callback);}- fn is_topmost_for_position(&self, position: Point<Pixels>) -> bool {- let self_borrow = self.0.lock();- let self_handle = self_borrow.handle;-- unsafe {- let app = NSApplication::sharedApplication(nil);-- // Convert back to screen coordinates- let screen_point = self_borrow.to_screen_ns_point(position);-- let window_number: NSInteger = msg_send![class!(NSWindow), windowNumberAtPoint:screen_point belowWindowWithWindowNumber:0];- let top_most_window: id = msg_send![app, windowWithWindowNumber: window_number];-- let is_panel: BOOL = msg_send![top_most_window, isKindOfClass: PANEL_CLASS];- let is_window: BOOL = msg_send![top_most_window, isKindOfClass: WINDOW_CLASS];- if is_panel == YES || is_window == YES {- let topmost_window = get_window_state(&*top_most_window).lock().handle;- topmost_window == self_handle- } else {- // Someone else's window is on top- false- }- }- }-fn draw(&self, scene: &crate::Scene) {let mut this = self.0.lock();this.renderer.draw(scene);diff --git a/crates/gpui/src/platform/test/platform.rs b/crates/gpui/src/platform/test/platform.rsindex 14618e2584a..c243f4fac17 100644--- a/crates/gpui/src/platform/test/platform.rs+++ b/crates/gpui/src/platform/test/platform.rs@@ -1,7 +1,7 @@use crate::{- AnyWindowHandle, BackgroundExecutor, ClipboardItem, CursorStyle, DisplayId, ForegroundExecutor,- Keymap, Platform, PlatformDisplay, PlatformTextSystem, Task, TestDisplay, TestWindow,- WindowAppearance, WindowParams,+ AnyWindowHandle, BackgroundExecutor, ClipboardItem, CursorStyle, ForegroundExecutor, Keymap,+ Platform, PlatformDisplay, PlatformTextSystem, Task, TestDisplay, TestWindow, WindowAppearance,+ WindowParams,};use anyhow::{anyhow, Result};use collections::VecDeque;@@ -90,7 +90,7 @@ impl TestPlatform {pub(crate) fn set_active_window(&self, window: Option<TestWindow>) {let executor = self.foreground_executor().clone();let previous_window = self.active_window.borrow_mut().take();- *self.active_window.borrow_mut() = window.clone();+ self.active_window.borrow_mut().clone_from(&window);executor.spawn(async move {@@ -168,10 +168,6 @@ impl Platform for TestPlatform {Some(self.active_display.clone())}- fn display(&self, id: DisplayId) -> Option<std::rc::Rc<dyn crate::PlatformDisplay>> {- self.displays().iter().find(|d| d.id() == id).cloned()- }-fn active_window(&self) -> Option<crate::AnyWindowHandle> {self.active_window.borrow()@@ -228,20 +224,12 @@ impl Platform for TestPlatform {unimplemented!()}- fn on_become_active(&self, _callback: Box<dyn FnMut()>) {}-- fn on_resign_active(&self, _callback: Box<dyn FnMut()>) {}-fn on_quit(&self, _callback: Box<dyn FnMut()>) {}fn on_reopen(&self, _callback: Box<dyn FnMut()>) {unimplemented!()}- fn on_event(&self, _callback: Box<dyn FnMut(crate::PlatformInput) -> bool>) {- unimplemented!()- }-fn set_menus(&self, _menus: Vec<crate::Menu>, _keymap: &Keymap) {}fn add_recent_document(&self, _paths: &Path) {}diff --git a/crates/gpui/src/platform/test/text_system.rs b/crates/gpui/src/platform/test/text_system.rsindex ca3a9e3a337..bec559a0f72 100644--- a/crates/gpui/src/platform/test/text_system.rs+++ b/crates/gpui/src/platform/test/text_system.rs@@ -47,13 +47,4 @@ impl PlatformTextSystem for TestTextSystem {fn layout_line(&self, text: &str, font_size: Pixels, runs: &[FontRun]) -> LineLayout {unimplemented!()}- fn wrap_line(- &self,- text: &str,- font_id: FontId,- font_size: Pixels,- width: Pixels,- ) -> Vec<usize> {- unimplemented!()- }}diff --git a/crates/gpui/src/platform/test/window.rs b/crates/gpui/src/platform/test/window.rsindex 959d72d9fa0..bc9349e0170 100644--- a/crates/gpui/src/platform/test/window.rs+++ b/crates/gpui/src/platform/test/window.rs@@ -144,10 +144,6 @@ impl PlatformWindow for TestWindow {crate::Modifiers::default()}- fn as_any_mut(&mut self) -> &mut dyn std::any::Any {- self- }-fn set_input_handler(&mut self, input_handler: PlatformInputHandler) {self.0.lock().input_handler = Some(input_handler);}@@ -235,10 +231,6 @@ impl PlatformWindow for TestWindow {self.0.lock().resize_callback = Some(callback)}- fn on_fullscreen(&self, _callback: Box<dyn FnMut(bool)>) {- unimplemented!()- }-fn on_moved(&self, callback: Box<dyn FnMut()>) {self.0.lock().moved_callback = Some(callback)}@@ -251,10 +243,6 @@ impl PlatformWindow for TestWindow {fn on_appearance_changed(&self, _callback: Box<dyn FnMut()>) {}- fn is_topmost_for_position(&self, _position: crate::Point<Pixels>) -> bool {- unimplemented!()- }-fn draw(&self, _scene: &crate::Scene) {}fn sprite_atlas(&self) -> sync::Arc<dyn crate::PlatformAtlas> {diff --git a/crates/gpui/src/platform/windows/direct_write.rs b/crates/gpui/src/platform/windows/direct_write.rsindex eded7916347..6078d999be5 100644--- a/crates/gpui/src/platform/windows/direct_write.rs+++ b/crates/gpui/src/platform/windows/direct_write.rs@@ -182,16 +182,6 @@ impl PlatformTextSystem for DirectWriteTextSystem {fn layout_line(&self, text: &str, font_size: Pixels, runs: &[FontRun]) -> LineLayout {self.0.write().layout_line(text, font_size, runs)}-- fn wrap_line(- &self,- _text: &str,- _font_id: FontId,- _font_size: Pixels,- _width: Pixels,- ) -> Vec<usize> {- unimplemented!()- }}impl DirectWriteState {diff --git a/crates/gpui/src/platform/windows/platform.rs b/crates/gpui/src/platform/windows/platform.rsindex 72772e871b0..5e363614b9a 100644--- a/crates/gpui/src/platform/windows/platform.rs+++ b/crates/gpui/src/platform/windows/platform.rs@@ -342,14 +342,6 @@ impl Platform for WindowsPlatform {WindowsDisplay::displays()}- fn display(&self, id: crate::DisplayId) -> Option<Rc<dyn PlatformDisplay>> {- if let Some(display) = WindowsDisplay::new(id) {- Some(Rc::new(display) as Rc<dyn PlatformDisplay>)- } else {- None- }- }-fn primary_display(&self) -> Option<Rc<dyn PlatformDisplay>> {if let Some(display) = WindowsDisplay::primary_monitor() {Some(Rc::new(display) as Rc<dyn PlatformDisplay>)@@ -511,14 +503,6 @@ impl Platform for WindowsPlatform {.detach();}- fn on_become_active(&self, callback: Box<dyn FnMut()>) {- self.inner.callbacks.lock().become_active = Some(callback);- }-- fn on_resign_active(&self, callback: Box<dyn FnMut()>) {- self.inner.callbacks.lock().resign_active = Some(callback);- }-fn on_quit(&self, callback: Box<dyn FnMut()>) {self.inner.callbacks.lock().quit = Some(callback);}@@ -527,10 +511,6 @@ impl Platform for WindowsPlatform {self.inner.callbacks.lock().reopen = Some(callback);}- fn on_event(&self, callback: Box<dyn FnMut(PlatformInput) -> bool>) {- self.inner.callbacks.lock().event = Some(callback);- }-// todo(windows)fn set_menus(&self, menus: Vec<Menu>, keymap: &Keymap) {}diff --git a/crates/gpui/src/platform/windows/window.rs b/crates/gpui/src/platform/windows/window.rsindex cc2aa9591e5..ec27c5b254e 100644--- a/crates/gpui/src/platform/windows/window.rs+++ b/crates/gpui/src/platform/windows/window.rs@@ -1,7 +1,6 @@#![deny(unsafe_op_in_unsafe_fn)]use std::{- any::Any,cell::{Cell, RefCell},iter::once,num::NonZeroIsize,@@ -1408,10 +1407,6 @@ impl PlatformWindow for WindowsWindow {Modifiers::none()}- fn as_any_mut(&mut self) -> &mut dyn Any {- self- }-// todo(windows)fn set_input_handler(&mut self, input_handler: PlatformInputHandler) {self.inner.input_handler.set(Some(input_handler));@@ -1566,11 +1561,6 @@ impl PlatformWindow for WindowsWindow {self.inner.callbacks.borrow_mut().resize = Some(callback);}- // todo(windows)- fn on_fullscreen(&self, callback: Box<dyn FnMut(bool)>) {- self.inner.callbacks.borrow_mut().fullscreen = Some(callback);- }-// todo(windows)fn on_moved(&self, callback: Box<dyn FnMut()>) {self.inner.callbacks.borrow_mut().moved = Some(callback);@@ -1591,11 +1581,6 @@ impl PlatformWindow for WindowsWindow {self.inner.callbacks.borrow_mut().appearance_changed = Some(callback);}- // todo(windows)- fn is_topmost_for_position(&self, _position: Point<Pixels>) -> bool {- true- }-// todo(windows)fn draw(&self, scene: &Scene) {self.inner.renderer.borrow_mut().draw(scene)diff --git a/crates/gpui/src/window.rs b/crates/gpui/src/window.rsindex 4d2c3e15c87..d7e9863cfdb 100644--- a/crates/gpui/src/window.rs+++ b/crates/gpui/src/window.rs@@ -1430,8 +1430,12 @@ impl<'a> WindowContext<'a> {let mut deferred_draws = mem::take(&mut self.window.next_frame.deferred_draws);for deferred_draw_ix in deferred_draw_indices {let deferred_draw = &mut deferred_draws[*deferred_draw_ix];- self.window.element_id_stack = deferred_draw.element_id_stack.clone();- self.window.text_style_stack = deferred_draw.text_style_stack.clone();+ self.window+ .element_id_stack+ .clone_from(&deferred_draw.element_id_stack);+ self.window+ .text_style_stack+ .clone_from(&deferred_draw.text_style_stack);self.window.next_frame.dispatch_tree@@ -1464,7 +1468,9 @@ impl<'a> WindowContext<'a> {let mut deferred_draws = mem::take(&mut self.window.next_frame.deferred_draws);for deferred_draw_ix in deferred_draw_indices {let mut deferred_draw = &mut deferred_draws[*deferred_draw_ix];- self.window.element_id_stack = deferred_draw.element_id_stack.clone();+ self.window+ .element_id_stack+ .clone_from(&deferred_draw.element_id_stack);self.window.next_frame.dispatch_treediff --git a/crates/language/src/buffer.rs b/crates/language/src/buffer.rsindex 8428338fc16..5bebc16e4ec 100644--- a/crates/language/src/buffer.rs+++ b/crates/language/src/buffer.rs@@ -2072,7 +2072,7 @@ impl Buffer {/// Override current completion triggers with the user-provided completion triggers.pub fn set_completion_triggers(&mut self, triggers: Vec<String>, cx: &mut ModelContext<Self>) {- self.completion_triggers = triggers.clone();+ self.completion_triggers.clone_from(&triggers);self.completion_triggers_timestamp = self.text.lamport_clock.tick();self.send_operation(Operation::UpdateCompletionTriggers {diff --git a/crates/language/src/language.rs b/crates/language/src/language.rsindex 61321050786..dc92f0a2d36 100644--- a/crates/language/src/language.rs+++ b/crates/language/src/language.rs@@ -1126,7 +1126,7 @@ impl Language {for setting in query.property_settings(ix) {match setting.key.as_ref() {"language" => {- config.language = setting.value.clone();+ config.language.clone_from(&setting.value);}"combined" => {config.combined = true;diff --git a/crates/language/src/outline.rs b/crates/language/src/outline.rsindex 685fd297fcf..bf807bfc757 100644--- a/crates/language/src/outline.rs+++ b/crates/language/src/outline.rs@@ -82,7 +82,7 @@ impl<T> Outline<T> {let mut prev_item_ix = 0;for mut string_match in matches {let outline_match = &self.items[string_match.candidate_id];- string_match.string = outline_match.text.clone();+ string_match.string.clone_from(&outline_match.text);if is_path_query {let prefix_len = self.path_candidate_prefixes[string_match.candidate_id];diff --git a/crates/live_kit_server/build.rs b/crates/live_kit_server/build.rsindex fa1bde69d6b..b12b36ffe07 100644--- a/crates/live_kit_server/build.rs+++ b/crates/live_kit_server/build.rs@@ -1,5 +1,6 @@fn main() {prost_build::Config::new()+ .type_attribute("SendDataResponse", "#[allow(clippy::empty_docs)]").compile_protos(&["protocol/livekit_room.proto"], &["protocol"]).unwrap();}diff --git a/crates/search/src/buffer_search.rs b/crates/search/src/buffer_search.rsindex 3e0b8fb7480..7eb7296fa1c 100644--- a/crates/search/src/buffer_search.rs+++ b/crates/search/src/buffer_search.rs@@ -426,10 +426,6 @@ impl ToolbarItemView for BufferSearchBar {}ToolbarItemLocation::Hidden}-- fn row_count(&self, _: &WindowContext<'_>) -> usize {- 1- }}impl BufferSearchBar {diff --git a/crates/search/src/project_search.rs b/crates/search/src/project_search.rsindex f7f659f78a4..dd814f99731 100644--- a/crates/search/src/project_search.rs+++ b/crates/search/src/project_search.rs@@ -1629,15 +1629,6 @@ impl ToolbarItemView for ProjectSearchBar {ToolbarItemLocation::Hidden}}-- fn row_count(&self, cx: &WindowContext<'_>) -> usize {- if let Some(search) = self.active_project_search.as_ref() {- if search.read(cx).filters_enabled {- return 2;- }- }- 1- }}fn register_workspace_action<A: Action>(diff --git a/crates/theme/src/settings.rs b/crates/theme/src/settings.rsindex 5d7d4861877..2492e45aa7e 100644--- a/crates/theme/src/settings.rs+++ b/crates/theme/src/settings.rs@@ -441,7 +441,7 @@ impl settings::Settings for ThemeSettings {}}- this.theme_overrides = value.theme_overrides.clone();+ this.theme_overrides.clone_from(&value.theme_overrides);this.apply_theme_overrides();merge(&mut this.ui_font_size, value.ui_font_size.map(Into::into));diff --git a/crates/theme_importer/src/main.rs b/crates/theme_importer/src/main.rsindex 765dd38ea97..661ac079aea 100644--- a/crates/theme_importer/src/main.rs+++ b/crates/theme_importer/src/main.rs@@ -1,6 +1,5 @@mod assets;mod color;-mod util;mod vscode;use std::fs::File;diff --git a/crates/theme_importer/src/util.rs b/crates/theme_importer/src/util.rsdeleted file mode 100644index a78d57ecde8..00000000000--- a/crates/theme_importer/src/util.rs+++ /dev/null@@ -1,11 +0,0 @@-use anyhow::Result;--pub trait Traverse<T, U> {- fn traverse(self, f: impl FnOnce(T) -> Result<U>) -> Result<Option<U>>;-}--impl<T, U> Traverse<T, U> for Option<T> {- fn traverse(self, f: impl FnOnce(T) -> Result<U>) -> Result<Option<U>> {- self.map_or(Ok(None), |value| f(value).map(Some))- }-}diff --git a/crates/workspace/src/toolbar.rs b/crates/workspace/src/toolbar.rsindex 0e2628aab49..fe5beba5e13 100644--- a/crates/workspace/src/toolbar.rs+++ b/crates/workspace/src/toolbar.rs@@ -18,13 +18,6 @@ pub trait ToolbarItemView: Render + EventEmitter<ToolbarItemEvent> {) -> ToolbarItemLocation;fn pane_focus_update(&mut self, _pane_focused: bool, _cx: &mut ViewContext<Self>) {}-- /// Number of times toolbar's height will be repeated to get the effective height.- /// Useful when multiple rows one under each other are needed.- /// The rows have the same width and act as a whole when reacting to resizes and similar events.- fn row_count(&self, _cx: &WindowContext) -> usize {- 1- }}trait ToolbarItemViewHandle: Send {@@ -36,7 +29,6 @@ trait ToolbarItemViewHandle: Send {cx: &mut WindowContext,) -> ToolbarItemLocation;fn focus_changed(&mut self, pane_focused: bool, cx: &mut WindowContext);- fn row_count(&self, cx: &WindowContext) -> usize;}#[derive(Copy, Clone, Debug, PartialEq)]@@ -239,8 +231,4 @@ impl<T: ToolbarItemView> ToolbarItemViewHandle for View<T> {cx.notify();});}-- fn row_count(&self, cx: &WindowContext) -> usize {- self.read(cx).row_count(cx)- }}diff --git a/crates/workspace/src/workspace.rs b/crates/workspace/src/workspace.rsindex dc08370447c..aab9a860c9d 100644--- a/crates/workspace/src/workspace.rs+++ b/crates/workspace/src/workspace.rs@@ -3322,7 +3322,7 @@ impl Workspace {}if &update.id != &self.last_active_view_id {- self.last_active_view_id = update.id.clone();+ self.last_active_view_id.clone_from(&update.id);self.update_followers(is_project_item,proto::update_followers::Variant::UpdateActiveView(update),diff --git a/crates/zed/src/reliability.rs b/crates/zed/src/reliability.rsindex b277235e6b6..29c78d916d6 100644--- a/crates/zed/src/reliability.rs+++ b/crates/zed/src/reliability.rs@@ -524,7 +524,7 @@ async fn upload_previous_crashes(}if uploaded < filename {- uploaded = filename.clone();+ uploaded.clone_from(&filename);KEY_VALUE_STORE.write_kvp(LAST_CRASH_UPLOADED.to_string(), filename).await?;diff --git a/rust-toolchain.toml b/rust-toolchain.tomlindex df6ae345903..f618116c84c 100644--- a/rust-toolchain.toml+++ b/rust-toolchain.toml@@ -1,5 +1,5 @@[toolchain]-channel = "1.77"+channel = "1.78"profile = "minimal"components = [ "rustfmt", "clippy" ]targets = [ "x86_64-apple-darwin", "aarch64-apple-darwin", "x86_64-unknown-linux-gnu", "wasm32-wasi" ]