Files
Matt MastracciandGitHub 1bc8f55993 Add Err(anyhow(... ast-grep rule (#90869)
# What

Add an ast-grep rule to use `bail!` rather than `Err(anyhow!(` in a
return position.

# Why

This is slightly more compact, and allows us to port more code over to
turbofmt/turbobail.

Note: _this PR was previously merged into another branch due to a GH
bug_
2026-03-04 09:08:55 -07:00

283 lines
6.7 KiB
YAML

id: no-map-async-cell
snapshots:
? |
items.into_iter()
.map(async |item| Ok(item.process().await?.cell()))
.try_join()
.await
: labels:
- source: item.process().await?.cell()
style: primary
start: 43
end: 71
- source: |-
items.into_iter()
.map(async |item| Ok(item.process().await?.cell()))
style: secondary
start: 0
end: 73
- source: async |item| Ok(item.process().await?.cell())
style: secondary
start: 27
end: 72
? |
items.into_iter()
.map(async |item| item.process().await.cell())
.try_join()
.await
: labels:
- source: |-
items.into_iter()
.map(async |item| item.process().await.cell())
style: primary
start: 0
end: 68
- source: item.process().await.cell()
style: secondary
start: 40
end: 67
? |
items.into_iter()
.map(async |item| {
Ok(item.process().await?.cell())
})
.try_join()
.await
: labels:
- source: item.process().await?.cell()
style: primary
start: 53
end: 81
- source: |-
items.into_iter()
.map(async |item| {
Ok(item.process().await?.cell())
})
style: secondary
start: 0
end: 89
- source: |-
async |item| {
Ok(item.process().await?.cell())
}
style: secondary
start: 27
end: 88
? |
items.into_iter()
.map(async |item| {
item.process().await.cell()
})
.try_join()
.await
: labels:
- source: |-
items.into_iter()
.map(async |item| {
item.process().await.cell()
})
style: primary
start: 0
end: 84
- source: item.process().await.cell()
style: secondary
start: 50
end: 77
? |
items.into_iter()
.map(|item| async move {
Ok(item.process().await?.cell())
})
.try_join()
.await
: labels:
- source: item.process().await?.cell()
style: primary
start: 58
end: 86
- source: |-
items.into_iter()
.map(|item| async move {
Ok(item.process().await?.cell())
})
style: secondary
start: 0
end: 94
- source: |-
|item| async move {
Ok(item.process().await?.cell())
}
style: secondary
start: 27
end: 93
? |
items.into_iter()
.map(|item| async {
Ok(item.process().await?.cell())
})
.try_join()
.await
: labels:
- source: item.process().await?.cell()
style: primary
start: 53
end: 81
- source: |-
items.into_iter()
.map(|item| async {
Ok(item.process().await?.cell())
})
style: secondary
start: 0
end: 89
- source: |-
|item| async {
Ok(item.process().await?.cell())
}
style: secondary
start: 27
end: 88
? |
map.into_iter()
.map(|(ty, items)| {
(
ty,
ChunkItemBatchGroup {
items,
chunk_groups: this.chunk_groups.clone(),
},
)
})
.map(async |(ty, batch_group)| Ok((ty, batch_group.resolved_cell())))
.try_join()
: labels:
- source: batch_group.resolved_cell()
style: primary
start: 256
end: 283
- source: |-
map.into_iter()
.map(|(ty, items)| {
(
ty,
ChunkItemBatchGroup {
items,
chunk_groups: this.chunk_groups.clone(),
},
)
})
.map(async |(ty, batch_group)| Ok((ty, batch_group.resolved_cell())))
style: secondary
start: 0
end: 286
- source: async |(ty, batch_group)| Ok((ty, batch_group.resolved_cell()))
style: secondary
start: 222
end: 285
? |
modules
.map(async |module| {
let result = module.compute().await?;
result.into_value().cell()
})
: labels:
- source: result.into_value().cell()
style: primary
start: 88
end: 114
- source: |-
modules
.map(async |module| {
let result = module.compute().await?;
result.into_value().cell()
})
style: secondary
start: 0
end: 121
- source: |-
async |module| {
let result = module.compute().await?;
result.into_value().cell()
}
style: secondary
start: 17
end: 120
? |
modules
.map(async |module| {
let result = module.compute().await?;
result.into_value().cell()
})
.try_join()
: labels:
- source: |-
modules
.map(async |module| {
let result = module.compute().await?;
result.into_value().cell()
})
style: primary
start: 0
end: 121
- source: result.into_value().cell()
style: secondary
start: 88
end: 114
? |
paths.map(async |(path, asset)| {
AssetBinding {
name: wasm_edge_var_name(Vc::upcast(*asset)).owned().await?,
}.cell()
})
: labels:
- source: |-
paths.map(async |(path, asset)| {
AssetBinding {
name: wasm_edge_var_name(Vc::upcast(*asset)).owned().await?,
}.cell()
})
style: primary
start: 0
end: 137
- source: |-
AssetBinding {
name: wasm_edge_var_name(Vc::upcast(*asset)).owned().await?,
}.cell()
style: secondary
start: 38
end: 134
? |
paths.map(async |(path, asset)| {
Ok(AssetBinding {
name: wasm_edge_var_name(Vc::upcast(*asset)).owned().await?,
}.cell())
})
.try_join()
.await
: labels:
- source: |-
AssetBinding {
name: wasm_edge_var_name(Vc::upcast(*asset)).owned().await?,
}.cell()
style: primary
start: 41
end: 137
- source: |-
paths.map(async |(path, asset)| {
Ok(AssetBinding {
name: wasm_edge_var_name(Vc::upcast(*asset)).owned().await?,
}.cell())
})
style: secondary
start: 0
end: 141
- source: |-
async |(path, asset)| {
Ok(AssetBinding {
name: wasm_edge_var_name(Vc::upcast(*asset)).owned().await?,
}.cell())
}
style: secondary
start: 10
end: 140