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
|
@ -930,10 +930,10 @@ impl Item for Editor {
|
|||
})?;
|
||||
buffer
|
||||
.update(cx, |buffer, cx| {
|
||||
if let Some(transaction) = transaction {
|
||||
if !buffer.is_singleton() {
|
||||
buffer.push_transaction(&transaction.0, cx);
|
||||
}
|
||||
if let Some(transaction) = transaction
|
||||
&& !buffer.is_singleton()
|
||||
{
|
||||
buffer.push_transaction(&transaction.0, cx);
|
||||
}
|
||||
})
|
||||
.ok();
|
||||
|
@ -1374,36 +1374,33 @@ impl ProjectItem for Editor {
|
|||
let mut editor = Self::for_buffer(buffer.clone(), Some(project), window, cx);
|
||||
if let Some((excerpt_id, buffer_id, snapshot)) =
|
||||
editor.buffer().read(cx).snapshot(cx).as_singleton()
|
||||
&& WorkspaceSettings::get(None, cx).restore_on_file_reopen
|
||||
&& let Some(restoration_data) = Self::project_item_kind()
|
||||
.and_then(|kind| pane.as_ref()?.project_item_restoration_data.get(&kind))
|
||||
.and_then(|data| data.downcast_ref::<EditorRestorationData>())
|
||||
.and_then(|data| {
|
||||
let file = project::File::from_dyn(buffer.read(cx).file())?;
|
||||
data.entries.get(&file.abs_path(cx))
|
||||
})
|
||||
{
|
||||
if WorkspaceSettings::get(None, cx).restore_on_file_reopen {
|
||||
if let Some(restoration_data) = Self::project_item_kind()
|
||||
.and_then(|kind| pane.as_ref()?.project_item_restoration_data.get(&kind))
|
||||
.and_then(|data| data.downcast_ref::<EditorRestorationData>())
|
||||
.and_then(|data| {
|
||||
let file = project::File::from_dyn(buffer.read(cx).file())?;
|
||||
data.entries.get(&file.abs_path(cx))
|
||||
})
|
||||
{
|
||||
editor.fold_ranges(
|
||||
clip_ranges(&restoration_data.folds, snapshot),
|
||||
false,
|
||||
window,
|
||||
cx,
|
||||
);
|
||||
if !restoration_data.selections.is_empty() {
|
||||
editor.change_selections(SelectionEffects::no_scroll(), window, cx, |s| {
|
||||
s.select_ranges(clip_ranges(&restoration_data.selections, snapshot));
|
||||
});
|
||||
}
|
||||
let (top_row, offset) = restoration_data.scroll_position;
|
||||
let anchor = Anchor::in_buffer(
|
||||
*excerpt_id,
|
||||
buffer_id,
|
||||
snapshot.anchor_before(Point::new(top_row, 0)),
|
||||
);
|
||||
editor.set_scroll_anchor(ScrollAnchor { anchor, offset }, window, cx);
|
||||
}
|
||||
editor.fold_ranges(
|
||||
clip_ranges(&restoration_data.folds, snapshot),
|
||||
false,
|
||||
window,
|
||||
cx,
|
||||
);
|
||||
if !restoration_data.selections.is_empty() {
|
||||
editor.change_selections(SelectionEffects::no_scroll(), window, cx, |s| {
|
||||
s.select_ranges(clip_ranges(&restoration_data.selections, snapshot));
|
||||
});
|
||||
}
|
||||
let (top_row, offset) = restoration_data.scroll_position;
|
||||
let anchor = Anchor::in_buffer(
|
||||
*excerpt_id,
|
||||
buffer_id,
|
||||
snapshot.anchor_before(Point::new(top_row, 0)),
|
||||
);
|
||||
editor.set_scroll_anchor(ScrollAnchor { anchor, offset }, window, cx);
|
||||
}
|
||||
|
||||
editor
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue