cleanup: replace as[_mut]_slice() calls with deref coercions

This commit is contained in:
Jorge Aparicio
2015-02-01 21:53:25 -05:00
parent 2c05354211
commit 17bc7d8d5b
289 changed files with 1372 additions and 1406 deletions

View File

@@ -34,6 +34,6 @@ pub fn expand_cfg<'cx>(cx: &mut ExtCtxt,
return DummyResult::expr(sp);
}
let matches_cfg = attr::cfg_matches(&cx.parse_sess.span_diagnostic, cx.cfg.as_slice(), &*cfg);
let matches_cfg = attr::cfg_matches(&cx.parse_sess.span_diagnostic, &cx.cfg, &*cfg);
MacExpr::new(cx.expr_bool(sp, matches_cfg))
}

View File

@@ -25,7 +25,7 @@ pub fn expand(cx: &mut ExtCtxt, sp: Span, mi: &ast::MetaItem, it: P<ast::Item>)
};
let mut out = (*it).clone();
if attr::cfg_matches(&cx.parse_sess.span_diagnostic, cx.cfg.as_slice(), &**cfg) {
if attr::cfg_matches(&cx.parse_sess.span_diagnostic, &cx.cfg, &**cfg) {
out.attrs.push(cx.attribute(attr.span, attr.clone()));
}

View File

@@ -28,14 +28,14 @@ pub fn expand_deriving_bound<F>(cx: &mut ExtCtxt,
"Copy" => "Copy",
"Send" | "Sync" => {
return cx.span_err(span,
format!("{} is an unsafe trait and it \
should be implemented explicitly",
*tname).as_slice())
&format!("{} is an unsafe trait and it \
should be implemented explicitly",
*tname))
}
ref tname => {
cx.span_bug(span,
format!("expected built-in trait name but \
found {}", *tname).as_slice())
&format!("expected built-in trait name but \
found {}", *tname))
}
}
},

View File

@@ -247,7 +247,7 @@ impl<'a> LifetimeBounds<'a> {
mk_ty_param(cx,
span,
*name,
bounds.as_slice(),
bounds,
self_ty,
self_generics)
}

View File

@@ -664,7 +664,7 @@ pub fn expand_item_mac(it: P<ast::Item>,
id: ast::DUMMY_NODE_ID,
span: it.span,
imported_from: None,
export: attr::contains_name(it.attrs.as_slice(), "macro_export"),
export: attr::contains_name(&it.attrs, "macro_export"),
use_locally: true,
body: tts,
};

View File

@@ -319,11 +319,11 @@ fn check_matcher<'a, I>(cx: &mut ExtCtxt, matcher: I, follow: &Token)
Some(&&TtToken(_, ref tok)) => tok.clone(),
Some(&&TtSequence(sp, _)) => {
cx.span_err(sp,
format!("`${0}:{1}` is followed by a \
sequence repetition, which is not \
allowed for `{1}` fragments",
name.as_str(), frag_spec.as_str())
.as_slice());
&format!("`${0}:{1}` is followed by a \
sequence repetition, which is not \
allowed for `{1}` fragments",
name.as_str(), frag_spec.as_str())
);
Eof
},
// die next iteration
@@ -338,14 +338,14 @@ fn check_matcher<'a, I>(cx: &mut ExtCtxt, matcher: I, follow: &Token)
(&Eof, _) => return Some((sp, tok.clone())),
(_, Ok(true)) => continue,
(next, Ok(false)) => {
cx.span_err(sp, format!("`${0}:{1}` is followed by `{2}`, which \
is not allowed for `{1}` fragments",
cx.span_err(sp, &format!("`${0}:{1}` is followed by `{2}`, which \
is not allowed for `{1}` fragments",
name.as_str(), frag_spec.as_str(),
token_to_string(next)).as_slice());
token_to_string(next)));
continue
},
(_, Err(msg)) => {
cx.span_err(sp, msg.as_slice());
cx.span_err(sp, &msg);
continue
}
}