1
Fork 0

use slicing sugar

This commit is contained in:
Jorge Aparicio 2015-01-07 11:58:31 -05:00
parent 6e2bfe4ae8
commit 517f1cc63c
198 changed files with 2383 additions and 2405 deletions

View file

@ -40,7 +40,7 @@ pub fn maybe_inject_prelude(krate: ast::Crate) -> ast::Crate {
}
fn use_std(krate: &ast::Crate) -> bool {
!attr::contains_name(krate.attrs.index(&FullRange), "no_std")
!attr::contains_name(&krate.attrs[], "no_std")
}
fn no_prelude(attrs: &[ast::Attribute]) -> bool {
@ -56,7 +56,7 @@ impl<'a> fold::Folder for StandardLibraryInjector<'a> {
// The name to use in `extern crate "name" as std;`
let actual_crate_name = match self.alt_std_name {
Some(ref s) => token::intern_and_get_ident(s.index(&FullRange)),
Some(ref s) => token::intern_and_get_ident(&s[]),
None => token::intern_and_get_ident("std"),
};
@ -104,7 +104,7 @@ impl<'a> fold::Folder for PreludeInjector<'a> {
attr::mark_used(&no_std_attr);
krate.attrs.push(no_std_attr);
if !no_prelude(krate.attrs.index(&FullRange)) {
if !no_prelude(&krate.attrs[]) {
// only add `use std::prelude::*;` if there wasn't a
// `#![no_implicit_prelude]` at the crate level.
// fold_mod() will insert glob path.
@ -124,7 +124,7 @@ impl<'a> fold::Folder for PreludeInjector<'a> {
}
fn fold_item(&mut self, item: P<ast::Item>) -> SmallVector<P<ast::Item>> {
if !no_prelude(item.attrs.index(&FullRange)) {
if !no_prelude(&item.attrs[]) {
// only recur if there wasn't `#![no_implicit_prelude]`
// on this item, i.e. this means that the prelude is not
// implicitly imported though the whole subtree