1
Fork 0

trivial style fix

This commit is contained in:
yukang 2023-08-02 09:56:02 +08:00
parent f77c624c03
commit 026c4b6a65

View file

@ -555,7 +555,6 @@ impl<'a: 'ast, 'ast, 'tcx> LateResolutionVisitor<'a, '_, 'ast, 'tcx> {
} }
}) })
.collect::<Vec<_>>(); .collect::<Vec<_>>();
let crate_def_id = CRATE_DEF_ID.to_def_id();
// Try to filter out intrinsics candidates, as long as we have // Try to filter out intrinsics candidates, as long as we have
// some other candidates to suggest. // some other candidates to suggest.
let intrinsic_candidates: Vec<_> = candidates let intrinsic_candidates: Vec<_> = candidates
@ -566,8 +565,9 @@ impl<'a: 'ast, 'ast, 'tcx> LateResolutionVisitor<'a, '_, 'ast, 'tcx> {
.collect(); .collect();
if candidates.is_empty() { if candidates.is_empty() {
// Put them back if we have no more candidates to suggest... // Put them back if we have no more candidates to suggest...
candidates.extend(intrinsic_candidates); candidates = intrinsic_candidates;
} }
let crate_def_id = CRATE_DEF_ID.to_def_id();
if candidates.is_empty() && is_expected(Res::Def(DefKind::Enum, crate_def_id)) { if candidates.is_empty() && is_expected(Res::Def(DefKind::Enum, crate_def_id)) {
let mut enum_candidates: Vec<_> = self let mut enum_candidates: Vec<_> = self
.r .r
@ -1180,9 +1180,9 @@ impl<'a: 'ast, 'ast, 'tcx> LateResolutionVisitor<'a, '_, 'ast, 'tcx> {
/// return the span of whole call and the span for all arguments expect the first one (`self`). /// return the span of whole call and the span for all arguments expect the first one (`self`).
fn call_has_self_arg(&self, source: PathSource<'_>) -> Option<(Span, Option<Span>)> { fn call_has_self_arg(&self, source: PathSource<'_>) -> Option<(Span, Option<Span>)> {
let mut has_self_arg = None; let mut has_self_arg = None;
if let PathSource::Expr(Some(parent)) = source { if let PathSource::Expr(Some(parent)) = source
match &parent.kind { && let ExprKind::Call(_, args) = &parent.kind
ExprKind::Call(_, args) if !args.is_empty() => { && !args.is_empty() {
let mut expr_kind = &args[0].kind; let mut expr_kind = &args[0].kind;
loop { loop {
match expr_kind { match expr_kind {
@ -1208,9 +1208,6 @@ impl<'a: 'ast, 'ast, 'tcx> LateResolutionVisitor<'a, '_, 'ast, 'tcx> {
} }
} }
} }
_ => (),
}
};
has_self_arg has_self_arg
} }