We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
asyncness
1 parent 854cdff commit 1f2ade0Copy full SHA for 1f2ade0
src/librustdoc/clean/mod.rs
@@ -1183,7 +1183,12 @@ fn clean_fn_decl_from_did_and_sig<'tcx>(
1183
// but shouldn't change any code meaning.
1184
let mut output = clean_middle_ty(sig.output(), cx, None, None);
1185
1186
- if let Some(did) = did && cx.tcx.asyncness(did).is_async() {
+ // If the return type is not an `impl Trait`, we can safely assume that this function isn't async
1187
+ // without needing to execute the `asyncness` query which gives us a slight performance boost.
1188
+ if let Some(did) = did
1189
+ && let Type::ImplTrait(_) = output
1190
+ && cx.tcx.asyncness(did).is_async()
1191
+ {
1192
output = output.sugared_async_return_type();
1193
}
1194
0 commit comments