Skip to content

Commit 344040d

Browse files
pcwaltonhuonw
authored andcommitted
librustc: Get rid of ident_to_str calls in resolve
1 parent 64a3a41 commit 344040d

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

src/librustc/middle/resolve.rs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1893,8 +1893,9 @@ impl Resolver {
18931893
csearch::each_child_of_item(self.session.cstore,
18941894
def_id,
18951895
|def_like, child_ident, visibility| {
1896+
let child_ident_string = token::get_ident(child_ident.name);
18961897
debug!("(populating external module) ... found ident: {}",
1897-
token::ident_to_str(&child_ident));
1898+
child_ident_string.get());
18981899
self.build_reduced_graph_for_external_crate_def(module,
18991900
def_like,
19001901
child_ident,
@@ -3102,11 +3103,12 @@ impl Resolver {
31023103
// top of the crate otherwise.
31033104
let mut containing_module;
31043105
let mut i;
3105-
if "self" == token::ident_to_str(&module_path[0]) {
3106+
let first_module_path_string = token::get_ident(module_path[0].name);
3107+
if "self" == first_module_path_string.get() {
31063108
containing_module =
31073109
self.get_nearest_normal_module_parent_or_self(module_);
31083110
i = 1;
3109-
} else if "super" == token::ident_to_str(&module_path[0]) {
3111+
} else if "super" == first_module_path_string.get() {
31103112
containing_module =
31113113
self.get_nearest_normal_module_parent_or_self(module_);
31123114
i = 0; // We'll handle `super` below.
@@ -3115,8 +3117,11 @@ impl Resolver {
31153117
}
31163118

31173119
// Now loop through all the `super`s we find.
3118-
while i < module_path.len() &&
3119-
"super" == token::ident_to_str(&module_path[i]) {
3120+
while i < module_path.len() {
3121+
let string = token::get_ident(module_path[i].name);
3122+
if "super" != string.get() {
3123+
break
3124+
}
31203125
debug!("(resolving module prefix) resolving `super` at {}",
31213126
self.module_to_str(containing_module));
31223127
match self.get_nearest_normal_module_parent(containing_module) {

0 commit comments

Comments
 (0)