diff options
| author | Oliver Schneider <git-spam9815368754983@oli-obk.de> | 2015-07-28 18:07:20 +0200 |
|---|---|---|
| committer | Oliver Schneider <git-spam9815368754983@oli-obk.de> | 2015-07-28 18:07:20 +0200 |
| commit | 00a5e66f818ad9d79cc4425f5564c7b07e3213a6 (patch) | |
| tree | f97ac3137f954aaf4866484a7de6f420280b9125 /src/test | |
| parent | 9ca511cf63c3611ffae9218945724c1b32025688 (diff) | |
| download | rust-00a5e66f818ad9d79cc4425f5564c7b07e3213a6.tar.gz rust-00a5e66f818ad9d79cc4425f5564c7b07e3213a6.zip | |
remove `get_ident` and `get_name`, make `as_str` sound
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/auxiliary/lint_group_plugin_test.rs | 10 | ||||
| -rw-r--r-- | src/test/auxiliary/lint_plugin_test.rs | 4 | ||||
| -rw-r--r-- | src/test/auxiliary/roman_numerals.rs | 4 |
3 files changed, 7 insertions, 11 deletions
diff --git a/src/test/auxiliary/lint_group_plugin_test.rs b/src/test/auxiliary/lint_group_plugin_test.rs index ca5a7b75e06..11de43a6b92 100644 --- a/src/test/auxiliary/lint_group_plugin_test.rs +++ b/src/test/auxiliary/lint_group_plugin_test.rs @@ -20,7 +20,6 @@ extern crate syntax; extern crate rustc; use syntax::ast; -use syntax::parse::token; use rustc::lint::{Context, LintPass, LintPassObject, LintArray}; use rustc::plugin::Registry; @@ -36,11 +35,10 @@ impl LintPass for Pass { } fn check_item(&mut self, cx: &Context, it: &ast::Item) { - let name = token::get_ident(it.ident); - if &name[..] == "lintme" { - cx.span_lint(TEST_LINT, it.span, "item is named 'lintme'"); - } else if &name[..] == "pleaselintme" { - cx.span_lint(PLEASE_LINT, it.span, "item is named 'pleaselintme'"); + match &*it.ident.name.as_str() { + "lintme" => cx.span_lint(TEST_LINT, it.span, "item is named 'lintme'"), + "pleaselintme" => cx.span_lint(PLEASE_LINT, it.span, "item is named 'pleaselintme'"), + _ => {} } } } diff --git a/src/test/auxiliary/lint_plugin_test.rs b/src/test/auxiliary/lint_plugin_test.rs index 20799ce5b46..967b168d000 100644 --- a/src/test/auxiliary/lint_plugin_test.rs +++ b/src/test/auxiliary/lint_plugin_test.rs @@ -20,7 +20,6 @@ extern crate syntax; extern crate rustc; use syntax::ast; -use syntax::parse::token; use rustc::lint::{Context, LintPass, LintPassObject, LintArray}; use rustc::plugin::Registry; @@ -34,8 +33,7 @@ impl LintPass for Pass { } fn check_item(&mut self, cx: &Context, it: &ast::Item) { - let name = token::get_ident(it.ident); - if &name[..] == "lintme" { + if it.ident.name == "lintme" { cx.span_lint(TEST_LINT, it.span, "item is named 'lintme'"); } } diff --git a/src/test/auxiliary/roman_numerals.rs b/src/test/auxiliary/roman_numerals.rs index 855708535f1..e6f375354aa 100644 --- a/src/test/auxiliary/roman_numerals.rs +++ b/src/test/auxiliary/roman_numerals.rs @@ -18,8 +18,8 @@ extern crate syntax; extern crate rustc; use syntax::codemap::Span; -use syntax::parse::token; use syntax::ast::{TokenTree, TtToken}; +use syntax::parse::token; use syntax::ext::base::{ExtCtxt, MacResult, DummyResult, MacEager}; use syntax::ext::build::AstBuilder; // trait for expr_usize use rustc::plugin::Registry; @@ -40,7 +40,7 @@ fn expand_rn(cx: &mut ExtCtxt, sp: Span, args: &[TokenTree]) ("I", 1)]; let text = match args { - [TtToken(_, token::Ident(s, _))] => token::get_ident(s).to_string(), + [TtToken(_, token::Ident(s, _))] => s.to_string(), _ => { cx.span_err(sp, "argument should be a single identifier"); return DummyResult::any(sp); |
