Use a nicer Show impl for Name
This commit is contained in:
parent
ca0b65402b
commit
2dfbe7f989
@ -547,7 +547,7 @@ mod test {
|
||||
let path = &"./tmp/mk_rm_dir".to_c_str();
|
||||
let mode = S_IWUSR | S_IRUSR;
|
||||
|
||||
let result = FsRequest::mkdir(l(), path, mode);
|
||||
let result = FsRequest::mkdir(l(), path, mode as c_int);
|
||||
assert!(result.is_ok());
|
||||
|
||||
let result = FsRequest::rmdir(l(), path);
|
||||
|
@ -58,7 +58,14 @@ impl Ident {
|
||||
|
||||
impl Show for Ident {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(f, "\"{}\"#{}", token::get_ident(*self).get(), self.ctxt)
|
||||
write!(f, "{}#{}", self.name, self.ctxt)
|
||||
}
|
||||
}
|
||||
|
||||
impl Show for Name {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
let Name(nm) = *self;
|
||||
write!(f, "\"{}\"({})", token::get_name(*self).get(), nm)
|
||||
}
|
||||
}
|
||||
|
||||
@ -106,7 +113,7 @@ pub static ILLEGAL_CTXT : SyntaxContext = 1;
|
||||
|
||||
/// A name is a part of an identifier, representing a string or gensym. It's
|
||||
/// the result of interning.
|
||||
#[deriving(Eq, Ord, PartialEq, PartialOrd, Hash, Encodable, Decodable, Clone, Show)]
|
||||
#[deriving(Eq, Ord, PartialEq, PartialOrd, Hash, Encodable, Decodable, Clone)]
|
||||
pub struct Name(pub u32);
|
||||
|
||||
impl Name {
|
||||
|
Loading…
x
Reference in New Issue
Block a user