@@ -1462,7 +1462,6 @@ impl<'a> Resolver<'a> {
1462
1462
let name = module_path[ index] . name ;
1463
1463
match self . resolve_name_in_module ( search_module, name, TypeNS , false , false , span) {
1464
1464
Failed ( _) => {
1465
- let segment_name = name. as_str ( ) ;
1466
1465
let module_name = module_to_string ( search_module) ;
1467
1466
let msg = if "???" == & module_name {
1468
1467
let current_module = self . current_module ;
@@ -1480,10 +1479,10 @@ impl<'a> Resolver<'a> {
1480
1479
1481
1480
format ! ( "Did you mean `{}{}`?" , prefix, path_str)
1482
1481
}
1483
- None => format ! ( "Maybe a missing `extern crate {};`?" , segment_name ) ,
1482
+ None => format ! ( "Maybe a missing `extern crate {};`?" , name ) ,
1484
1483
}
1485
1484
} else {
1486
- format ! ( "Could not find `{}` in `{}`" , segment_name , module_name)
1485
+ format ! ( "Could not find `{}` in `{}`" , name , module_name)
1487
1486
} ;
1488
1487
1489
1488
return Failed ( span. map ( |span| ( span, msg) ) ) ;
@@ -1651,7 +1650,7 @@ impl<'a> Resolver<'a> {
1651
1650
/// grammar: (SELF MOD_SEP ) ? (SUPER MOD_SEP) *
1652
1651
fn resolve_module_prefix ( & mut self , module_path : & [ Ident ] , span : Option < Span > )
1653
1652
-> ResolveResult < ModulePrefixResult < ' a > > {
1654
- if & * module_path[ 0 ] . name . as_str ( ) == "$crate" {
1653
+ if module_path[ 0 ] . name == "$crate" {
1655
1654
return Success ( PrefixFound ( self . resolve_crate_var ( module_path[ 0 ] . ctxt ) , 1 ) ) ;
1656
1655
}
1657
1656
@@ -1667,7 +1666,7 @@ impl<'a> Resolver<'a> {
1667
1666
self . module_map [ & self . current_module . normal_ancestor_id . unwrap ( ) ] ;
1668
1667
1669
1668
// Now loop through all the `super`s we find.
1670
- while i < module_path. len ( ) && "super" == module_path[ i] . name . as_str ( ) {
1669
+ while i < module_path. len ( ) && module_path[ i] . name == "super" {
1671
1670
debug ! ( "(resolving module prefix) resolving `super` at {}" ,
1672
1671
module_to_string( & containing_module) ) ;
1673
1672
if let Some ( parent) = containing_module. parent {
@@ -2635,7 +2634,7 @@ impl<'a> Resolver<'a> {
2635
2634
let qualified_binding = self . resolve_module_relative_path ( span, segments, namespace) ;
2636
2635
match ( qualified_binding, unqualified_def) {
2637
2636
( Ok ( binding) , Some ( ref ud) ) if binding. def ( ) == ud. def &&
2638
- segments[ 0 ] . identifier . name . as_str ( ) != "$crate" => {
2637
+ segments[ 0 ] . identifier . name != "$crate" => {
2639
2638
self . session
2640
2639
. add_lint ( lint:: builtin:: UNUSED_QUALIFICATIONS ,
2641
2640
id,
@@ -2881,7 +2880,7 @@ impl<'a> Resolver<'a> {
2881
2880
}
2882
2881
2883
2882
fn find_best_match ( & mut self , name : & str ) -> SuggestionType {
2884
- if let Some ( macro_name) = self . macro_names . iter ( ) . find ( |n| n. as_str ( ) == name) {
2883
+ if let Some ( macro_name) = self . macro_names . iter ( ) . find ( |& n| n == & name) {
2885
2884
return SuggestionType :: Macro ( format ! ( "{}!" , macro_name) ) ;
2886
2885
}
2887
2886
@@ -3000,8 +2999,7 @@ impl<'a> Resolver<'a> {
3000
2999
false // Stop advancing
3001
3000
} ) ;
3002
3001
3003
- if method_scope &&
3004
- & path_name[ ..] == keywords:: SelfValue . name ( ) . as_str ( ) {
3002
+ if method_scope && keywords:: SelfValue . name ( ) == & * path_name {
3005
3003
resolve_error ( self ,
3006
3004
expr. span ,
3007
3005
ResolutionError :: SelfNotAvailableInStaticMethod ) ;
0 commit comments