Remove some as_slice calls.

This commit is contained in:
Ms2ger 2015-04-24 17:40:22 +02:00
parent 4ee89363fb
commit 6a55ae06d7
34 changed files with 79 additions and 79 deletions

View file

@ -48,11 +48,11 @@ 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.as_slice())))
base::MacEager::expr(cx.expr_str(span, token::intern_and_get_ident(&new_s)))
}
(_, rest) => {
if rest > 0 {
cx.span_err(sp, format!("expected 1 argument, found {}", rest+1).as_slice());
cx.span_err(sp, &format!("expected 1 argument, found {}", rest+1));
}
base::DummyResult::expr(sp)
}

View file

@ -12,7 +12,7 @@
//! - `#[dom_struct]` : Implies `#[privatize]`,`#[jstraceable]`, and `#[must_root]`.
//! Use this for structs that correspond to a DOM type
#![feature(plugin_registrar, quote, plugin, box_syntax, rustc_private, core, unicode)]
#![feature(plugin_registrar, quote, plugin, box_syntax, rustc_private, unicode)]
#[macro_use]
extern crate syntax;

View file

@ -32,10 +32,10 @@ impl LintPass for TransmutePass {
&& args.len() == 1 {
let tcx = cx.tcx;
cx.span_lint(TRANSMUTE_TYPE_LINT, ex.span,
format!("Transmute to {} from {} detected",
&format!("Transmute to {} from {} detected",
expr_ty(tcx, ex).repr(tcx),
expr_ty(tcx, &**args.get(0).unwrap()).repr(tcx)
).as_slice());
));
}
}
_ => {}

View file

@ -150,7 +150,7 @@ impl LintPass for UnrootedPass {
ty::ty_enum(did, _) => {
if ty::has_attr(cx.tcx, did, "must_root") {
cx.span_lint(UNROOTED_MUST_ROOT, expr.span,
format!("Expression of type {} must be rooted", t.repr(cx.tcx)).as_slice());
&format!("Expression of type {} must be rooted", t.repr(cx.tcx)));
}
}
_ => {}

View file

@ -22,9 +22,9 @@ pub fn match_ty_unwrap<'a>(ty: &'a Ty, segments: &[&str]) -> Option<&'a [P<Ty>]>
// however the more efficient way is to simply reverse the iterators and zip them
// which will compare them in reverse until one of them runs out of segments
if seg.iter().rev().zip(segments.iter().rev()).all(|(a,b)| a.identifier.as_str() == *b) {
match seg.as_slice().last() {
match seg.last() {
Some(&PathSegment {parameters: AngleBracketedParameters(ref a), ..}) => {
Some(a.types.as_slice())
Some(&a.types)
}
_ => None
}