chore: Bump Rust edition to 2024 (#27800)

Follow-up to https://github.com/zed-industries/zed/pull/27791

Release Notes:

- N/A
This commit is contained in:
Piotr Osiewicz 2025-03-31 20:55:27 +02:00 committed by GitHub
parent d50905e000
commit dc64ec9cc8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
802 changed files with 3775 additions and 3662 deletions

View file

@ -2,12 +2,12 @@ use std::sync::Arc;
use futures::StreamExt;
use gpui::{
actions, bounds, div, point,
prelude::{FluentBuilder as _, IntoElement},
px, rgb, size, AppContext as _, AsyncApp, Bounds, Context, Entity, InteractiveElement,
KeyBinding, Menu, MenuItem, ParentElement, Pixels, Render, ScreenCaptureStream, SharedString,
AppContext as _, AsyncApp, Bounds, Context, Entity, InteractiveElement, KeyBinding, Menu,
MenuItem, ParentElement, Pixels, Render, ScreenCaptureStream, SharedString,
StatefulInteractiveElement as _, Styled, Task, Window, WindowBounds, WindowHandle,
WindowOptions,
WindowOptions, actions, bounds, div, point,
prelude::{FluentBuilder as _, IntoElement},
px, rgb, size,
};
use livekit_client::{
AudioStream, LocalTrackPublication, Participant, ParticipantIdentity, RemoteParticipant,
@ -302,11 +302,7 @@ impl LivekitWindow {
cx: &mut Context<Self>,
) -> Option<()> {
let participant = self.remote_participants.iter().find_map(|(id, state)| {
if id == identity {
Some(state)
} else {
None
}
if id == identity { Some(state) } else { None }
})?;
let publication = &participant.audio_output_stream.as_ref()?.0;
publication.set_enabled(!publication.is_enabled(), cx);
@ -336,11 +332,7 @@ impl Render for LivekitWindow {
button()
.id("toggle-mute")
.child(if let Some(track) = &self.microphone_track {
if track.is_muted() {
"Unmute"
} else {
"Mute"
}
if track.is_muted() { "Unmute" } else { "Mute" }
} else {
"Publish mic"
})

View file

@ -2,7 +2,7 @@ use std::sync::Arc;
use anyhow::Result;
use collections::HashMap;
use futures::{channel::mpsc, SinkExt};
use futures::{SinkExt, channel::mpsc};
use gpui::{App, AsyncApp, ScreenCaptureSource, ScreenCaptureStream, Task};
use gpui_tokio::Tokio;
use playback::capture_local_video_track;
@ -11,7 +11,7 @@ mod playback;
use crate::{LocalTrack, Participant, RemoteTrack, RoomEvent, TrackPublication};
pub use playback::AudioStream;
pub(crate) use playback::{play_remote_video_track, RemoteVideoFrame};
pub(crate) use playback::{RemoteVideoFrame, play_remote_video_track};
#[derive(Clone, Debug)]
pub struct RemoteVideoTrack(livekit::track::RemoteVideoTrack);

View file

@ -1,4 +1,4 @@
use anyhow::{anyhow, Context as _, Result};
use anyhow::{Context as _, Result, anyhow};
use cpal::traits::{DeviceTrait, HostTrait, StreamTrait as _};
use futures::channel::mpsc::UnboundedSender;
@ -11,19 +11,19 @@ use livekit::track;
use livekit::webrtc::{
audio_frame::AudioFrame,
audio_source::{native::NativeAudioSource, AudioSourceOptions, RtcAudioSource},
audio_source::{AudioSourceOptions, RtcAudioSource, native::NativeAudioSource},
audio_stream::native::NativeAudioStream,
video_frame::{VideoBuffer, VideoFrame, VideoRotation},
video_source::{native::NativeVideoSource, RtcVideoSource, VideoResolution},
video_source::{RtcVideoSource, VideoResolution, native::NativeVideoSource},
video_stream::native::NativeVideoStream,
};
use parking_lot::Mutex;
use std::cell::RefCell;
use std::sync::atomic::{self, AtomicI32};
use std::sync::Weak;
use std::sync::atomic::{self, AtomicI32};
use std::time::Duration;
use std::{borrow::Cow, collections::VecDeque, sync::Arc, thread};
use util::{maybe, ResultExt as _};
use util::{ResultExt as _, maybe};
pub(crate) struct AudioStack {
executor: BackgroundExecutor,
@ -576,7 +576,7 @@ fn video_frame_buffer_from_webrtc(buffer: Box<dyn VideoBuffer>) -> Option<Remote
use image::{Frame, RgbaImage};
use livekit::webrtc::prelude::VideoFormatType;
use smallvec::SmallVec;
use std::alloc::{alloc, Layout};
use std::alloc::{Layout, alloc};
let width = buffer.width();
let height = buffer.height();
@ -634,12 +634,12 @@ trait DeviceChangeListenerApi: Stream<Item = ()> + Sized {
mod macos {
use coreaudio::sys::{
kAudioHardwarePropertyDefaultInputDevice, kAudioHardwarePropertyDefaultOutputDevice,
kAudioObjectPropertyElementMaster, kAudioObjectPropertyScopeGlobal,
kAudioObjectSystemObject, AudioObjectAddPropertyListener, AudioObjectID,
AudioObjectPropertyAddress, AudioObjectRemovePropertyListener, OSStatus,
AudioObjectAddPropertyListener, AudioObjectID, AudioObjectPropertyAddress,
AudioObjectRemovePropertyListener, OSStatus, kAudioHardwarePropertyDefaultInputDevice,
kAudioHardwarePropertyDefaultOutputDevice, kAudioObjectPropertyElementMaster,
kAudioObjectPropertyScopeGlobal, kAudioObjectSystemObject,
};
use futures::{channel::mpsc::UnboundedReceiver, StreamExt};
use futures::{StreamExt, channel::mpsc::UnboundedReceiver};
/// Implementation from: https://github.com/zed-industries/cpal/blob/fd8bc2fd39f1f5fdee5a0690656caff9a26d9d50/src/host/coreaudio/macos/property_listener.rs#L15
pub struct CoreAudioDefaultDeviceChangeListener {

View file

@ -1,7 +1,7 @@
use crate::{
test::{Room, WeakRoom},
AudioStream, LocalAudioTrack, LocalTrackPublication, LocalVideoTrack, Participant,
ParticipantIdentity, RemoteTrack, RemoteTrackPublication, TrackSid,
test::{Room, WeakRoom},
};
use anyhow::Result;
use collections::HashMap;

View file

@ -1,6 +1,6 @@
use gpui::App;
use crate::{test::WeakRoom, RemoteTrack, TrackSid};
use crate::{RemoteTrack, TrackSid, test::WeakRoom};
#[derive(Clone, Debug)]
pub struct LocalTrackPublication {

View file

@ -1,8 +1,8 @@
use std::sync::Arc;
use crate::{
test::{TestServerAudioTrack, TestServerVideoTrack, WeakRoom},
ParticipantIdentity, TrackSid,
test::{TestServerAudioTrack, TestServerVideoTrack, WeakRoom},
};
#[derive(Clone, Debug)]

View file

@ -1,16 +1,16 @@
use crate::{AudioStream, Participant, RemoteTrack, RoomEvent, TrackPublication};
use crate::mock_client::{participant::*, publication::*, track::*};
use anyhow::{anyhow, Context as _, Result};
use anyhow::{Context as _, Result, anyhow};
use async_trait::async_trait;
use collections::{btree_map::Entry as BTreeEntry, hash_map::Entry, BTreeMap, HashMap, HashSet};
use collections::{BTreeMap, HashMap, HashSet, btree_map::Entry as BTreeEntry, hash_map::Entry};
use gpui::{App, AsyncApp, BackgroundExecutor};
use livekit_api::{proto, token};
use parking_lot::Mutex;
use postage::{mpsc, sink::Sink};
use std::sync::{
atomic::{AtomicBool, Ordering::SeqCst},
Arc, Weak,
atomic::{AtomicBool, Ordering::SeqCst},
};
#[derive(Clone, Debug, Eq, Hash, PartialEq, PartialOrd, Ord)]