@@ -36,7 +36,6 @@ use syntax_pos::{MultiSpan, Span};
3636
3737use std:: cell:: { Cell , RefCell } ;
3838use std:: collections:: BTreeMap ;
39- use std:: fmt:: Write ;
4039use std:: { mem, ptr} ;
4140
4241/// Contains data for specific types of import directives.
@@ -778,17 +777,14 @@ impl<'a, 'b:'a, 'c: 'b> ImportResolver<'a, 'b, 'c> {
778777
779778 let msg = format ! ( "`{}` import is ambiguous" , name) ;
780779 let mut err = self . session . struct_span_err ( span, & msg) ;
781- let mut suggestion_choices = String :: new ( ) ;
780+ let mut suggestion_choices = vec ! [ ] ;
782781 if external_crate. is_some ( ) {
783- write ! ( suggestion_choices , "`::{}`" , name) ;
782+ suggestion_choices . push ( format ! ( "`::{}`" , name) ) ;
784783 err. span_label ( span,
785784 format ! ( "can refer to external crate `::{}`" , name) ) ;
786785 }
787786 if let Some ( result) = results. module_scope {
788- if !suggestion_choices. is_empty ( ) {
789- suggestion_choices. push_str ( " or " ) ;
790- }
791- write ! ( suggestion_choices, "`self::{}`" , name) ;
787+ suggestion_choices. push ( format ! ( "`self::{}`" , name) ) ;
792788 if uniform_paths_feature {
793789 err. span_label ( result. span ,
794790 format ! ( "can refer to `self::{}`" , name) ) ;
@@ -801,7 +797,7 @@ impl<'a, 'b:'a, 'c: 'b> ImportResolver<'a, 'b, 'c> {
801797 err. span_label ( result. span ,
802798 format ! ( "shadowed by block-scoped `{}`" , name) ) ;
803799 }
804- err. help ( & format ! ( "write {} explicitly instead" , suggestion_choices) ) ;
800+ err. help ( & format ! ( "write {} explicitly instead" , suggestion_choices. join ( " or " ) ) ) ;
805801 if uniform_paths_feature {
806802 err. note ( "relative `use` paths enabled by `#![feature(uniform_paths)]`" ) ;
807803 } else {
0 commit comments