Skip to content

Commit dc29dea

Browse files
committed
Removing redundant "fail"s.
1 parent ad9afef commit dc29dea

File tree

2 files changed

+8
-19
lines changed

2 files changed

+8
-19
lines changed

src/comp/middle/ty.rs

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,6 @@ fn mk_mach(&ctxt cx, &util::common::ty_mach tm) -> t {
423423
case (ty_f32) { ret idx_f32; }
424424
case (ty_f64) { ret idx_f64; }
425425
}
426-
fail;
427426
}
428427

429428
fn mk_char(&ctxt cx) -> t { ret idx_char; }
@@ -895,7 +894,6 @@ fn type_is_structural(&ctxt cx, &t ty) -> bool {
895894
case (ty_obj(_)) { ret true; }
896895
case (_) { ret false; }
897896
}
898-
fail;
899897
}
900898

901899
fn type_is_sequence(&ctxt cx, &t ty) -> bool {
@@ -904,14 +902,17 @@ fn type_is_sequence(&ctxt cx, &t ty) -> bool {
904902
case (ty_vec(_)) { ret true; }
905903
case (_) { ret false; }
906904
}
907-
fail;
908905
}
909906

910907
fn sequence_element_type(&ctxt cx, &t ty) -> t {
911908
alt (struct(cx, ty)) {
912909
case (ty_str) { ret mk_mach(cx, common::ty_u8); }
913910
case (ty_vec(?mt)) { ret mt.ty; }
911+
// NB: This is not exhaustive.
914912
}
913+
914+
// FIXME: add sess.err or sess.span_err explaining failure (issue
915+
// #444)
915916
fail;
916917
}
917918

@@ -923,7 +924,6 @@ fn type_is_tup_like(&ctxt cx, &t ty) -> bool {
923924
case (ty_tag(_,_)) { ret true; }
924925
case (_) { ret false; }
925926
}
926-
fail;
927927
}
928928

929929
fn get_element_type(&ctxt cx, &t ty, uint i) -> t {
@@ -935,7 +935,11 @@ fn get_element_type(&ctxt cx, &t ty, uint i) -> t {
935935
case (ty_rec(?flds)) {
936936
ret flds.(i).mt.ty;
937937
}
938+
// NB: This is not exhaustive -- struct(cx, ty) could be a box or a
939+
// tag.
938940
}
941+
942+
// FIXME: add sess.err or sess.span_err explaining failure (issue #444)
939943
fail;
940944
}
941945

@@ -944,7 +948,6 @@ fn type_is_box(&ctxt cx, &t ty) -> bool {
944948
case (ty_box(_)) { ret true; }
945949
case (_) { ret false; }
946950
}
947-
fail;
948951
}
949952

950953
fn type_is_boxed(&ctxt cx, &t ty) -> bool {
@@ -957,7 +960,6 @@ fn type_is_boxed(&ctxt cx, &t ty) -> bool {
957960
case (ty_task) { ret true; }
958961
case (_) { ret false; }
959962
}
960-
fail;
961963
}
962964

963965
fn type_is_scalar(&ctxt cx, &t ty) -> bool {
@@ -973,10 +975,8 @@ fn type_is_scalar(&ctxt cx, &t ty) -> bool {
973975
case (ty_native) { ret true; }
974976
case (_) { ret false; }
975977
}
976-
fail;
977978
}
978979

979-
980980
fn type_has_pointers(&ctxt cx, &t ty) -> bool {
981981
alt (struct(cx, ty)) {
982982
// scalar types
@@ -1017,7 +1017,6 @@ fn type_has_pointers(&ctxt cx, &t ty) -> bool {
10171017
}
10181018
case (_) { ret true; }
10191019
}
1020-
fail;
10211020
}
10221021

10231022

@@ -1028,7 +1027,6 @@ fn type_is_native(&ctxt cx, &t ty) -> bool {
10281027
case (ty_native) { ret true; }
10291028
case (_) { ret false; }
10301029
}
1031-
fail;
10321030
}
10331031

10341032
fn type_has_dynamic_size(&ctxt cx, &t ty) -> bool {
@@ -1083,7 +1081,6 @@ fn type_is_integral(&ctxt cx, &t ty) -> bool {
10831081
case (ty_char) { ret true; }
10841082
case (_) { ret false; }
10851083
}
1086-
fail;
10871084
}
10881085

10891086
fn type_is_fp(&ctxt cx, &t ty) -> bool {
@@ -1100,7 +1097,6 @@ fn type_is_fp(&ctxt cx, &t ty) -> bool {
11001097
}
11011098
case (_) { ret false; }
11021099
}
1103-
fail;
11041100
}
11051101

11061102
fn type_is_signed(&ctxt cx, &t ty) -> bool {
@@ -1117,7 +1113,6 @@ fn type_is_signed(&ctxt cx, &t ty) -> bool {
11171113
}
11181114
case (_) { ret false; }
11191115
}
1120-
fail;
11211116
}
11221117

11231118
fn type_param(&ctxt cx, &t ty) -> option::t[uint] {
@@ -1656,7 +1651,6 @@ fn is_fn_ty(&ctxt cx, &t fty) -> bool {
16561651
case (ty::ty_native_fn(_, _, _)) { ret true; }
16571652
case (_) { ret false; }
16581653
}
1659-
ret false;
16601654
}
16611655

16621656

@@ -2642,9 +2636,6 @@ mod unify {
26422636
ret cx.handler.record_param(expected_id, actual);
26432637
}
26442638
}
2645-
2646-
// TODO: remove me once match-exhaustiveness checking works
2647-
fail;
26482639
}
26492640

26502641
// Performs type binding substitution.

src/comp/middle/typeck.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1578,8 +1578,6 @@ fn check_lit(@crate_ctxt ccx, &@ast::lit lit) -> ty::t {
15781578
case (ast::lit_nil) { ret ty::mk_nil(ccx.tcx); }
15791579
case (ast::lit_bool(_)) { ret ty::mk_bool(ccx.tcx); }
15801580
}
1581-
1582-
fail; // not reached
15831581
}
15841582

15851583
// Pattern checking is top-down rather than bottom-up so that bindings get

0 commit comments

Comments
 (0)