chore: Fix several style lints (#17488)

It's not comprehensive enough to start linting on `style` group, but
hey, it's a start.

Release Notes:

- N/A
This commit is contained in:
Piotr Osiewicz 2024-09-06 11:58:39 +02:00 committed by GitHub
parent 93249fc82b
commit e6c1c51b37
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
361 changed files with 3530 additions and 3587 deletions

View file

@ -177,13 +177,10 @@ impl ChannelBuffer {
match event {
language::Event::Operation(operation) => {
if *ZED_ALWAYS_ACTIVE {
match operation {
language::Operation::UpdateSelections { selections, .. } => {
if selections.is_empty() {
return;
}
if let language::Operation::UpdateSelections { selections, .. } = operation {
if selections.is_empty() {
return;
}
_ => {}
}
}
let operation = language::proto::serialize_operation(operation);

View file

@ -61,9 +61,9 @@ pub enum ChannelMessageId {
Pending(usize),
}
impl Into<Option<u64>> for ChannelMessageId {
fn into(self) -> Option<u64> {
match self {
impl From<ChannelMessageId> for Option<u64> {
fn from(val: ChannelMessageId) -> Self {
match val {
ChannelMessageId::Saved(id) => Some(id),
ChannelMessageId::Pending(_) => None,
}

View file

@ -249,15 +249,14 @@ impl ChannelStore {
}
pub fn initialize(&mut self) {
if !self.did_subscribe {
if self
if !self.did_subscribe
&& self
.client
.send(proto::SubscribeToChannels {})
.log_err()
.is_some()
{
self.did_subscribe = true;
}
{
self.did_subscribe = true;
}
}
@ -423,7 +422,7 @@ impl ChannelStore {
) {
self.channel_states
.entry(channel_id)
.or_insert_with(|| Default::default())
.or_default()
.acknowledge_message_id(message_id);
cx.notify();
}
@ -436,7 +435,7 @@ impl ChannelStore {
) {
self.channel_states
.entry(channel_id)
.or_insert_with(|| Default::default())
.or_default()
.update_latest_message_id(message_id);
cx.notify();
}
@ -450,7 +449,7 @@ impl ChannelStore {
) {
self.channel_states
.entry(channel_id)
.or_insert_with(|| Default::default())
.or_default()
.acknowledge_notes_version(epoch, version);
cx.notify()
}
@ -464,7 +463,7 @@ impl ChannelStore {
) {
self.channel_states
.entry(channel_id)
.or_insert_with(|| Default::default())
.or_default()
.update_latest_notes_version(epoch, version);
cx.notify()
}
@ -924,7 +923,7 @@ impl ChannelStore {
if let Some(role) = ChannelRole::from_i32(membership.role) {
this.channel_states
.entry(ChannelId(membership.channel_id))
.or_insert_with(|| ChannelState::default())
.or_default()
.set_role(role)
}
}
@ -1094,11 +1093,7 @@ impl ChannelStore {
id: ChannelId(channel.id),
visibility: channel.visibility(),
name: channel.name.into(),
parent_path: channel
.parent_path
.into_iter()
.map(|cid| ChannelId(cid))
.collect(),
parent_path: channel.parent_path.into_iter().map(ChannelId).collect(),
}),
),
}
@ -1113,14 +1108,11 @@ impl ChannelStore {
if channels_changed {
if !payload.delete_channels.is_empty() {
let delete_channels: Vec<ChannelId> = payload
.delete_channels
.into_iter()
.map(|cid| ChannelId(cid))
.collect();
let delete_channels: Vec<ChannelId> =
payload.delete_channels.into_iter().map(ChannelId).collect();
self.channel_index.delete_channels(&delete_channels);
self.channel_participants
.retain(|channel_id, _| !delete_channels.contains(&channel_id));
.retain(|channel_id, _| !delete_channels.contains(channel_id));
for channel_id in &delete_channels {
let channel_id = *channel_id;