Skip to content

Commit 1e9d5c7

Browse files
committed
Minor stylistic / review changes
1 parent bf04b04 commit 1e9d5c7

File tree

1 file changed

+10
-14
lines changed
  • compiler/rustc_typeck/src/check

1 file changed

+10
-14
lines changed

compiler/rustc_typeck/src/check/mod.rs

+10-14
Original file line numberDiff line numberDiff line change
@@ -525,27 +525,23 @@ fn typeck_with_fallback<'tcx>(
525525
let expected_args = if let ImplicitSelfKind::None = decl.implicit_self { 1 } else { 2 };
526526

527527
let err = || {
528-
if let Node::Item(item) = tcx.hir().get(id) {
529-
if let hir::ItemKind::Fn(header, ..) = &item.kind {
530-
tcx.sess.span_err(header.span, "A function with the \"rust-call\" ABI must take a single non-self argument that is a tuple")
531-
}
528+
let item = tcx.hir().expect_item(id);
529+
530+
if let hir::ItemKind::Fn(header, ..) = &item.kind {
531+
tcx.sess.span_err(header.span, "A function with the \"rust-call\" ABI must take a single non-self argument that is a tuple")
532532
} else {
533-
bug!("Couldn't get span of FnHeader being checked")
533+
bug!("Item being checked wasn't a function")
534534
}
535535
};
536536

537537
if fn_sig.inputs().len() != expected_args {
538538
err()
539539
} else {
540-
match fn_sig.inputs()[expected_args - 1].kind() {
541-
ty::Tuple(_) => (),
542-
// FIXME(CraftSpider) Add a check on parameter expansion, so we don't just make the ICE happen later on
543-
// This will probably require wide-scale changes to support a TupleKind obligation
544-
// We can't resolve this without knowing the type of the param
545-
ty::Param(_) => (),
546-
_ => {
547-
err()
548-
}
540+
// FIXME(CraftSpider) Add a check on parameter expansion, so we don't just make the ICE happen later on
541+
// This will probably require wide-scale changes to support a TupleKind obligation
542+
// We can't resolve this without knowing the type of the param
543+
if !matches!(fn_sig.inputs()[expected_args - 1].kind(), ty::Tuple(_) | ty::Param(_)) {
544+
err()
549545
}
550546
}
551547
}

0 commit comments

Comments
 (0)