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
|
@ -788,10 +788,10 @@ impl Vim {
|
|||
editor.selections.line_mode = false;
|
||||
editor.unregister_addon::<VimAddon>();
|
||||
editor.set_relative_line_number(None, cx);
|
||||
if let Some(vim) = Vim::globals(cx).focused_vim() {
|
||||
if vim.entity_id() == cx.entity().entity_id() {
|
||||
Vim::globals(cx).focused_vim = None;
|
||||
}
|
||||
if let Some(vim) = Vim::globals(cx).focused_vim()
|
||||
&& vim.entity_id() == cx.entity().entity_id()
|
||||
{
|
||||
Vim::globals(cx).focused_vim = None;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -833,10 +833,10 @@ impl Vim {
|
|||
if self.exit_temporary_mode {
|
||||
self.exit_temporary_mode = false;
|
||||
// Don't switch to insert mode if the action is temporary_normal.
|
||||
if let Some(action) = keystroke_event.action.as_ref() {
|
||||
if action.as_any().downcast_ref::<TemporaryNormal>().is_some() {
|
||||
return;
|
||||
}
|
||||
if let Some(action) = keystroke_event.action.as_ref()
|
||||
&& action.as_any().downcast_ref::<TemporaryNormal>().is_some()
|
||||
{
|
||||
return;
|
||||
}
|
||||
self.switch_mode(Mode::Insert, false, window, cx)
|
||||
}
|
||||
|
@ -1006,10 +1006,10 @@ impl Vim {
|
|||
Some((point, goal))
|
||||
})
|
||||
}
|
||||
if last_mode == Mode::Insert || last_mode == Mode::Replace {
|
||||
if let Some(prior_tx) = prior_tx {
|
||||
editor.group_until_transaction(prior_tx, cx)
|
||||
}
|
||||
if (last_mode == Mode::Insert || last_mode == Mode::Replace)
|
||||
&& let Some(prior_tx) = prior_tx
|
||||
{
|
||||
editor.group_until_transaction(prior_tx, cx)
|
||||
}
|
||||
|
||||
editor.change_selections(SelectionEffects::no_scroll(), window, cx, |s| {
|
||||
|
@ -1031,14 +1031,16 @@ impl Vim {
|
|||
}
|
||||
|
||||
let snapshot = s.display_map();
|
||||
if let Some(pending) = s.pending.as_mut() {
|
||||
if pending.selection.reversed && mode.is_visual() && !last_mode.is_visual() {
|
||||
let mut end = pending.selection.end.to_point(&snapshot.buffer_snapshot);
|
||||
end = snapshot
|
||||
.buffer_snapshot
|
||||
.clip_point(end + Point::new(0, 1), Bias::Right);
|
||||
pending.selection.end = snapshot.buffer_snapshot.anchor_before(end);
|
||||
}
|
||||
if let Some(pending) = s.pending.as_mut()
|
||||
&& pending.selection.reversed
|
||||
&& mode.is_visual()
|
||||
&& !last_mode.is_visual()
|
||||
{
|
||||
let mut end = pending.selection.end.to_point(&snapshot.buffer_snapshot);
|
||||
end = snapshot
|
||||
.buffer_snapshot
|
||||
.clip_point(end + Point::new(0, 1), Bias::Right);
|
||||
pending.selection.end = snapshot.buffer_snapshot.anchor_before(end);
|
||||
}
|
||||
|
||||
s.move_with(|map, selection| {
|
||||
|
@ -1536,12 +1538,12 @@ impl Vim {
|
|||
if self.mode == Mode::Insert && self.current_tx.is_some() {
|
||||
if self.current_anchor.is_none() {
|
||||
self.current_anchor = Some(newest);
|
||||
} else if self.current_anchor.as_ref().unwrap() != &newest {
|
||||
if let Some(tx_id) = self.current_tx.take() {
|
||||
self.update_editor(cx, |_, editor, cx| {
|
||||
editor.group_until_transaction(tx_id, cx)
|
||||
});
|
||||
}
|
||||
} else if self.current_anchor.as_ref().unwrap() != &newest
|
||||
&& let Some(tx_id) = self.current_tx.take()
|
||||
{
|
||||
self.update_editor(cx, |_, editor, cx| {
|
||||
editor.group_until_transaction(tx_id, cx)
|
||||
});
|
||||
}
|
||||
} else if self.mode == Mode::Normal && newest.start != newest.end {
|
||||
if matches!(newest.goal, SelectionGoal::HorizontalRange { .. }) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue