mirror of
https://github.com/servo/servo.git
synced 2025-08-02 20:20:14 +01:00
Upgrade to rustc 551a74dddd84cf01440ee84148ebd18bc68bd7c8.
This commit is contained in:
parent
7b87085c18
commit
ef8edd4e87
168 changed files with 2247 additions and 2408 deletions
|
@ -11,17 +11,17 @@ use syntax::parse::token;
|
|||
|
||||
pub fn expand_lower<'cx>(cx: &'cx mut ExtCtxt, sp: Span, tts: &[ast::TokenTree])
|
||||
-> Box<base::MacResult + 'cx> {
|
||||
expand_cased(cx, sp, tts, |c| { c.to_lowercase() })
|
||||
expand_cased(cx, sp, tts, |s| { s.to_lowercase() })
|
||||
}
|
||||
|
||||
pub fn expand_upper<'cx>(cx: &'cx mut ExtCtxt, sp: Span, tts: &[ast::TokenTree])
|
||||
-> Box<base::MacResult + 'cx> {
|
||||
expand_cased(cx, sp, tts, |c| { c.to_uppercase() })
|
||||
expand_cased(cx, sp, tts, |s| { s.to_uppercase() })
|
||||
}
|
||||
|
||||
fn expand_cased<'cx, T>(cx: &'cx mut ExtCtxt, sp: Span, tts: &[ast::TokenTree], transform: T)
|
||||
-> Box<base::MacResult + 'cx>
|
||||
where T: Fn(char) -> char
|
||||
where T: Fn(&str) -> String
|
||||
{
|
||||
let es = match base::get_exprs_from_tts(cx, sp, tts) {
|
||||
Some(e) => e,
|
||||
|
@ -47,8 +47,7 @@ fn expand_cased<'cx, T>(cx: &'cx mut ExtCtxt, sp: Span, tts: &[ast::TokenTree],
|
|||
};
|
||||
match (res, it.count()) {
|
||||
(Some((s, span)), 0) => {
|
||||
let new_s = s.chars().map(transform).collect::<String>();
|
||||
base::MacEager::expr(cx.expr_str(span, token::intern_and_get_ident(&new_s)))
|
||||
base::MacEager::expr(cx.expr_str(span, token::intern_and_get_ident(&transform(&s))))
|
||||
}
|
||||
(_, rest) => {
|
||||
if rest > 0 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue