Skip to content

Commit fae8c23

Browse files
Fix tools
1 parent 733a447 commit fae8c23

File tree

4 files changed

+14
-9
lines changed

4 files changed

+14
-9
lines changed

src/librustdoc/clean/types.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ use rustc_resolve::rustdoc::{
3131
use rustc_session::Session;
3232
use rustc_span::hygiene::MacroKind;
3333
use rustc_span::symbol::{kw, sym, Ident, Symbol};
34-
use rustc_span::{self, FileName, Loc};
34+
use rustc_span::{self, FileName, Loc, DUMMY_SP};
3535
use rustc_target::abi::VariantIdx;
3636
use rustc_target::spec::abi::Abi;
3737

@@ -622,7 +622,7 @@ impl Item {
622622
fn build_fn_header(
623623
def_id: DefId,
624624
tcx: TyCtxt<'_>,
625-
asyncness: hir::IsAsync,
625+
asyncness: ty::Asyncness,
626626
) -> hir::FnHeader {
627627
let sig = tcx.fn_sig(def_id).skip_binder();
628628
let constness =
@@ -631,6 +631,10 @@ impl Item {
631631
} else {
632632
hir::Constness::NotConst
633633
};
634+
let asyncness = match asyncness {
635+
ty::Asyncness::Yes => hir::IsAsync::Async(DUMMY_SP),
636+
ty::Asyncness::No => hir::IsAsync::NotAsync,
637+
};
634638
hir::FnHeader { unsafety: sig.unsafety(), abi: sig.abi(), constness, asyncness }
635639
}
636640
let header = match *self.kind {

src/librustdoc/html/format.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1599,7 +1599,7 @@ impl PrintWithSpace for hir::Unsafety {
15991599
impl PrintWithSpace for hir::IsAsync {
16001600
fn print_with_space(&self) -> &str {
16011601
match self {
1602-
hir::IsAsync::Async => "async ",
1602+
hir::IsAsync::Async(_) => "async ",
16031603
hir::IsAsync::NotAsync => "",
16041604
}
16051605
}

src/tools/clippy/clippy_lints/src/redundant_closure_call.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ use rustc_hir::intravisit::{Visitor as HirVisitor, Visitor};
1010
use rustc_lint::{LateContext, LateLintPass};
1111
use rustc_middle::hir::nested_filter;
1212
use rustc_middle::lint::in_external_macro;
13+
use rustc_middle::ty;
1314
use rustc_session::{declare_lint_pass, declare_tool_lint};
1415

1516
declare_clippy_lint! {
@@ -84,7 +85,7 @@ fn find_innermost_closure<'tcx>(
8485
cx: &LateContext<'tcx>,
8586
mut expr: &'tcx hir::Expr<'tcx>,
8687
mut steps: usize,
87-
) -> Option<(&'tcx hir::Expr<'tcx>, &'tcx hir::FnDecl<'tcx>, hir::IsAsync)> {
88+
) -> Option<(&'tcx hir::Expr<'tcx>, &'tcx hir::FnDecl<'tcx>, ty::Asyncness)> {
8889
let mut data = None;
8990

9091
while let hir::ExprKind::Closure(closure) = expr.kind
@@ -98,9 +99,9 @@ fn find_innermost_closure<'tcx>(
9899
{
99100
expr = body.value;
100101
data = Some((body.value, closure.fn_decl, if is_async_closure(body) {
101-
hir::IsAsync::Async
102+
ty::Asyncness::Yes
102103
} else {
103-
hir::IsAsync::NotAsync
104+
ty::Asyncness::No
104105
}));
105106
steps -= 1;
106107
}

src/tools/clippy/clippy_utils/src/lib.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ use rustc_hir::intravisit::{walk_expr, FnKind, Visitor};
9090
use rustc_hir::LangItem::{OptionNone, OptionSome, ResultErr, ResultOk};
9191
use rustc_hir::{
9292
self as hir, def, Arm, ArrayLen, BindingAnnotation, Block, BlockCheckMode, Body, Closure, Destination, Expr,
93-
ExprField, ExprKind, FnDecl, FnRetTy, GenericArgs, HirId, Impl, ImplItem, ImplItemKind, ImplItemRef, IsAsync, Item,
93+
ExprField, ExprKind, FnDecl, FnRetTy, GenericArgs, HirId, Impl, ImplItem, ImplItemKind, ImplItemRef, Item,
9494
ItemKind, LangItem, Local, MatchSource, Mutability, Node, OwnerId, Param, Pat, PatKind, Path, PathSegment, PrimTy,
9595
QPath, Stmt, StmtKind, TraitItem, TraitItemKind, TraitItemRef, TraitRef, TyKind, UnOp,
9696
};
@@ -1958,8 +1958,8 @@ pub fn if_sequence<'tcx>(mut expr: &'tcx Expr<'tcx>) -> (Vec<&'tcx Expr<'tcx>>,
19581958
/// Checks if the given function kind is an async function.
19591959
pub fn is_async_fn(kind: FnKind<'_>) -> bool {
19601960
match kind {
1961-
FnKind::ItemFn(_, _, header) => header.asyncness == IsAsync::Async,
1962-
FnKind::Method(_, sig) => sig.header.asyncness == IsAsync::Async,
1961+
FnKind::ItemFn(_, _, header) => header.asyncness .is_async(),
1962+
FnKind::Method(_, sig) => sig.header.asyncness.is_async(),
19631963
FnKind::Closure => false,
19641964
}
19651965
}

0 commit comments

Comments
 (0)