Skip to content

Commit 2885c67

Browse files
committed
Don't warn about unused vars whose name starts with _
Closes #832
1 parent 117d21d commit 2885c67

File tree

1 file changed

+3
-2
lines changed
  • src/comp/middle/tstate

1 file changed

+3
-2
lines changed

src/comp/middle/tstate/ck.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,9 @@ fn check_unused_vars(fcx: &fn_ctxt) {
5252
for c: norm_constraint in constraints(fcx) {
5353
alt c.c.node {
5454
ninit(id, v) {
55-
if !vec_contains(fcx.enclosing.used_vars, id) {
56-
fcx.ccx.tcx.sess.span_warn(c.c.span, "Unused variable " + v);
55+
if !vec_contains(fcx.enclosing.used_vars, id) &&
56+
v.(0) != ('_' as u8) {
57+
fcx.ccx.tcx.sess.span_warn(c.c.span, "unused variable " + v);
5758
}
5859
}
5960
_ {/* ignore pred constraints */ }

0 commit comments

Comments
 (0)