chore: Prepare for Rust edition bump to 2024 (without autofix) (#27791)
Successor to #27779 - in this PR I've applied changes manually, without futzing with if let lifetimes at all. Release Notes: - N/A
This commit is contained in:
parent
d51aa2ffb0
commit
0729d24d77
162 changed files with 2333 additions and 1937 deletions
|
@ -1493,7 +1493,9 @@ impl ProjectPanel {
|
|||
} else if dirty_buffers == 1 {
|
||||
"\n\n1 of these has unsaved changes, which will be lost.".to_string()
|
||||
} else {
|
||||
format!("\n\n{dirty_buffers} of these have unsaved changes, which will be lost.")
|
||||
format!(
|
||||
"\n\n{dirty_buffers} of these have unsaved changes, which will be lost."
|
||||
)
|
||||
};
|
||||
|
||||
format!(
|
||||
|
|
|
@ -1582,24 +1582,24 @@ async fn test_copy_paste_directory_with_sibling_file(cx: &mut gpui::TestAppConte
|
|||
cx.executor().run_until_parked();
|
||||
|
||||
assert_eq!(
|
||||
visible_entries_as_strings(&panel, 0..15, cx),
|
||||
&[
|
||||
"v test",
|
||||
" v dir1 <== marked",
|
||||
" a.txt",
|
||||
" b.txt",
|
||||
" v dir2",
|
||||
" v dir1",
|
||||
" a.txt",
|
||||
" b.txt",
|
||||
" > dir1 copy <== selected",
|
||||
" c.txt",
|
||||
" c copy.txt",
|
||||
" c.txt <== marked",
|
||||
" d.txt",
|
||||
],
|
||||
"Should copy dir1 as well as c.txt into dir2 and disambiguate them without opening the rename editor"
|
||||
);
|
||||
visible_entries_as_strings(&panel, 0..15, cx),
|
||||
&[
|
||||
"v test",
|
||||
" v dir1 <== marked",
|
||||
" a.txt",
|
||||
" b.txt",
|
||||
" v dir2",
|
||||
" v dir1",
|
||||
" a.txt",
|
||||
" b.txt",
|
||||
" > dir1 copy <== selected",
|
||||
" c.txt",
|
||||
" c copy.txt",
|
||||
" c.txt <== marked",
|
||||
" d.txt",
|
||||
],
|
||||
"Should copy dir1 as well as c.txt into dir2 and disambiguate them without opening the rename editor"
|
||||
);
|
||||
}
|
||||
|
||||
#[gpui::test]
|
||||
|
@ -2909,16 +2909,16 @@ async fn test_autoreveal_and_gitignored_files(cx: &mut gpui::TestAppContext) {
|
|||
});
|
||||
cx.run_until_parked();
|
||||
assert_eq!(
|
||||
visible_entries_as_strings(&panel, 0..20, cx),
|
||||
&[
|
||||
"v project_root",
|
||||
" > .git",
|
||||
" > dir_1 <== selected",
|
||||
" > dir_2",
|
||||
" .gitignore",
|
||||
],
|
||||
"When no auto reveal is enabled, the selected entry should not be revealed in the project panel"
|
||||
);
|
||||
visible_entries_as_strings(&panel, 0..20, cx),
|
||||
&[
|
||||
"v project_root",
|
||||
" > .git",
|
||||
" > dir_1 <== selected",
|
||||
" > dir_2",
|
||||
" .gitignore",
|
||||
],
|
||||
"When no auto reveal is enabled, the selected entry should not be revealed in the project panel"
|
||||
);
|
||||
}
|
||||
|
||||
cx.update(|_, cx| {
|
||||
|
@ -2985,23 +2985,23 @@ async fn test_autoreveal_and_gitignored_files(cx: &mut gpui::TestAppContext) {
|
|||
});
|
||||
cx.run_until_parked();
|
||||
assert_eq!(
|
||||
visible_entries_as_strings(&panel, 0..20, cx),
|
||||
&[
|
||||
"v project_root",
|
||||
" > .git",
|
||||
" v dir_1",
|
||||
" > gitignored_dir",
|
||||
" file_1.py",
|
||||
" file_2.py",
|
||||
" file_3.py",
|
||||
" v dir_2",
|
||||
" file_1.py <== selected <== marked",
|
||||
" file_2.py",
|
||||
" file_3.py",
|
||||
" .gitignore",
|
||||
],
|
||||
"When auto reveal is enabled, a gitignored selected entry should not be revealed in the project panel"
|
||||
);
|
||||
visible_entries_as_strings(&panel, 0..20, cx),
|
||||
&[
|
||||
"v project_root",
|
||||
" > .git",
|
||||
" v dir_1",
|
||||
" > gitignored_dir",
|
||||
" file_1.py",
|
||||
" file_2.py",
|
||||
" file_3.py",
|
||||
" v dir_2",
|
||||
" file_1.py <== selected <== marked",
|
||||
" file_2.py",
|
||||
" file_3.py",
|
||||
" .gitignore",
|
||||
],
|
||||
"When auto reveal is enabled, a gitignored selected entry should not be revealed in the project panel"
|
||||
);
|
||||
|
||||
panel.update(cx, |panel, cx| {
|
||||
panel.project.update(cx, |_, cx| {
|
||||
|
@ -3128,24 +3128,24 @@ async fn test_gitignored_and_always_included(cx: &mut gpui::TestAppContext) {
|
|||
cx.run_until_parked();
|
||||
|
||||
assert_eq!(
|
||||
visible_entries_as_strings(&panel, 0..20, cx),
|
||||
&[
|
||||
"v project_root",
|
||||
" > .git",
|
||||
" v always_included_but_ignored_dir",
|
||||
" file_a.py <== selected <== marked",
|
||||
" file_b.py",
|
||||
" file_c.py",
|
||||
" v dir_1",
|
||||
" > gitignored_dir",
|
||||
" file_1.py",
|
||||
" file_2.py",
|
||||
" file_3.py",
|
||||
" > dir_2",
|
||||
" .gitignore",
|
||||
],
|
||||
"When auto reveal is enabled, a gitignored but always included selected entry should be revealed in the project panel"
|
||||
);
|
||||
visible_entries_as_strings(&panel, 0..20, cx),
|
||||
&[
|
||||
"v project_root",
|
||||
" > .git",
|
||||
" v always_included_but_ignored_dir",
|
||||
" file_a.py <== selected <== marked",
|
||||
" file_b.py",
|
||||
" file_c.py",
|
||||
" v dir_1",
|
||||
" > gitignored_dir",
|
||||
" file_1.py",
|
||||
" file_2.py",
|
||||
" file_3.py",
|
||||
" > dir_2",
|
||||
" .gitignore",
|
||||
],
|
||||
"When auto reveal is enabled, a gitignored but always included selected entry should be revealed in the project panel"
|
||||
);
|
||||
}
|
||||
|
||||
#[gpui::test]
|
||||
|
@ -3261,16 +3261,16 @@ async fn test_explicit_reveal(cx: &mut gpui::TestAppContext) {
|
|||
});
|
||||
cx.run_until_parked();
|
||||
assert_eq!(
|
||||
visible_entries_as_strings(&panel, 0..20, cx),
|
||||
&[
|
||||
"v project_root",
|
||||
" > .git",
|
||||
" > dir_1 <== selected",
|
||||
" > dir_2",
|
||||
" .gitignore",
|
||||
],
|
||||
"When no auto reveal is enabled, the selected entry should not be revealed in the project panel"
|
||||
);
|
||||
visible_entries_as_strings(&panel, 0..20, cx),
|
||||
&[
|
||||
"v project_root",
|
||||
" > .git",
|
||||
" > dir_1 <== selected",
|
||||
" > dir_2",
|
||||
" .gitignore",
|
||||
],
|
||||
"When no auto reveal is enabled, the selected entry should not be revealed in the project panel"
|
||||
);
|
||||
}
|
||||
|
||||
panel.update(cx, |panel, cx| {
|
||||
|
@ -3327,26 +3327,26 @@ async fn test_explicit_reveal(cx: &mut gpui::TestAppContext) {
|
|||
});
|
||||
cx.run_until_parked();
|
||||
assert_eq!(
|
||||
visible_entries_as_strings(&panel, 0..20, cx),
|
||||
&[
|
||||
"v project_root",
|
||||
" > .git",
|
||||
" v dir_1",
|
||||
" v gitignored_dir",
|
||||
" file_a.py <== selected <== marked",
|
||||
" file_b.py",
|
||||
" file_c.py",
|
||||
" file_1.py",
|
||||
" file_2.py",
|
||||
" file_3.py",
|
||||
" v dir_2",
|
||||
" file_1.py",
|
||||
" file_2.py",
|
||||
" file_3.py",
|
||||
" .gitignore",
|
||||
],
|
||||
"With no auto reveal, explicit reveal should show the gitignored entry in the project panel"
|
||||
);
|
||||
visible_entries_as_strings(&panel, 0..20, cx),
|
||||
&[
|
||||
"v project_root",
|
||||
" > .git",
|
||||
" v dir_1",
|
||||
" v gitignored_dir",
|
||||
" file_a.py <== selected <== marked",
|
||||
" file_b.py",
|
||||
" file_c.py",
|
||||
" file_1.py",
|
||||
" file_2.py",
|
||||
" file_3.py",
|
||||
" v dir_2",
|
||||
" file_1.py",
|
||||
" file_2.py",
|
||||
" file_3.py",
|
||||
" .gitignore",
|
||||
],
|
||||
"With no auto reveal, explicit reveal should show the gitignored entry in the project panel"
|
||||
);
|
||||
}
|
||||
|
||||
#[gpui::test]
|
||||
|
@ -3475,10 +3475,10 @@ async fn test_creating_excluded_entries(cx: &mut gpui::TestAppContext) {
|
|||
.unwrap();
|
||||
|
||||
assert_eq!(
|
||||
visible_entries_as_strings(&panel, 0..13, cx),
|
||||
&["v root1", " .dockerignore"],
|
||||
"Should not change the project panel after trying to create an excluded directorya directory with the same name as the excluded file"
|
||||
);
|
||||
visible_entries_as_strings(&panel, 0..13, cx),
|
||||
&["v root1", " .dockerignore"],
|
||||
"Should not change the project panel after trying to create an excluded directorya directory with the same name as the excluded file"
|
||||
);
|
||||
panel.update_in(cx, |panel, window, cx| {
|
||||
assert!(
|
||||
!panel.filename_editor.read(cx).is_focused(window),
|
||||
|
@ -4571,23 +4571,23 @@ async fn test_expand_all_for_entry(cx: &mut gpui::TestAppContext) {
|
|||
cx.run_until_parked();
|
||||
|
||||
assert_eq!(
|
||||
visible_entries_as_strings(&panel, 0..20, cx),
|
||||
&[
|
||||
separator!("v root"),
|
||||
separator!(" v dir1 <== selected"),
|
||||
separator!(" v empty1"),
|
||||
separator!(" v empty2"),
|
||||
separator!(" v empty3"),
|
||||
separator!(" file.txt"),
|
||||
separator!(" > ignored_dir"),
|
||||
separator!(" v subdir1"),
|
||||
separator!(" > ignored_nested"),
|
||||
separator!(" file1.txt"),
|
||||
separator!(" file2.txt"),
|
||||
separator!(" .gitignore"),
|
||||
],
|
||||
"After expand_all with auto-fold: should not expand ignored_dir, should expand folded dirs, and should not expand ignored_nested"
|
||||
);
|
||||
visible_entries_as_strings(&panel, 0..20, cx),
|
||||
&[
|
||||
separator!("v root"),
|
||||
separator!(" v dir1 <== selected"),
|
||||
separator!(" v empty1"),
|
||||
separator!(" v empty2"),
|
||||
separator!(" v empty3"),
|
||||
separator!(" file.txt"),
|
||||
separator!(" > ignored_dir"),
|
||||
separator!(" v subdir1"),
|
||||
separator!(" > ignored_nested"),
|
||||
separator!(" file1.txt"),
|
||||
separator!(" file2.txt"),
|
||||
separator!(" .gitignore"),
|
||||
],
|
||||
"After expand_all with auto-fold: should not expand ignored_dir, should expand folded dirs, and should not expand ignored_nested"
|
||||
);
|
||||
|
||||
// Test 2: When auto-fold is disabled
|
||||
cx.update(|_, cx| {
|
||||
|
@ -5095,18 +5095,18 @@ fn ensure_no_open_items_and_panes(workspace: &WindowHandle<Workspace>, cx: &mut
|
|||
"Should have no prompts after deletion operation closes the file"
|
||||
);
|
||||
workspace
|
||||
.read_with(cx, |workspace, cx| {
|
||||
let open_project_paths = workspace
|
||||
.panes()
|
||||
.iter()
|
||||
.filter_map(|pane| pane.read(cx).active_item()?.project_path(cx))
|
||||
.collect::<Vec<_>>();
|
||||
assert!(
|
||||
open_project_paths.is_empty(),
|
||||
"Deleted file's buffer should be closed, but got open files: {open_project_paths:?}"
|
||||
);
|
||||
})
|
||||
.unwrap();
|
||||
.read_with(cx, |workspace, cx| {
|
||||
let open_project_paths = workspace
|
||||
.panes()
|
||||
.iter()
|
||||
.filter_map(|pane| pane.read(cx).active_item()?.project_path(cx))
|
||||
.collect::<Vec<_>>();
|
||||
assert!(
|
||||
open_project_paths.is_empty(),
|
||||
"Deleted file's buffer should be closed, but got open files: {open_project_paths:?}"
|
||||
);
|
||||
})
|
||||
.unwrap();
|
||||
}
|
||||
|
||||
struct TestProjectItemView {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue