Skip to content

Commit c44c94f

Browse files
committed
Use more async closures
1 parent e7eba09 commit c44c94f

File tree

3 files changed

+17
-17
lines changed

3 files changed

+17
-17
lines changed

compiler/base/orchestrator/src/coordinator.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -947,7 +947,7 @@ where
947947
use versions_error::*;
948948

949949
let [stable, beta, nightly] =
950-
[Channel::Stable, Channel::Beta, Channel::Nightly].map(|c| async move {
950+
[Channel::Stable, Channel::Beta, Channel::Nightly].map(async |c| {
951951
let c = self.select_channel(c).await?;
952952
c.versions().await.map_err(VersionsChannelError::from)
953953
});
@@ -1144,7 +1144,7 @@ where
11441144
let token = mem::take(token);
11451145
token.cancel();
11461146

1147-
let channels = [stable, beta, nightly].map(|c| async {
1147+
let channels = [stable, beta, nightly].map(async |c| {
11481148
match c.take() {
11491149
Some(c) => c.shutdown().await,
11501150
_ => Ok(()),
@@ -3081,7 +3081,7 @@ mod tests {
30813081
(Mode::Release, "[optimized]"),
30823082
];
30833083

3084-
let tests = params.into_iter().map(|(mode, expected)| async move {
3084+
let tests = params.into_iter().map(async |(mode, expected)| {
30853085
let coordinator = new_coordinator();
30863086

30873087
let request = ExecuteRequest {
@@ -3117,7 +3117,7 @@ mod tests {
31173117

31183118
let tests = params.into_iter().flat_map(|(code, works_in)| {
31193119
Edition::ALL.into_iter().zip(works_in).map(
3120-
move |(edition, expected_to_work)| async move {
3120+
async |(edition, expected_to_work)| {
31213121
let coordinator = new_coordinator();
31223122

31233123
let request = ExecuteRequest {
@@ -3157,7 +3157,7 @@ mod tests {
31573157
),
31583158
];
31593159

3160-
let tests = params.into_iter().map(|(crate_type, expected)| async move {
3160+
let tests = params.into_iter().map(async |(crate_type, expected)| {
31613161
let coordinator = new_coordinator();
31623162

31633163
let request = ExecuteRequest {
@@ -3190,7 +3190,7 @@ mod tests {
31903190

31913191
let params = [(false, "Running `"), (true, "Running unittests")];
31923192

3193-
let tests = params.into_iter().map(|(tests, expected)| async move {
3193+
let tests = params.into_iter().map(async |(tests, expected)| {
31943194
let coordinator = new_coordinator();
31953195

31963196
let request = ExecuteRequest {
@@ -3223,7 +3223,7 @@ mod tests {
32233223
(true, "stack backtrace:"),
32243224
];
32253225

3226-
let tests = params.into_iter().map(|(backtrace, expected)| async move {
3226+
let tests = params.into_iter().map(async |(backtrace, expected)| {
32273227
let coordinator = new_coordinator();
32283228

32293229
let request = ExecuteRequest {

ui/src/server_axum.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ async fn evaluate(
230230
Extension(db): Extension<Handle>,
231231
Json(req): Json<api::EvaluateRequest>,
232232
) -> Result<Json<api::EvaluateResponse>> {
233-
attempt_record_request(db, req, |req| async {
233+
attempt_record_request(db, req, async |req| {
234234
with_coordinator(&factory.0, req, async |c, req| {
235235
c.execute(req).context(EvaluateSnafu).await
236236
})
@@ -245,7 +245,7 @@ async fn compile(
245245
Extension(db): Extension<Handle>,
246246
Json(req): Json<api::CompileRequest>,
247247
) -> Result<Json<api::CompileResponse>> {
248-
attempt_record_request(db, req, |req| async {
248+
attempt_record_request(db, req, async |req| {
249249
with_coordinator(&factory.0, req, async |c, req| {
250250
c.compile(req).context(CompileSnafu).await
251251
})
@@ -260,7 +260,7 @@ async fn execute(
260260
Extension(db): Extension<Handle>,
261261
Json(req): Json<api::ExecuteRequest>,
262262
) -> Result<Json<api::ExecuteResponse>> {
263-
attempt_record_request(db, req, |req| async {
263+
attempt_record_request(db, req, async |req| {
264264
with_coordinator(&factory.0, req, async |c, req| {
265265
c.execute(req).context(ExecuteSnafu).await
266266
})
@@ -275,7 +275,7 @@ async fn format(
275275
Extension(db): Extension<Handle>,
276276
Json(req): Json<api::FormatRequest>,
277277
) -> Result<Json<api::FormatResponse>> {
278-
attempt_record_request(db, req, |req| async {
278+
attempt_record_request(db, req, async |req| {
279279
with_coordinator(&factory.0, req, async |c, req| {
280280
c.format(req).context(FormatSnafu).await
281281
})
@@ -290,7 +290,7 @@ async fn clippy(
290290
Extension(db): Extension<Handle>,
291291
Json(req): Json<api::ClippyRequest>,
292292
) -> Result<Json<api::ClippyResponse>> {
293-
attempt_record_request(db, req, |req| async {
293+
attempt_record_request(db, req, async |req| {
294294
with_coordinator(&factory.0, req, async |c, req| {
295295
c.clippy(req).context(ClippySnafu).await
296296
})
@@ -305,7 +305,7 @@ async fn miri(
305305
Extension(db): Extension<Handle>,
306306
Json(req): Json<api::MiriRequest>,
307307
) -> Result<Json<api::MiriResponse>> {
308-
attempt_record_request(db, req, |req| async {
308+
attempt_record_request(db, req, async |req| {
309309
with_coordinator(&factory.0, req, async |c, req| {
310310
c.miri(req).context(MiriSnafu).await
311311
})
@@ -320,7 +320,7 @@ async fn macro_expansion(
320320
Extension(db): Extension<Handle>,
321321
Json(req): Json<api::MacroExpansionRequest>,
322322
) -> Result<Json<api::MacroExpansionResponse>> {
323-
attempt_record_request(db, req, |req| async {
323+
attempt_record_request(db, req, async |req| {
324324
with_coordinator(&factory.0, req, async |c, req| {
325325
c.macro_expansion(req).context(MacroExpansionSnafu).await
326326
})

ui/src/server_axum/websocket.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -570,7 +570,7 @@ async fn handle_msg(
570570
.spawn({
571571
let tx = tx.clone();
572572
let meta = meta.clone();
573-
|coordinator| async {
573+
async |coordinator| {
574574
let r = handle_execute(
575575
token,
576576
execution_rx,
@@ -708,13 +708,13 @@ async fn handle_execute_inner(
708708

709709
let mut stdin_tx = Some(stdin_tx);
710710

711-
let send_stdout = |payload| async {
711+
let send_stdout = async |payload| {
712712
let meta = meta.clone();
713713
tx.send(Ok(MessageResponse::ExecuteStdout { payload, meta }))
714714
.await
715715
};
716716

717-
let send_stderr = |payload| async {
717+
let send_stderr = async |payload| {
718718
let meta = meta.clone();
719719
tx.send(Ok(MessageResponse::ExecuteStderr { payload, meta }))
720720
.await

0 commit comments

Comments
 (0)