We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
asyncness
1 parent 854cdff commit 841bff2Copy full SHA for 841bff2
src/librustdoc/clean/mod.rs
@@ -1183,7 +1183,13 @@ 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 isn't an `impl Trait`, we can safely assume that this
1187
+ // function isn't async without needing to execute the query `asyncness` at
1188
+ // all which gives us a noticeable performance boost.
1189
+ if let Some(did) = did
1190
+ && let Type::ImplTrait(_) = output
1191
+ && cx.tcx.asyncness(did).is_async()
1192
+ {
1193
output = output.sugared_async_return_type();
1194
}
1195
0 commit comments