Reindent code

This commit is contained in:
Seo Sanghyeon
2015-11-14 19:18:32 +09:00
parent fdadba5786
commit 289b1b400a

View File

@@ -169,17 +169,17 @@ fn generic_extension<'cx>(cx: &'cx ExtCtxt,
let mut best_fail_msg = "internal error: ran no matchers".to_string(); let mut best_fail_msg = "internal error: ran no matchers".to_string();
for (i, lhs) in lhses.iter().enumerate() { // try each arm's matchers for (i, lhs) in lhses.iter().enumerate() { // try each arm's matchers
let lhs_tt = match *lhs { let lhs_tt = match *lhs {
TokenTree::Delimited(_, ref delim) => &delim.tts[..], TokenTree::Delimited(_, ref delim) => &delim.tts[..],
_ => panic!(cx.span_fatal(sp, "malformed macro lhs")) _ => panic!(cx.span_fatal(sp, "malformed macro lhs"))
}; };
match TokenTree::parse(cx, lhs_tt, arg) { match TokenTree::parse(cx, lhs_tt, arg) {
Success(named_matches) => { Success(named_matches) => {
let rhs = match rhses[i] { let rhs = match rhses[i] {
// ignore delimiters // ignore delimiters
TokenTree::Delimited(_, ref delimed) => delimed.tts.clone(), TokenTree::Delimited(_, ref delimed) => delimed.tts.clone(),
_ => panic!(cx.span_fatal(sp, "macro rhs must be delimited")), _ => panic!(cx.span_fatal(sp, "macro rhs must be delimited")),
}; };
// rhs has holes ( `$id` and `$(...)` that need filled) // rhs has holes ( `$id` and `$(...)` that need filled)
let trncbr = new_tt_reader(&cx.parse_sess().span_diagnostic, let trncbr = new_tt_reader(&cx.parse_sess().span_diagnostic,
@@ -199,15 +199,15 @@ fn generic_extension<'cx>(cx: &'cx ExtCtxt,
site_span: sp, site_span: sp,
macro_ident: name macro_ident: name
}) })
} }
Failure(sp, ref msg) => if sp.lo >= best_fail_spot.lo { Failure(sp, ref msg) => if sp.lo >= best_fail_spot.lo {
best_fail_spot = sp; best_fail_spot = sp;
best_fail_msg = (*msg).clone(); best_fail_msg = (*msg).clone();
}, },
Error(err_sp, ref msg) => { Error(err_sp, ref msg) => {
panic!(cx.span_fatal(err_sp.substitute_dummy(sp), &msg[..])) panic!(cx.span_fatal(err_sp.substitute_dummy(sp), &msg[..]))
}
} }
}
} }
panic!(cx.span_fatal(best_fail_spot.substitute_dummy(sp), &best_fail_msg[..])); panic!(cx.span_fatal(best_fail_spot.substitute_dummy(sp), &best_fail_msg[..]));
@@ -310,14 +310,14 @@ fn check_lhs_nt_follows(cx: &mut ExtCtxt, lhs: &TokenTree, sp: Span) {
// lhs is going to be like TokenTree::Delimited(...), where the // lhs is going to be like TokenTree::Delimited(...), where the
// entire lhs is those tts. Or, it can be a "bare sequence", not wrapped in parens. // entire lhs is those tts. Or, it can be a "bare sequence", not wrapped in parens.
match lhs { match lhs {
&TokenTree::Delimited(_, ref tts) => { &TokenTree::Delimited(_, ref tts) => {
check_matcher(cx, tts.tts.iter(), &Eof); check_matcher(cx, tts.tts.iter(), &Eof);
}, },
tt @ &TokenTree::Sequence(..) => { tt @ &TokenTree::Sequence(..) => {
check_matcher(cx, Some(tt).into_iter(), &Eof); check_matcher(cx, Some(tt).into_iter(), &Eof);
}, },
_ => cx.span_err(sp, "Invalid macro matcher; matchers must be contained \ _ => cx.span_err(sp, "Invalid macro matcher; matchers must be contained \
in balanced delimiters or a repetition indicator") in balanced delimiters or a repetition indicator")
}; };
// we don't abort on errors on rejection, the driver will do that for us // we don't abort on errors on rejection, the driver will do that for us
// after parsing/expansion. we can report every error in every macro this way. // after parsing/expansion. we can report every error in every macro this way.