Replace the get method by the deref one on InternedString
This commit is contained in:
parent
966e6c0c37
commit
d58c0a7597
24 changed files with 123 additions and 104 deletions
|
@ -10,6 +10,8 @@
|
|||
|
||||
use std::cell::RefCell;
|
||||
use std::collections::BTreeMap;
|
||||
use std::ops::Deref;
|
||||
|
||||
use ast;
|
||||
use ast::{Ident, Name, TokenTree};
|
||||
use codemap::Span;
|
||||
|
@ -57,7 +59,7 @@ pub fn expand_diagnostic_used<'cx>(ecx: &'cx mut ExtCtxt,
|
|||
match diagnostics.insert(code.name, span) {
|
||||
Some(previous_span) => {
|
||||
ecx.span_warn(span, &format!(
|
||||
"diagnostic code {} already used", token::get_ident(code).get()
|
||||
"diagnostic code {} already used", token::get_ident(code).deref()
|
||||
)[]);
|
||||
ecx.span_note(previous_span, "previous invocation");
|
||||
},
|
||||
|
@ -68,7 +70,7 @@ pub fn expand_diagnostic_used<'cx>(ecx: &'cx mut ExtCtxt,
|
|||
with_registered_diagnostics(|diagnostics| {
|
||||
if !diagnostics.contains_key(&code.name) {
|
||||
ecx.span_err(span, &format!(
|
||||
"used diagnostic code {} not registered", token::get_ident(code).get()
|
||||
"used diagnostic code {} not registered", token::get_ident(code).deref()
|
||||
)[]);
|
||||
}
|
||||
});
|
||||
|
@ -93,12 +95,12 @@ pub fn expand_register_diagnostic<'cx>(ecx: &'cx mut ExtCtxt,
|
|||
with_registered_diagnostics(|diagnostics| {
|
||||
if diagnostics.insert(code.name, description).is_some() {
|
||||
ecx.span_err(span, &format!(
|
||||
"diagnostic code {} already registered", token::get_ident(*code).get()
|
||||
"diagnostic code {} already registered", token::get_ident(*code).deref()
|
||||
)[]);
|
||||
}
|
||||
});
|
||||
let sym = Ident::new(token::gensym(&(
|
||||
"__register_diagnostic_".to_string() + token::get_ident(*code).get()
|
||||
"__register_diagnostic_".to_string() + token::get_ident(*code).deref()
|
||||
)[]));
|
||||
MacItems::new(vec![quote_item!(ecx, mod $sym {}).unwrap()].into_iter())
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue