Auto-fix clippy::collapsible_if violations (#36428)
Release Notes: - N/A
This commit is contained in:
parent
9e8ec72bd5
commit
8f567383e4
281 changed files with 6628 additions and 7089 deletions
|
@ -412,20 +412,20 @@ impl MarksState {
|
|||
let mut to_write = HashMap::default();
|
||||
|
||||
for (key, value) in &new_points {
|
||||
if self.is_global_mark(key) {
|
||||
if self.global_marks.get(key) != Some(&MarkLocation::Path(path.clone())) {
|
||||
if let Some(workspace_id) = self.workspace_id(cx) {
|
||||
let path = path.clone();
|
||||
let key = key.clone();
|
||||
cx.background_spawn(async move {
|
||||
DB.set_global_mark_path(workspace_id, key, path).await
|
||||
})
|
||||
.detach_and_log_err(cx);
|
||||
}
|
||||
|
||||
self.global_marks
|
||||
.insert(key.clone(), MarkLocation::Path(path.clone()));
|
||||
if self.is_global_mark(key)
|
||||
&& self.global_marks.get(key) != Some(&MarkLocation::Path(path.clone()))
|
||||
{
|
||||
if let Some(workspace_id) = self.workspace_id(cx) {
|
||||
let path = path.clone();
|
||||
let key = key.clone();
|
||||
cx.background_spawn(async move {
|
||||
DB.set_global_mark_path(workspace_id, key, path).await
|
||||
})
|
||||
.detach_and_log_err(cx);
|
||||
}
|
||||
|
||||
self.global_marks
|
||||
.insert(key.clone(), MarkLocation::Path(path.clone()));
|
||||
}
|
||||
if old_points.and_then(|o| o.get(key)) != Some(value) {
|
||||
to_write.insert(key.clone(), value.clone());
|
||||
|
@ -456,15 +456,15 @@ impl MarksState {
|
|||
buffer: &Entity<Buffer>,
|
||||
cx: &mut Context<Self>,
|
||||
) {
|
||||
if let MarkLocation::Buffer(entity_id) = old_path {
|
||||
if let Some(old_marks) = self.multibuffer_marks.remove(&entity_id) {
|
||||
let buffer_marks = old_marks
|
||||
.into_iter()
|
||||
.map(|(k, v)| (k, v.into_iter().map(|anchor| anchor.text_anchor).collect()))
|
||||
.collect();
|
||||
self.buffer_marks
|
||||
.insert(buffer.read(cx).remote_id(), buffer_marks);
|
||||
}
|
||||
if let MarkLocation::Buffer(entity_id) = old_path
|
||||
&& let Some(old_marks) = self.multibuffer_marks.remove(&entity_id)
|
||||
{
|
||||
let buffer_marks = old_marks
|
||||
.into_iter()
|
||||
.map(|(k, v)| (k, v.into_iter().map(|anchor| anchor.text_anchor).collect()))
|
||||
.collect();
|
||||
self.buffer_marks
|
||||
.insert(buffer.read(cx).remote_id(), buffer_marks);
|
||||
}
|
||||
self.watch_buffer(MarkLocation::Path(new_path.clone()), buffer, cx);
|
||||
self.serialize_buffer_marks(new_path, buffer, cx);
|
||||
|
@ -512,10 +512,9 @@ impl MarksState {
|
|||
.watched_buffers
|
||||
.get(&buffer_id.clone())
|
||||
.map(|(path, _, _)| path.clone())
|
||||
&& let Some(new_path) = this.path_for_buffer(&buffer, cx)
|
||||
{
|
||||
if let Some(new_path) = this.path_for_buffer(&buffer, cx) {
|
||||
this.rename_buffer(old_path, new_path, &buffer, cx)
|
||||
}
|
||||
this.rename_buffer(old_path, new_path, &buffer, cx)
|
||||
}
|
||||
}
|
||||
_ => {}
|
||||
|
@ -897,13 +896,13 @@ impl VimGlobals {
|
|||
self.stop_recording_after_next_action = false;
|
||||
}
|
||||
}
|
||||
if self.replayer.is_none() {
|
||||
if let Some(recording_register) = self.recording_register {
|
||||
self.recordings
|
||||
.entry(recording_register)
|
||||
.or_default()
|
||||
.push(ReplayableAction::Action(action));
|
||||
}
|
||||
if self.replayer.is_none()
|
||||
&& let Some(recording_register) = self.recording_register
|
||||
{
|
||||
self.recordings
|
||||
.entry(recording_register)
|
||||
.or_default()
|
||||
.push(ReplayableAction::Action(action));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1330,10 +1329,10 @@ impl MarksMatchInfo {
|
|||
let mut offset = 0;
|
||||
for chunk in chunks {
|
||||
line.push_str(chunk.text);
|
||||
if let Some(highlight_style) = chunk.syntax_highlight_id {
|
||||
if let Some(highlight) = highlight_style.style(cx.theme().syntax()) {
|
||||
highlights.push((offset..offset + chunk.text.len(), highlight))
|
||||
}
|
||||
if let Some(highlight_style) = chunk.syntax_highlight_id
|
||||
&& let Some(highlight) = highlight_style.style(cx.theme().syntax())
|
||||
{
|
||||
highlights.push((offset..offset + chunk.text.len(), highlight))
|
||||
}
|
||||
offset += chunk.text.len();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue