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
|
@ -68,6 +68,7 @@ use std::fmt::Show;
|
|||
use std::num::Int;
|
||||
use std::rc::Rc;
|
||||
use serialize::{Encodable, Decodable, Encoder, Decoder};
|
||||
use std::ops::Deref;
|
||||
|
||||
// FIXME #6993: in librustc, uses of "ident" should be replaced
|
||||
// by just "Name".
|
||||
|
@ -112,13 +113,13 @@ impl fmt::Display for Ident {
|
|||
impl fmt::Debug for Name {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
let Name(nm) = *self;
|
||||
write!(f, "{:?}({})", token::get_name(*self).get(), nm)
|
||||
write!(f, "{:?}({})", token::get_name(*self).deref(), nm)
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Display for Name {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
fmt::Display::fmt(token::get_name(*self).get(), f)
|
||||
fmt::Display::fmt(token::get_name(*self).deref(), f)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -174,7 +175,7 @@ impl Name {
|
|||
pub fn as_str<'a>(&'a self) -> &'a str {
|
||||
unsafe {
|
||||
// FIXME #12938: can't use copy_lifetime since &str isn't a &T
|
||||
::std::mem::transmute::<&str,&str>(token::get_name(*self).get())
|
||||
::std::mem::transmute::<&str,&str>(token::get_name(*self).deref())
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -193,7 +194,7 @@ pub type Mrk = u32;
|
|||
|
||||
impl Encodable for Ident {
|
||||
fn encode<S: Encoder>(&self, s: &mut S) -> Result<(), S::Error> {
|
||||
s.emit_str(token::get_ident(*self).get())
|
||||
s.emit_str(token::get_ident(*self).deref())
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue