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:
Piotr Osiewicz 2025-03-31 20:10:36 +02:00 committed by GitHub
parent d51aa2ffb0
commit 0729d24d77
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
162 changed files with 2333 additions and 1937 deletions

View file

@ -43,7 +43,7 @@ pub fn random_token() -> String {
let mut rng = thread_rng();
let mut token_bytes = [0; 48];
for byte in token_bytes.iter_mut() {
*byte = rng.gen();
*byte = rng.r#gen();
}
BASE64_URL_SAFE.encode(token_bytes)
}

View file

@ -116,7 +116,7 @@ impl Peer {
create_timer: F,
) -> (
ConnectionId,
impl Future<Output = anyhow::Result<()>> + Send,
impl Future<Output = anyhow::Result<()>> + Send + use<F, Fut, Out>,
BoxStream<'static, Box<dyn AnyTypedEnvelope>>,
)
where
@ -377,7 +377,7 @@ impl Peer {
executor: gpui::BackgroundExecutor,
) -> (
ConnectionId,
impl Future<Output = anyhow::Result<()>> + Send,
impl Future<Output = anyhow::Result<()>> + Send + use<>,
BoxStream<'static, Box<dyn AnyTypedEnvelope>>,
) {
let executor = executor.clone();
@ -403,7 +403,7 @@ impl Peer {
&self,
receiver_id: ConnectionId,
request: T,
) -> impl Future<Output = Result<T::Response>> {
) -> impl Future<Output = Result<T::Response>> + use<T> {
self.request_internal(None, receiver_id, request)
.map_ok(|envelope| envelope.payload)
}
@ -412,7 +412,7 @@ impl Peer {
&self,
receiver_id: ConnectionId,
request: T,
) -> impl Future<Output = Result<TypedEnvelope<T::Response>>> {
) -> impl Future<Output = Result<TypedEnvelope<T::Response>>> + use<T> {
self.request_internal(None, receiver_id, request)
}
@ -431,7 +431,7 @@ impl Peer {
original_sender_id: Option<ConnectionId>,
receiver_id: ConnectionId,
request: T,
) -> impl Future<Output = Result<TypedEnvelope<T::Response>>> {
) -> impl Future<Output = Result<TypedEnvelope<T::Response>>> + use<T> {
let envelope = request.into_envelope(0, None, original_sender_id.map(Into::into));
let response = self.request_dynamic(receiver_id, envelope, T::NAME);
async move {
@ -457,7 +457,7 @@ impl Peer {
receiver_id: ConnectionId,
mut envelope: proto::Envelope,
type_name: &'static str,
) -> impl Future<Output = Result<(proto::Envelope, Instant)>> {
) -> impl Future<Output = Result<(proto::Envelope, Instant)>> + use<> {
let (tx, rx) = oneshot::channel();
let send = self.connection_state(receiver_id).and_then(|connection| {
envelope.id = connection.next_message_id.fetch_add(1, SeqCst);

View file

@ -185,7 +185,7 @@ impl AnyProtoClient {
pub fn request<T: RequestMessage>(
&self,
request: T,
) -> impl Future<Output = anyhow::Result<T::Response>> {
) -> impl Future<Output = anyhow::Result<T::Response>> + use<T> {
let envelope = request.into_envelope(0, None, None);
let response = self.0.request(envelope, T::NAME);
async move {