Skip to content

Commit 2dfbe7f

Browse files
emberianalexcrichton
authored andcommitted
Use a nicer Show impl for Name
1 parent ca0b654 commit 2dfbe7f

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

src/librustuv/file.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,7 @@ mod test {
547547
let path = &"./tmp/mk_rm_dir".to_c_str();
548548
let mode = S_IWUSR | S_IRUSR;
549549

550-
let result = FsRequest::mkdir(l(), path, mode);
550+
let result = FsRequest::mkdir(l(), path, mode as c_int);
551551
assert!(result.is_ok());
552552

553553
let result = FsRequest::rmdir(l(), path);

src/libsyntax/ast.rs

+9-2
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,14 @@ impl Ident {
5858

5959
impl Show for Ident {
6060
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
61-
write!(f, "\"{}\"#{}", token::get_ident(*self).get(), self.ctxt)
61+
write!(f, "{}#{}", self.name, self.ctxt)
62+
}
63+
}
64+
65+
impl Show for Name {
66+
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
67+
let Name(nm) = *self;
68+
write!(f, "\"{}\"({})", token::get_name(*self).get(), nm)
6269
}
6370
}
6471

@@ -106,7 +113,7 @@ pub static ILLEGAL_CTXT : SyntaxContext = 1;
106113

107114
/// A name is a part of an identifier, representing a string or gensym. It's
108115
/// the result of interning.
109-
#[deriving(Eq, Ord, PartialEq, PartialOrd, Hash, Encodable, Decodable, Clone, Show)]
116+
#[deriving(Eq, Ord, PartialEq, PartialOrd, Hash, Encodable, Decodable, Clone)]
110117
pub struct Name(pub u32);
111118

112119
impl Name {

0 commit comments

Comments
 (0)