Don't warn about unused vars whose name starts with _

Closes #832
This commit is contained in:
Marijn Haverbeke 2011-08-18 09:20:39 +02:00
parent 117d21d6c2
commit 2885c67d47

View File

@ -52,8 +52,9 @@ fn check_unused_vars(fcx: &fn_ctxt) {
for c: norm_constraint in constraints(fcx) {
alt c.c.node {
ninit(id, v) {
if !vec_contains(fcx.enclosing.used_vars, id) {
fcx.ccx.tcx.sess.span_warn(c.c.span, "Unused variable " + v);
if !vec_contains(fcx.enclosing.used_vars, id) &&
v.(0) != ('_' as u8) {
fcx.ccx.tcx.sess.span_warn(c.c.span, "unused variable " + v);
}
}
_ {/* ignore pred constraints */ }