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
|
@ -534,7 +534,9 @@ async fn poll_stripe_events(
|
|||
if event_pages.page.has_more {
|
||||
if pages_of_already_processed_events >= NUMBER_OF_ALREADY_PROCESSED_PAGES_BEFORE_WE_STOP
|
||||
{
|
||||
log::info!("Stripe events: stopping, saw {pages_of_already_processed_events} pages of already-processed events");
|
||||
log::info!(
|
||||
"Stripe events: stopping, saw {pages_of_already_processed_events} pages of already-processed events"
|
||||
);
|
||||
break;
|
||||
} else {
|
||||
log::info!("Stripe events: retrieving next page");
|
||||
|
|
|
@ -853,7 +853,7 @@ fn db_status_to_proto(
|
|||
_ => {
|
||||
return Err(anyhow!(
|
||||
"Unexpected combination of status fields: {entry:?}"
|
||||
))
|
||||
));
|
||||
}
|
||||
};
|
||||
Ok(proto::StatusEntry {
|
||||
|
|
|
@ -74,7 +74,7 @@ impl TestDb {
|
|||
let mut rng = StdRng::from_entropy();
|
||||
let url = format!(
|
||||
"postgres://postgres@localhost/zed-test-{}",
|
||||
rng.gen::<u128>()
|
||||
rng.r#gen::<u128>()
|
||||
);
|
||||
let runtime = tokio::runtime::Builder::new_current_thread()
|
||||
.enable_io()
|
||||
|
|
|
@ -20,7 +20,7 @@ pub fn get_dotenv_vars(current_dir: impl AsRef<Path>) -> Result<Vec<(String, Str
|
|||
|
||||
pub fn load_dotenv() -> Result<()> {
|
||||
for (key, value) in get_dotenv_vars("./crates/collab")? {
|
||||
std::env::set_var(key, value);
|
||||
unsafe { std::env::set_var(key, value) };
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ impl Executor {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn sleep(&self, duration: Duration) -> impl Future<Output = ()> {
|
||||
pub fn sleep(&self, duration: Duration) -> impl Future<Output = ()> + use<> {
|
||||
let this = self.clone();
|
||||
async move {
|
||||
match this {
|
||||
|
|
|
@ -193,7 +193,9 @@ mod tests {
|
|||
.to_vec();
|
||||
assert_eq!(
|
||||
String::from_utf8(response_body).unwrap(),
|
||||
format!("access to {provider:?} models is not available in your region ({country_code})")
|
||||
format!(
|
||||
"access to {provider:?} models is not available in your region ({country_code})"
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ impl TestLlmDb {
|
|||
let mut rng = StdRng::from_entropy();
|
||||
let url = format!(
|
||||
"postgres://postgres@localhost/zed-llm-test-{}",
|
||||
rng.gen::<u128>()
|
||||
rng.r#gen::<u128>()
|
||||
);
|
||||
let runtime = tokio::runtime::Builder::new_current_thread()
|
||||
.enable_io()
|
||||
|
|
|
@ -724,7 +724,7 @@ impl Server {
|
|||
system_id: Option<String>,
|
||||
send_connection_id: Option<oneshot::Sender<ConnectionId>>,
|
||||
executor: Executor,
|
||||
) -> impl Future<Output = ()> {
|
||||
) -> impl Future<Output = ()> + use<> {
|
||||
let this = self.clone();
|
||||
let span = info_span!("handle connection", %address,
|
||||
connection_id=field::Empty,
|
||||
|
|
|
@ -5103,7 +5103,9 @@ async fn test_project_search(
|
|||
results.entry(buffer).or_insert(ranges);
|
||||
}
|
||||
SearchResult::LimitReached => {
|
||||
panic!("Unexpectedly reached search limit in tests. If you do want to assert limit-reached, change this panic call.")
|
||||
panic!(
|
||||
"Unexpectedly reached search limit in tests. If you do want to assert limit-reached, change this panic call."
|
||||
)
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -5602,7 +5604,7 @@ async fn test_open_buffer_while_getting_definition_pointing_to_it(
|
|||
|
||||
let definitions;
|
||||
let buffer_b2;
|
||||
if rng.gen() {
|
||||
if rng.r#gen() {
|
||||
definitions = project_b.update(cx_b, |p, cx| p.definition(&buffer_b1, 23, cx));
|
||||
(buffer_b2, _) = project_b
|
||||
.update(cx_b, |p, cx| {
|
||||
|
|
|
@ -279,7 +279,7 @@ impl RandomizedTest for ProjectCollaborationTest {
|
|||
let project_root_name = root_name_for_project(&project, cx);
|
||||
let mut paths = client.fs().paths(false);
|
||||
paths.remove(0);
|
||||
let new_root_path = if paths.is_empty() || rng.gen() {
|
||||
let new_root_path = if paths.is_empty() || rng.r#gen() {
|
||||
Path::new(path!("/")).join(plan.next_root_dir_name())
|
||||
} else {
|
||||
paths.choose(rng).unwrap().clone()
|
||||
|
@ -309,7 +309,7 @@ impl RandomizedTest for ProjectCollaborationTest {
|
|||
.choose(rng)
|
||||
});
|
||||
let Some(worktree) = worktree else { continue };
|
||||
let is_dir = rng.gen::<bool>();
|
||||
let is_dir = rng.r#gen::<bool>();
|
||||
let mut full_path =
|
||||
worktree.read_with(cx, |w, _| PathBuf::from(w.root_name()));
|
||||
full_path.push(gen_file_name(rng));
|
||||
|
@ -387,7 +387,7 @@ impl RandomizedTest for ProjectCollaborationTest {
|
|||
language::Bias::Left,
|
||||
)
|
||||
});
|
||||
let detach = rng.gen();
|
||||
let detach = rng.r#gen();
|
||||
break ClientOperation::RequestLspDataInBuffer {
|
||||
project_root_name,
|
||||
full_path,
|
||||
|
@ -460,7 +460,7 @@ impl RandomizedTest for ProjectCollaborationTest {
|
|||
|
||||
// Create or update a file or directory
|
||||
96.. => {
|
||||
let is_dir = rng.gen::<bool>();
|
||||
let is_dir = rng.r#gen::<bool>();
|
||||
let content;
|
||||
let mut path;
|
||||
let dir_paths = client.fs().directories(false);
|
||||
|
@ -1315,7 +1315,9 @@ impl RandomizedTest for ProjectCollaborationTest {
|
|||
match (host_file, guest_file) {
|
||||
(Some(host_file), Some(guest_file)) => {
|
||||
assert_eq!(guest_file.path(), host_file.path());
|
||||
assert_eq!(guest_file.disk_state(), host_file.disk_state(),
|
||||
assert_eq!(
|
||||
guest_file.disk_state(),
|
||||
host_file.disk_state(),
|
||||
"guest {} disk_state does not match host {} for path {:?} in project {}",
|
||||
guest_user_id,
|
||||
host_user_id,
|
||||
|
@ -1347,52 +1349,54 @@ impl RandomizedTest for ProjectCollaborationTest {
|
|||
.base_text_string()
|
||||
});
|
||||
assert_eq!(
|
||||
guest_diff_base, host_diff_base,
|
||||
"guest {} diff base does not match host's for path {path:?} in project {project_id}",
|
||||
client.username
|
||||
);
|
||||
guest_diff_base, host_diff_base,
|
||||
"guest {} diff base does not match host's for path {path:?} in project {project_id}",
|
||||
client.username
|
||||
);
|
||||
|
||||
let host_saved_version =
|
||||
host_buffer.read_with(host_cx, |b, _| b.saved_version().clone());
|
||||
let guest_saved_version =
|
||||
guest_buffer.read_with(client_cx, |b, _| b.saved_version().clone());
|
||||
assert_eq!(
|
||||
guest_saved_version, host_saved_version,
|
||||
"guest {} saved version does not match host's for path {path:?} in project {project_id}",
|
||||
client.username
|
||||
);
|
||||
guest_saved_version, host_saved_version,
|
||||
"guest {} saved version does not match host's for path {path:?} in project {project_id}",
|
||||
client.username
|
||||
);
|
||||
|
||||
let host_is_dirty = host_buffer.read_with(host_cx, |b, _| b.is_dirty());
|
||||
let guest_is_dirty = guest_buffer.read_with(client_cx, |b, _| b.is_dirty());
|
||||
assert_eq!(
|
||||
guest_is_dirty, host_is_dirty,
|
||||
"guest {} dirty state does not match host's for path {path:?} in project {project_id}",
|
||||
client.username
|
||||
);
|
||||
guest_is_dirty, host_is_dirty,
|
||||
"guest {} dirty state does not match host's for path {path:?} in project {project_id}",
|
||||
client.username
|
||||
);
|
||||
|
||||
let host_saved_mtime = host_buffer.read_with(host_cx, |b, _| b.saved_mtime());
|
||||
let guest_saved_mtime =
|
||||
guest_buffer.read_with(client_cx, |b, _| b.saved_mtime());
|
||||
assert_eq!(
|
||||
guest_saved_mtime, host_saved_mtime,
|
||||
"guest {} saved mtime does not match host's for path {path:?} in project {project_id}",
|
||||
client.username
|
||||
);
|
||||
guest_saved_mtime, host_saved_mtime,
|
||||
"guest {} saved mtime does not match host's for path {path:?} in project {project_id}",
|
||||
client.username
|
||||
);
|
||||
|
||||
let host_is_dirty = host_buffer.read_with(host_cx, |b, _| b.is_dirty());
|
||||
let guest_is_dirty = guest_buffer.read_with(client_cx, |b, _| b.is_dirty());
|
||||
assert_eq!(guest_is_dirty, host_is_dirty,
|
||||
"guest {} dirty status does not match host's for path {path:?} in project {project_id}",
|
||||
client.username
|
||||
);
|
||||
assert_eq!(
|
||||
guest_is_dirty, host_is_dirty,
|
||||
"guest {} dirty status does not match host's for path {path:?} in project {project_id}",
|
||||
client.username
|
||||
);
|
||||
|
||||
let host_has_conflict = host_buffer.read_with(host_cx, |b, _| b.has_conflict());
|
||||
let guest_has_conflict =
|
||||
guest_buffer.read_with(client_cx, |b, _| b.has_conflict());
|
||||
assert_eq!(guest_has_conflict, host_has_conflict,
|
||||
"guest {} conflict status does not match host's for path {path:?} in project {project_id}",
|
||||
client.username
|
||||
);
|
||||
assert_eq!(
|
||||
guest_has_conflict, host_has_conflict,
|
||||
"guest {} conflict status does not match host's for path {path:?} in project {project_id}",
|
||||
client.username
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue