mirror of
https://github.com/zed-industries/zed.git
synced 2024-09-19 02:17:35 +03:00
chore: Fix clippy violations from Cargo.toml (#15216)
/cc @maxdeviant Release Notes: - N/A
This commit is contained in:
parent
d755d29577
commit
86456ce379
@ -537,13 +537,6 @@ single_range_in_vec_init = "allow"
|
|||||||
style = { level = "allow", priority = -1 }
|
style = { level = "allow", priority = -1 }
|
||||||
|
|
||||||
# Individual rules that have violations in the codebase:
|
# Individual rules that have violations in the codebase:
|
||||||
almost_complete_range = "allow"
|
|
||||||
arc_with_non_send_sync = "allow"
|
|
||||||
borrowed_box = "allow"
|
|
||||||
let_underscore_future = "allow"
|
|
||||||
map_entry = "allow"
|
|
||||||
non_canonical_partial_ord_impl = "allow"
|
|
||||||
reversed_empty_ranges = "allow"
|
|
||||||
type_complexity = "allow"
|
type_complexity = "allow"
|
||||||
|
|
||||||
[workspace.metadata.cargo-machete]
|
[workspace.metadata.cargo-machete]
|
||||||
|
@ -219,7 +219,7 @@ impl SlashCommand for DocsSlashCommand {
|
|||||||
if index {
|
if index {
|
||||||
// We don't need to hold onto this task, as the `IndexedDocsStore` will hold it
|
// We don't need to hold onto this task, as the `IndexedDocsStore` will hold it
|
||||||
// until it completes.
|
// until it completes.
|
||||||
let _ = store.clone().index(package.as_str().into());
|
drop(store.clone().index(package.as_str().into()));
|
||||||
}
|
}
|
||||||
|
|
||||||
let items = store.search(package).await;
|
let items = store.search(package).await;
|
||||||
|
@ -493,7 +493,7 @@ impl Room {
|
|||||||
// we leave the room and return an error.
|
// we leave the room and return an error.
|
||||||
if let Some(this) = this.upgrade() {
|
if let Some(this) = this.upgrade() {
|
||||||
log::info!("reconnection failed, leaving room");
|
log::info!("reconnection failed, leaving room");
|
||||||
let _ = this.update(&mut cx, |this, cx| this.leave(cx))?;
|
let _ = this.update(&mut cx, |this, cx| this.leave(cx))?.await?;
|
||||||
}
|
}
|
||||||
Err(anyhow!(
|
Err(anyhow!(
|
||||||
"can't reconnect to room: client failed to re-establish connection"
|
"can't reconnect to room: client failed to re-establish connection"
|
||||||
@ -942,7 +942,7 @@ impl Room {
|
|||||||
this.pending_room_update.take();
|
this.pending_room_update.take();
|
||||||
if this.should_leave() {
|
if this.should_leave() {
|
||||||
log::info!("room is empty, leaving");
|
log::info!("room is empty, leaving");
|
||||||
let _ = this.leave(cx);
|
let _ = this.leave(cx).detach();
|
||||||
}
|
}
|
||||||
|
|
||||||
this.user_store.update(cx, |user_store, cx| {
|
this.user_store.update(cx, |user_store, cx| {
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
#![allow(clippy::reversed_empty_ranges)]
|
||||||
use crate::{rpc::RECONNECT_TIMEOUT, tests::TestServer};
|
use crate::{rpc::RECONNECT_TIMEOUT, tests::TestServer};
|
||||||
use call::{ActiveCall, ParticipantLocation};
|
use call::{ActiveCall, ParticipantLocation};
|
||||||
use client::ChannelId;
|
use client::ChannelId;
|
||||||
|
@ -691,7 +691,7 @@ impl Copilot {
|
|||||||
{
|
{
|
||||||
match event {
|
match event {
|
||||||
language::Event::Edited => {
|
language::Event::Edited => {
|
||||||
let _ = registered_buffer.report_changes(&buffer, cx);
|
drop(registered_buffer.report_changes(&buffer, cx));
|
||||||
}
|
}
|
||||||
language::Event::Saved => {
|
language::Event::Saved => {
|
||||||
server
|
server
|
||||||
|
@ -333,7 +333,7 @@ mod tests {
|
|||||||
three
|
three
|
||||||
"});
|
"});
|
||||||
cx.simulate_keystroke(".");
|
cx.simulate_keystroke(".");
|
||||||
let _ = handle_completion_request(
|
drop(handle_completion_request(
|
||||||
&mut cx,
|
&mut cx,
|
||||||
indoc! {"
|
indoc! {"
|
||||||
one.|<>
|
one.|<>
|
||||||
@ -341,7 +341,7 @@ mod tests {
|
|||||||
three
|
three
|
||||||
"},
|
"},
|
||||||
vec!["completion_a", "completion_b"],
|
vec!["completion_a", "completion_b"],
|
||||||
);
|
));
|
||||||
handle_copilot_completion_request(
|
handle_copilot_completion_request(
|
||||||
&copilot_lsp,
|
&copilot_lsp,
|
||||||
vec![crate::request::Completion {
|
vec![crate::request::Completion {
|
||||||
@ -375,7 +375,7 @@ mod tests {
|
|||||||
three
|
three
|
||||||
"});
|
"});
|
||||||
cx.simulate_keystroke(".");
|
cx.simulate_keystroke(".");
|
||||||
let _ = handle_completion_request(
|
drop(handle_completion_request(
|
||||||
&mut cx,
|
&mut cx,
|
||||||
indoc! {"
|
indoc! {"
|
||||||
one.|<>
|
one.|<>
|
||||||
@ -383,7 +383,7 @@ mod tests {
|
|||||||
three
|
three
|
||||||
"},
|
"},
|
||||||
vec![],
|
vec![],
|
||||||
);
|
));
|
||||||
handle_copilot_completion_request(
|
handle_copilot_completion_request(
|
||||||
&copilot_lsp,
|
&copilot_lsp,
|
||||||
vec![crate::request::Completion {
|
vec![crate::request::Completion {
|
||||||
@ -408,7 +408,7 @@ mod tests {
|
|||||||
three
|
three
|
||||||
"});
|
"});
|
||||||
cx.simulate_keystroke(".");
|
cx.simulate_keystroke(".");
|
||||||
let _ = handle_completion_request(
|
drop(handle_completion_request(
|
||||||
&mut cx,
|
&mut cx,
|
||||||
indoc! {"
|
indoc! {"
|
||||||
one.|<>
|
one.|<>
|
||||||
@ -416,7 +416,7 @@ mod tests {
|
|||||||
three
|
three
|
||||||
"},
|
"},
|
||||||
vec!["completion_a", "completion_b"],
|
vec!["completion_a", "completion_b"],
|
||||||
);
|
));
|
||||||
handle_copilot_completion_request(
|
handle_copilot_completion_request(
|
||||||
&copilot_lsp,
|
&copilot_lsp,
|
||||||
vec![crate::request::Completion {
|
vec![crate::request::Completion {
|
||||||
@ -590,7 +590,7 @@ mod tests {
|
|||||||
three
|
three
|
||||||
"});
|
"});
|
||||||
cx.simulate_keystroke(".");
|
cx.simulate_keystroke(".");
|
||||||
let _ = handle_completion_request(
|
drop(handle_completion_request(
|
||||||
&mut cx,
|
&mut cx,
|
||||||
indoc! {"
|
indoc! {"
|
||||||
one.|<>
|
one.|<>
|
||||||
@ -598,7 +598,7 @@ mod tests {
|
|||||||
three
|
three
|
||||||
"},
|
"},
|
||||||
vec![],
|
vec![],
|
||||||
);
|
));
|
||||||
handle_copilot_completion_request(
|
handle_copilot_completion_request(
|
||||||
&copilot_lsp,
|
&copilot_lsp,
|
||||||
vec![crate::request::Completion {
|
vec![crate::request::Completion {
|
||||||
@ -632,7 +632,7 @@ mod tests {
|
|||||||
three
|
three
|
||||||
"});
|
"});
|
||||||
cx.simulate_keystroke(".");
|
cx.simulate_keystroke(".");
|
||||||
let _ = handle_completion_request(
|
drop(handle_completion_request(
|
||||||
&mut cx,
|
&mut cx,
|
||||||
indoc! {"
|
indoc! {"
|
||||||
one.|<>
|
one.|<>
|
||||||
@ -640,7 +640,7 @@ mod tests {
|
|||||||
three
|
three
|
||||||
"},
|
"},
|
||||||
vec![],
|
vec![],
|
||||||
);
|
));
|
||||||
handle_copilot_completion_request(
|
handle_copilot_completion_request(
|
||||||
&copilot_lsp,
|
&copilot_lsp,
|
||||||
vec![crate::request::Completion {
|
vec![crate::request::Completion {
|
||||||
@ -889,7 +889,7 @@ mod tests {
|
|||||||
three
|
three
|
||||||
"});
|
"});
|
||||||
|
|
||||||
let _ = handle_completion_request(
|
drop(handle_completion_request(
|
||||||
&mut cx,
|
&mut cx,
|
||||||
indoc! {"
|
indoc! {"
|
||||||
one
|
one
|
||||||
@ -897,7 +897,7 @@ mod tests {
|
|||||||
three
|
three
|
||||||
"},
|
"},
|
||||||
vec!["completion_a", "completion_b"],
|
vec!["completion_a", "completion_b"],
|
||||||
);
|
));
|
||||||
handle_copilot_completion_request(
|
handle_copilot_completion_request(
|
||||||
&copilot_lsp,
|
&copilot_lsp,
|
||||||
vec![crate::request::Completion {
|
vec![crate::request::Completion {
|
||||||
@ -917,7 +917,7 @@ mod tests {
|
|||||||
});
|
});
|
||||||
|
|
||||||
cx.simulate_keystroke("o");
|
cx.simulate_keystroke("o");
|
||||||
let _ = handle_completion_request(
|
drop(handle_completion_request(
|
||||||
&mut cx,
|
&mut cx,
|
||||||
indoc! {"
|
indoc! {"
|
||||||
one
|
one
|
||||||
@ -925,7 +925,7 @@ mod tests {
|
|||||||
three
|
three
|
||||||
"},
|
"},
|
||||||
vec!["completion_a_2", "completion_b_2"],
|
vec!["completion_a_2", "completion_b_2"],
|
||||||
);
|
));
|
||||||
handle_copilot_completion_request(
|
handle_copilot_completion_request(
|
||||||
&copilot_lsp,
|
&copilot_lsp,
|
||||||
vec![crate::request::Completion {
|
vec![crate::request::Completion {
|
||||||
@ -944,7 +944,7 @@ mod tests {
|
|||||||
});
|
});
|
||||||
|
|
||||||
cx.simulate_keystroke(".");
|
cx.simulate_keystroke(".");
|
||||||
let _ = handle_completion_request(
|
drop(handle_completion_request(
|
||||||
&mut cx,
|
&mut cx,
|
||||||
indoc! {"
|
indoc! {"
|
||||||
one
|
one
|
||||||
@ -952,7 +952,7 @@ mod tests {
|
|||||||
three
|
three
|
||||||
"},
|
"},
|
||||||
vec!["something_else()"],
|
vec!["something_else()"],
|
||||||
);
|
));
|
||||||
handle_copilot_completion_request(
|
handle_copilot_completion_request(
|
||||||
&copilot_lsp,
|
&copilot_lsp,
|
||||||
vec![crate::request::Completion {
|
vec![crate::request::Completion {
|
||||||
|
@ -59,6 +59,7 @@ use std::{
|
|||||||
fmt::{self, Write},
|
fmt::{self, Write},
|
||||||
iter, mem,
|
iter, mem,
|
||||||
ops::{Deref, Range},
|
ops::{Deref, Range},
|
||||||
|
rc::Rc,
|
||||||
sync::Arc,
|
sync::Arc,
|
||||||
};
|
};
|
||||||
use sum_tree::Bias;
|
use sum_tree::Bias;
|
||||||
@ -5492,7 +5493,7 @@ impl Element for EditorElement {
|
|||||||
|
|
||||||
EditorLayout {
|
EditorLayout {
|
||||||
mode: snapshot.mode,
|
mode: snapshot.mode,
|
||||||
position_map: Arc::new(PositionMap {
|
position_map: Rc::new(PositionMap {
|
||||||
size: bounds.size,
|
size: bounds.size,
|
||||||
scroll_pixel_position,
|
scroll_pixel_position,
|
||||||
scroll_max,
|
scroll_max,
|
||||||
@ -5642,7 +5643,7 @@ impl IntoElement for EditorElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub struct EditorLayout {
|
pub struct EditorLayout {
|
||||||
position_map: Arc<PositionMap>,
|
position_map: Rc<PositionMap>,
|
||||||
hitbox: Hitbox,
|
hitbox: Hitbox,
|
||||||
text_hitbox: Hitbox,
|
text_hitbox: Hitbox,
|
||||||
gutter_hitbox: Hitbox,
|
gutter_hitbox: Hitbox,
|
||||||
|
@ -363,6 +363,7 @@ async fn test_extension_store(cx: &mut TestAppContext) {
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
|
#[allow(clippy::let_underscore_future)]
|
||||||
let _ = store.update(cx, |store, cx| store.reload(None, cx));
|
let _ = store.update(cx, |store, cx| store.reload(None, cx));
|
||||||
|
|
||||||
cx.executor().advance_clock(RELOAD_DEBOUNCE_DURATION);
|
cx.executor().advance_clock(RELOAD_DEBOUNCE_DURATION);
|
||||||
|
@ -323,14 +323,14 @@ impl Interactivity {
|
|||||||
pub fn on_boxed_action(
|
pub fn on_boxed_action(
|
||||||
&mut self,
|
&mut self,
|
||||||
action: &dyn Action,
|
action: &dyn Action,
|
||||||
listener: impl Fn(&Box<dyn Action>, &mut WindowContext) + 'static,
|
listener: impl Fn(&dyn Action, &mut WindowContext) + 'static,
|
||||||
) {
|
) {
|
||||||
let action = action.boxed_clone();
|
let action = action.boxed_clone();
|
||||||
self.action_listeners.push((
|
self.action_listeners.push((
|
||||||
(*action).type_id(),
|
(*action).type_id(),
|
||||||
Box::new(move |_, phase, cx| {
|
Box::new(move |_, phase, cx| {
|
||||||
if phase == DispatchPhase::Bubble {
|
if phase == DispatchPhase::Bubble {
|
||||||
(listener)(&action, cx)
|
(listener)(&*action, cx)
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
));
|
));
|
||||||
@ -757,7 +757,7 @@ pub trait InteractiveElement: Sized {
|
|||||||
fn on_boxed_action(
|
fn on_boxed_action(
|
||||||
mut self,
|
mut self,
|
||||||
action: &dyn Action,
|
action: &dyn Action,
|
||||||
listener: impl Fn(&Box<dyn Action>, &mut WindowContext) + 'static,
|
listener: impl Fn(&dyn Action, &mut WindowContext) + 'static,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
self.interactivity().on_boxed_action(action, listener);
|
self.interactivity().on_boxed_action(action, listener);
|
||||||
self
|
self
|
||||||
|
@ -115,7 +115,7 @@ impl TestPlatform {
|
|||||||
.spawn(async move {
|
.spawn(async move {
|
||||||
if let Some(previous_window) = previous_window {
|
if let Some(previous_window) = previous_window {
|
||||||
if let Some(window) = window.as_ref() {
|
if let Some(window) = window.as_ref() {
|
||||||
if Arc::ptr_eq(&previous_window.0, &window.0) {
|
if Rc::ptr_eq(&previous_window.0, &window.0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,7 @@ pub(crate) struct TestWindowState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub(crate) struct TestWindow(pub(crate) Arc<Mutex<TestWindowState>>);
|
pub(crate) struct TestWindow(pub(crate) Rc<Mutex<TestWindowState>>);
|
||||||
|
|
||||||
impl HasWindowHandle for TestWindow {
|
impl HasWindowHandle for TestWindow {
|
||||||
fn window_handle(
|
fn window_handle(
|
||||||
@ -56,7 +56,7 @@ impl TestWindow {
|
|||||||
platform: Weak<TestPlatform>,
|
platform: Weak<TestPlatform>,
|
||||||
display: Rc<dyn PlatformDisplay>,
|
display: Rc<dyn PlatformDisplay>,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
Self(Arc::new(Mutex::new(TestWindowState {
|
Self(Rc::new(Mutex::new(TestWindowState {
|
||||||
bounds: params.bounds,
|
bounds: params.bounds,
|
||||||
display,
|
display,
|
||||||
platform,
|
platform,
|
||||||
|
@ -4419,7 +4419,7 @@ impl<'a, V: 'static> ViewContext<'a, V> {
|
|||||||
/// Many GPUI callbacks take the form of `Fn(&E, &mut WindowContext)`,
|
/// Many GPUI callbacks take the form of `Fn(&E, &mut WindowContext)`,
|
||||||
/// but it's often useful to be able to access view state in these
|
/// but it's often useful to be able to access view state in these
|
||||||
/// callbacks. This method provides a convenient way to do so.
|
/// callbacks. This method provides a convenient way to do so.
|
||||||
pub fn listener<E>(
|
pub fn listener<E: ?Sized>(
|
||||||
&self,
|
&self,
|
||||||
f: impl Fn(&mut V, &E, &mut ViewContext<V>) + 'static,
|
f: impl Fn(&mut V, &E, &mut ViewContext<V>) + 'static,
|
||||||
) -> impl Fn(&E, &mut WindowContext) + 'static {
|
) -> impl Fn(&E, &mut WindowContext) + 'static {
|
||||||
|
@ -2463,7 +2463,7 @@ fn test_trailing_whitespace_ranges(mut rng: StdRng) {
|
|||||||
text.push(match rng.gen_range(0..10) {
|
text.push(match rng.gen_range(0..10) {
|
||||||
0..=1 => ' ',
|
0..=1 => ' ',
|
||||||
3 => '\t',
|
3 => '\t',
|
||||||
_ => rng.gen_range('a'..'z'),
|
_ => rng.gen_range('a'..='z'),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
text.push('\n');
|
text.push('\n');
|
||||||
|
@ -1334,7 +1334,7 @@ pub(crate) fn splice_included_ranges(
|
|||||||
let mut removed_ranges = removed_ranges.iter().cloned().peekable();
|
let mut removed_ranges = removed_ranges.iter().cloned().peekable();
|
||||||
let mut new_ranges = new_ranges.into_iter().cloned().peekable();
|
let mut new_ranges = new_ranges.into_iter().cloned().peekable();
|
||||||
let mut ranges_ix = 0;
|
let mut ranges_ix = 0;
|
||||||
let mut changed_portion = usize::MAX..0;
|
let mut changed_portion: Option<Range<usize>> = None;
|
||||||
loop {
|
loop {
|
||||||
let next_new_range = new_ranges.peek();
|
let next_new_range = new_ranges.peek();
|
||||||
let next_removed_range = removed_ranges.peek();
|
let next_removed_range = removed_ranges.peek();
|
||||||
@ -1395,23 +1395,26 @@ pub(crate) fn splice_included_ranges(
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
let changed_start = changed_portion
|
||||||
changed_portion.start = changed_portion.start.min(start_ix);
|
.as_ref()
|
||||||
changed_portion.end = changed_portion.end.max(if insert.is_some() {
|
.map_or(usize::MAX, |range| range.start)
|
||||||
start_ix + 1
|
.min(start_ix);
|
||||||
} else {
|
let changed_end =
|
||||||
start_ix
|
changed_portion
|
||||||
});
|
.as_ref()
|
||||||
|
.map_or(0, |range| range.end)
|
||||||
|
.max(if insert.is_some() {
|
||||||
|
start_ix + 1
|
||||||
|
} else {
|
||||||
|
start_ix
|
||||||
|
});
|
||||||
|
changed_portion = Some(changed_start..changed_end);
|
||||||
|
|
||||||
ranges.splice(start_ix..end_ix, insert);
|
ranges.splice(start_ix..end_ix, insert);
|
||||||
ranges_ix = start_ix;
|
ranges_ix = start_ix;
|
||||||
}
|
}
|
||||||
|
|
||||||
if changed_portion.end < changed_portion.start {
|
(ranges, changed_portion.unwrap_or(0..0))
|
||||||
changed_portion = 0..0;
|
|
||||||
}
|
|
||||||
|
|
||||||
(ranges, changed_portion)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Ensure there are newline ranges in between content range that appear on
|
/// Ensure there are newline ranges in between content range that appear on
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
use crate::{ConnectionState, RoomUpdate, Sid};
|
use crate::{ConnectionState, RoomUpdate, Sid};
|
||||||
use anyhow::{anyhow, Context, Result};
|
use anyhow::{anyhow, Context, Result};
|
||||||
use async_trait::async_trait;
|
use async_trait::async_trait;
|
||||||
use collections::{BTreeMap, HashMap, HashSet};
|
use collections::{btree_map::Entry as BTreeEntry, hash_map::Entry, BTreeMap, HashMap, HashSet};
|
||||||
use futures::Stream;
|
use futures::Stream;
|
||||||
use gpui::{BackgroundExecutor, ImageSource};
|
use gpui::{BackgroundExecutor, ImageSource};
|
||||||
use live_kit_server::{proto, token};
|
use live_kit_server::{proto, token};
|
||||||
@ -35,18 +35,18 @@ impl TestServer {
|
|||||||
executor: BackgroundExecutor,
|
executor: BackgroundExecutor,
|
||||||
) -> Result<Arc<TestServer>> {
|
) -> Result<Arc<TestServer>> {
|
||||||
let mut servers = SERVERS.lock();
|
let mut servers = SERVERS.lock();
|
||||||
if servers.contains_key(&url) {
|
if let BTreeEntry::Vacant(e) = servers.entry(url.clone()) {
|
||||||
Err(anyhow!("a server with url {:?} already exists", url))
|
|
||||||
} else {
|
|
||||||
let server = Arc::new(TestServer {
|
let server = Arc::new(TestServer {
|
||||||
url: url.clone(),
|
url,
|
||||||
api_key,
|
api_key,
|
||||||
secret_key,
|
secret_key,
|
||||||
rooms: Default::default(),
|
rooms: Default::default(),
|
||||||
executor,
|
executor,
|
||||||
});
|
});
|
||||||
servers.insert(url, server.clone());
|
e.insert(server.clone());
|
||||||
Ok(server)
|
Ok(server)
|
||||||
|
} else {
|
||||||
|
Err(anyhow!("a server with url {:?} already exists", url))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -77,11 +77,11 @@ impl TestServer {
|
|||||||
#[cfg(any(test, feature = "test-support"))]
|
#[cfg(any(test, feature = "test-support"))]
|
||||||
self.executor.simulate_random_delay().await;
|
self.executor.simulate_random_delay().await;
|
||||||
let mut server_rooms = self.rooms.lock();
|
let mut server_rooms = self.rooms.lock();
|
||||||
if server_rooms.contains_key(&room) {
|
if let Entry::Vacant(e) = server_rooms.entry(room.clone()) {
|
||||||
Err(anyhow!("room {:?} already exists", room))
|
e.insert(Default::default());
|
||||||
} else {
|
|
||||||
server_rooms.insert(room, Default::default());
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
} else {
|
||||||
|
Err(anyhow!("room {:?} already exists", room))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -108,13 +108,7 @@ impl TestServer {
|
|||||||
let mut server_rooms = self.rooms.lock();
|
let mut server_rooms = self.rooms.lock();
|
||||||
let room = (*server_rooms).entry(room_name.to_string()).or_default();
|
let room = (*server_rooms).entry(room_name.to_string()).or_default();
|
||||||
|
|
||||||
if room.client_rooms.contains_key(&identity) {
|
if let Entry::Vacant(e) = room.client_rooms.entry(identity.clone()) {
|
||||||
Err(anyhow!(
|
|
||||||
"{:?} attempted to join room {:?} twice",
|
|
||||||
identity,
|
|
||||||
room_name
|
|
||||||
))
|
|
||||||
} else {
|
|
||||||
for track in &room.video_tracks {
|
for track in &room.video_tracks {
|
||||||
client_room
|
client_room
|
||||||
.0
|
.0
|
||||||
@ -141,8 +135,14 @@ impl TestServer {
|
|||||||
))
|
))
|
||||||
.unwrap();
|
.unwrap();
|
||||||
}
|
}
|
||||||
room.client_rooms.insert(identity, client_room);
|
e.insert(client_room);
|
||||||
Ok(())
|
Ok(())
|
||||||
|
} else {
|
||||||
|
Err(anyhow!(
|
||||||
|
"{:?} attempted to join room {:?} twice",
|
||||||
|
identity,
|
||||||
|
room_name
|
||||||
|
))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -500,8 +500,8 @@ impl<'a> MarkdownParser<'a> {
|
|||||||
|
|
||||||
// We will use the start of the nested list as the end for the current item's range,
|
// We will use the start of the nested list as the end for the current item's range,
|
||||||
// because we don't care about the hierarchy of list items
|
// because we don't care about the hierarchy of list items
|
||||||
if !source_ranges.contains_key(&depth) {
|
if let collections::hash_map::Entry::Vacant(e) = source_ranges.entry(depth) {
|
||||||
source_ranges.insert(depth, start_item_range.start..source_range.start);
|
e.insert(start_item_range.start..source_range.start);
|
||||||
}
|
}
|
||||||
|
|
||||||
order_stack.push(order);
|
order_stack.push(order);
|
||||||
|
@ -437,7 +437,7 @@ impl ToolbarItemView for BufferSearchBar {
|
|||||||
));
|
));
|
||||||
|
|
||||||
self.active_searchable_item = Some(searchable_item_handle);
|
self.active_searchable_item = Some(searchable_item_handle);
|
||||||
let _ = self.update_matches(cx);
|
drop(self.update_matches(cx));
|
||||||
if !self.dismissed {
|
if !self.dismissed {
|
||||||
return ToolbarItemLocation::Secondary;
|
return ToolbarItemLocation::Secondary;
|
||||||
}
|
}
|
||||||
@ -719,7 +719,7 @@ impl BufferSearchBar {
|
|||||||
fn toggle_search_option(&mut self, search_option: SearchOptions, cx: &mut ViewContext<Self>) {
|
fn toggle_search_option(&mut self, search_option: SearchOptions, cx: &mut ViewContext<Self>) {
|
||||||
self.search_options.toggle(search_option);
|
self.search_options.toggle(search_option);
|
||||||
self.default_options = self.search_options;
|
self.default_options = self.search_options;
|
||||||
let _ = self.update_matches(cx);
|
drop(self.update_matches(cx));
|
||||||
cx.notify();
|
cx.notify();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -856,7 +856,7 @@ impl BufferSearchBar {
|
|||||||
fn on_active_searchable_item_event(&mut self, event: &SearchEvent, cx: &mut ViewContext<Self>) {
|
fn on_active_searchable_item_event(&mut self, event: &SearchEvent, cx: &mut ViewContext<Self>) {
|
||||||
match event {
|
match event {
|
||||||
SearchEvent::MatchesInvalidated => {
|
SearchEvent::MatchesInvalidated => {
|
||||||
let _ = self.update_matches(cx);
|
drop(self.update_matches(cx));
|
||||||
}
|
}
|
||||||
SearchEvent::ActiveMatchChanged => self.update_match_index(cx),
|
SearchEvent::ActiveMatchChanged => self.update_match_index(cx),
|
||||||
}
|
}
|
||||||
@ -874,7 +874,7 @@ impl BufferSearchBar {
|
|||||||
if let Some(active_item) = self.active_searchable_item.as_mut() {
|
if let Some(active_item) = self.active_searchable_item.as_mut() {
|
||||||
self.selection_search_enabled = !self.selection_search_enabled;
|
self.selection_search_enabled = !self.selection_search_enabled;
|
||||||
active_item.toggle_filtered_search_ranges(self.selection_search_enabled, cx);
|
active_item.toggle_filtered_search_ranges(self.selection_search_enabled, cx);
|
||||||
let _ = self.update_matches(cx);
|
drop(self.update_matches(cx));
|
||||||
cx.notify();
|
cx.notify();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1047,10 +1047,10 @@ impl BufferSearchBar {
|
|||||||
.next(&mut self.search_history_cursor)
|
.next(&mut self.search_history_cursor)
|
||||||
.map(str::to_string)
|
.map(str::to_string)
|
||||||
{
|
{
|
||||||
let _ = self.search(&new_query, Some(self.search_options), cx);
|
drop(self.search(&new_query, Some(self.search_options), cx));
|
||||||
} else {
|
} else {
|
||||||
self.search_history_cursor.reset();
|
self.search_history_cursor.reset();
|
||||||
let _ = self.search("", Some(self.search_options), cx);
|
drop(self.search("", Some(self.search_options), cx));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1061,7 +1061,7 @@ impl BufferSearchBar {
|
|||||||
.current(&mut self.search_history_cursor)
|
.current(&mut self.search_history_cursor)
|
||||||
.map(str::to_string)
|
.map(str::to_string)
|
||||||
{
|
{
|
||||||
let _ = self.search(&new_query, Some(self.search_options), cx);
|
drop(self.search(&new_query, Some(self.search_options), cx));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1071,7 +1071,7 @@ impl BufferSearchBar {
|
|||||||
.previous(&mut self.search_history_cursor)
|
.previous(&mut self.search_history_cursor)
|
||||||
.map(str::to_string)
|
.map(str::to_string)
|
||||||
{
|
{
|
||||||
let _ = self.search(&new_query, Some(self.search_options), cx);
|
drop(self.search(&new_query, Some(self.search_options), cx));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1192,7 +1192,7 @@ mod tests {
|
|||||||
Err(anyhow!("cannot embed text containing a 'g' character"))
|
Err(anyhow!("cannot embed text containing a 'g' character"))
|
||||||
} else {
|
} else {
|
||||||
Ok(Embedding::new(
|
Ok(Embedding::new(
|
||||||
('a'..'z')
|
('a'..='z')
|
||||||
.map(|char| text.chars().filter(|c| *c == char).count() as f32)
|
.map(|char| text.chars().filter(|c| *c == char).count() as f32)
|
||||||
.collect(),
|
.collect(),
|
||||||
))
|
))
|
||||||
|
@ -27,8 +27,8 @@ use theme::{ActiveTheme, Theme, ThemeSettings};
|
|||||||
use ui::{ParentElement, Tooltip};
|
use ui::{ParentElement, Tooltip};
|
||||||
use workspace::Workspace;
|
use workspace::Workspace;
|
||||||
|
|
||||||
use std::{fmt::Debug, ops::RangeInclusive};
|
use std::mem;
|
||||||
use std::{mem, sync::Arc};
|
use std::{fmt::Debug, ops::RangeInclusive, rc::Rc};
|
||||||
|
|
||||||
use crate::{BlockContext, BlockProperties, TerminalView};
|
use crate::{BlockContext, BlockProperties, TerminalView};
|
||||||
|
|
||||||
@ -156,7 +156,7 @@ pub struct TerminalElement {
|
|||||||
cursor_visible: bool,
|
cursor_visible: bool,
|
||||||
can_navigate_to_selected_word: bool,
|
can_navigate_to_selected_word: bool,
|
||||||
interactivity: Interactivity,
|
interactivity: Interactivity,
|
||||||
block_below_cursor: Option<Arc<BlockProperties>>,
|
block_below_cursor: Option<Rc<BlockProperties>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl InteractiveElement for TerminalElement {
|
impl InteractiveElement for TerminalElement {
|
||||||
@ -177,7 +177,7 @@ impl TerminalElement {
|
|||||||
focused: bool,
|
focused: bool,
|
||||||
cursor_visible: bool,
|
cursor_visible: bool,
|
||||||
can_navigate_to_selected_word: bool,
|
can_navigate_to_selected_word: bool,
|
||||||
block_below_cursor: Option<Arc<BlockProperties>>,
|
block_below_cursor: Option<Rc<BlockProperties>>,
|
||||||
) -> TerminalElement {
|
) -> TerminalElement {
|
||||||
TerminalElement {
|
TerminalElement {
|
||||||
terminal,
|
terminal,
|
||||||
|
@ -47,6 +47,7 @@ use std::{
|
|||||||
cmp,
|
cmp,
|
||||||
ops::RangeInclusive,
|
ops::RangeInclusive,
|
||||||
path::{Path, PathBuf},
|
path::{Path, PathBuf},
|
||||||
|
rc::Rc,
|
||||||
sync::Arc,
|
sync::Arc,
|
||||||
time::Duration,
|
time::Duration,
|
||||||
};
|
};
|
||||||
@ -106,7 +107,7 @@ pub struct TerminalView {
|
|||||||
can_navigate_to_selected_word: bool,
|
can_navigate_to_selected_word: bool,
|
||||||
workspace_id: Option<WorkspaceId>,
|
workspace_id: Option<WorkspaceId>,
|
||||||
show_title: bool,
|
show_title: bool,
|
||||||
block_below_cursor: Option<Arc<BlockProperties>>,
|
block_below_cursor: Option<Rc<BlockProperties>>,
|
||||||
scroll_top: Pixels,
|
scroll_top: Pixels,
|
||||||
_subscriptions: Vec<Subscription>,
|
_subscriptions: Vec<Subscription>,
|
||||||
_terminal_subscriptions: Vec<Subscription>,
|
_terminal_subscriptions: Vec<Subscription>,
|
||||||
@ -459,7 +460,7 @@ impl TerminalView {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn set_block_below_cursor(&mut self, block: BlockProperties, cx: &mut ViewContext<Self>) {
|
pub fn set_block_below_cursor(&mut self, block: BlockProperties, cx: &mut ViewContext<Self>) {
|
||||||
self.block_below_cursor = Some(Arc::new(block));
|
self.block_below_cursor = Some(Rc::new(block));
|
||||||
self.scroll_to_bottom(&ScrollToBottom, cx);
|
self.scroll_to_bottom(&ScrollToBottom, cx);
|
||||||
cx.notify();
|
cx.notify();
|
||||||
}
|
}
|
||||||
|
@ -562,6 +562,7 @@ mod tests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[track_caller]
|
#[track_caller]
|
||||||
|
#[allow(clippy::almost_complete_range)]
|
||||||
fn assert_patch_composition(old: Patch<u32>, new: Patch<u32>, composed: Patch<u32>) {
|
fn assert_patch_composition(old: Patch<u32>, new: Patch<u32>, composed: Patch<u32>) {
|
||||||
let original = ('a'..'z').collect::<Vec<_>>();
|
let original = ('a'..'z').collect::<Vec<_>>();
|
||||||
let inserted = ('A'..'Z').collect::<Vec<_>>();
|
let inserted = ('A'..'Z').collect::<Vec<_>>();
|
||||||
|
@ -250,7 +250,7 @@ impl ContextMenu {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn on_action_dispatch(&mut self, dispatched: &Box<dyn Action>, cx: &mut ViewContext<Self>) {
|
pub fn on_action_dispatch(&mut self, dispatched: &dyn Action, cx: &mut ViewContext<Self>) {
|
||||||
if self.clicked {
|
if self.clicked {
|
||||||
cx.propagate();
|
cx.propagate();
|
||||||
return;
|
return;
|
||||||
@ -262,7 +262,7 @@ impl ContextMenu {
|
|||||||
..
|
..
|
||||||
} = item
|
} = item
|
||||||
{
|
{
|
||||||
action.partial_eq(&**dispatched)
|
action.partial_eq(dispatched)
|
||||||
} else {
|
} else {
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
@ -13,9 +13,9 @@ use workspace::Workspace;
|
|||||||
|
|
||||||
actions!(vim, [Repeat, EndRepeat, ToggleRecord, ReplayLastRecording]);
|
actions!(vim, [Repeat, EndRepeat, ToggleRecord, ReplayLastRecording]);
|
||||||
|
|
||||||
fn should_replay(action: &Box<dyn Action>) -> bool {
|
fn should_replay(action: &dyn Action) -> bool {
|
||||||
// skip so that we don't leave the character palette open
|
// skip so that we don't leave the character palette open
|
||||||
if editor::actions::ShowCharacterPalette.partial_eq(&**action) {
|
if editor::actions::ShowCharacterPalette.partial_eq(action) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
true
|
true
|
||||||
@ -121,7 +121,7 @@ impl Replayer {
|
|||||||
};
|
};
|
||||||
match action {
|
match action {
|
||||||
ReplayableAction::Action(action) => {
|
ReplayableAction::Action(action) => {
|
||||||
if should_replay(&action) {
|
if should_replay(&*action) {
|
||||||
cx.dispatch_action(action.boxed_clone());
|
cx.dispatch_action(action.boxed_clone());
|
||||||
cx.defer(move |cx| observe_action(action.boxed_clone(), cx));
|
cx.defer(move |cx| observe_action(action.boxed_clone(), cx));
|
||||||
}
|
}
|
||||||
|
@ -271,7 +271,7 @@ pub fn move_to_internal(
|
|||||||
}
|
}
|
||||||
let Some(query) = search_bar.query_suggestion(cx) else {
|
let Some(query) = search_bar.query_suggestion(cx) else {
|
||||||
vim.clear_operator(cx);
|
vim.clear_operator(cx);
|
||||||
let _ = search_bar.search("", None, cx);
|
drop(search_bar.search("", None, cx));
|
||||||
return None;
|
return None;
|
||||||
};
|
};
|
||||||
let mut query = regex::escape(&query);
|
let mut query = regex::escape(&query);
|
||||||
|
@ -1571,7 +1571,7 @@ impl Pane {
|
|||||||
fn render_tab(
|
fn render_tab(
|
||||||
&self,
|
&self,
|
||||||
ix: usize,
|
ix: usize,
|
||||||
item: &Box<dyn ItemHandle>,
|
item: &dyn ItemHandle,
|
||||||
detail: usize,
|
detail: usize,
|
||||||
cx: &mut ViewContext<'_, Pane>,
|
cx: &mut ViewContext<'_, Pane>,
|
||||||
) -> impl IntoElement {
|
) -> impl IntoElement {
|
||||||
@ -1863,7 +1863,7 @@ impl Pane {
|
|||||||
.iter()
|
.iter()
|
||||||
.enumerate()
|
.enumerate()
|
||||||
.zip(tab_details(&self.items, cx))
|
.zip(tab_details(&self.items, cx))
|
||||||
.map(|((ix, item), detail)| self.render_tab(ix, item, detail, cx)),
|
.map(|((ix, item), detail)| self.render_tab(ix, &**item, detail, cx)),
|
||||||
)
|
)
|
||||||
.child(
|
.child(
|
||||||
div()
|
div()
|
||||||
|
Loading…
Reference in New Issue
Block a user