@@ -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.
@@ -780,17 +779,14 @@ impl<'a, 'b:'a, 'c: 'b> ImportResolver<'a, 'b, 'c> {
780779
781780 let msg = format ! ( "`{}` import is ambiguous" , name) ;
782781 let mut err = self . session . struct_span_err ( span, & msg) ;
783- let mut suggestion_choices = String :: new ( ) ;
782+ let mut suggestion_choices = vec ! [ ] ;
784783 if external_crate. is_some ( ) {
785- write ! ( suggestion_choices , "`::{}`" , name) ;
784+ suggestion_choices . push ( format ! ( "`::{}`" , name) ) ;
786785 err. span_label ( span,
787786 format ! ( "can refer to external crate `::{}`" , name) ) ;
788787 }
789788 if let Some ( result) = results. module_scope {
790- if !suggestion_choices. is_empty ( ) {
791- suggestion_choices. push_str ( " or " ) ;
792- }
793- write ! ( suggestion_choices, "`self::{}`" , name) ;
789+ suggestion_choices. push ( format ! ( "`self::{}`" , name) ) ;
794790 if uniform_paths_feature {
795791 err. span_label ( result. span ,
796792 format ! ( "can refer to `self::{}`" , name) ) ;
@@ -803,7 +799,7 @@ impl<'a, 'b:'a, 'c: 'b> ImportResolver<'a, 'b, 'c> {
803799 err. span_label ( result. span ,
804800 format ! ( "shadowed by block-scoped `{}`" , name) ) ;
805801 }
806- err. help ( & format ! ( "write {} explicitly instead" , suggestion_choices) ) ;
802+ err. help ( & format ! ( "write {} explicitly instead" , suggestion_choices. join ( " or " ) ) ) ;
807803 if uniform_paths_feature {
808804 err. note ( "relative `use` paths enabled by `#![feature(uniform_paths)]`" ) ;
809805 } else {
0 commit comments