@@ -2023,7 +2023,7 @@ impl<'a, 'b> ImportResolver<'a, 'b> {
20232023 span : Span ,
20242024 mut path : Vec < Segment > ,
20252025 parent_scope : & ParentScope < ' b > ,
2026- ) -> Option < ( Vec < Segment > , Vec < String > ) > {
2026+ ) -> Option < ( Vec < Segment > , Option < String > ) > {
20272027 debug ! ( "make_path_suggestion: span={:?} path={:?}" , span, path) ;
20282028
20292029 match ( path. get ( 0 ) , path. get ( 1 ) ) {
@@ -2058,12 +2058,12 @@ impl<'a, 'b> ImportResolver<'a, 'b> {
20582058 & mut self ,
20592059 mut path : Vec < Segment > ,
20602060 parent_scope : & ParentScope < ' b > ,
2061- ) -> Option < ( Vec < Segment > , Vec < String > ) > {
2061+ ) -> Option < ( Vec < Segment > , Option < String > ) > {
20622062 // Replace first ident with `self` and check if that is valid.
20632063 path[ 0 ] . ident . name = kw:: SelfLower ;
20642064 let result = self . r . maybe_resolve_path ( & path, None , parent_scope) ;
20652065 debug ! ( "make_missing_self_suggestion: path={:?} result={:?}" , path, result) ;
2066- if let PathResult :: Module ( ..) = result { Some ( ( path, Vec :: new ( ) ) ) } else { None }
2066+ if let PathResult :: Module ( ..) = result { Some ( ( path, None ) ) } else { None }
20672067 }
20682068
20692069 /// Suggests a missing `crate::` if that resolves to an correct module.
@@ -2077,20 +2077,20 @@ impl<'a, 'b> ImportResolver<'a, 'b> {
20772077 & mut self ,
20782078 mut path : Vec < Segment > ,
20792079 parent_scope : & ParentScope < ' b > ,
2080- ) -> Option < ( Vec < Segment > , Vec < String > ) > {
2080+ ) -> Option < ( Vec < Segment > , Option < String > ) > {
20812081 // Replace first ident with `crate` and check if that is valid.
20822082 path[ 0 ] . ident . name = kw:: Crate ;
20832083 let result = self . r . maybe_resolve_path ( & path, None , parent_scope) ;
20842084 debug ! ( "make_missing_crate_suggestion: path={:?} result={:?}" , path, result) ;
20852085 if let PathResult :: Module ( ..) = result {
20862086 Some ( (
20872087 path,
2088- vec ! [
2088+ Some (
20892089 "`use` statements changed in Rust 2018; read more at \
20902090 <https://doc.rust-lang.org/edition-guide/rust-2018/module-system/path-\
20912091 clarity.html>"
20922092 . to_string ( ) ,
2093- ] ,
2093+ ) ,
20942094 ) )
20952095 } else {
20962096 None
@@ -2108,12 +2108,12 @@ impl<'a, 'b> ImportResolver<'a, 'b> {
21082108 & mut self ,
21092109 mut path : Vec < Segment > ,
21102110 parent_scope : & ParentScope < ' b > ,
2111- ) -> Option < ( Vec < Segment > , Vec < String > ) > {
2111+ ) -> Option < ( Vec < Segment > , Option < String > ) > {
21122112 // Replace first ident with `crate` and check if that is valid.
21132113 path[ 0 ] . ident . name = kw:: Super ;
21142114 let result = self . r . maybe_resolve_path ( & path, None , parent_scope) ;
21152115 debug ! ( "make_missing_super_suggestion: path={:?} result={:?}" , path, result) ;
2116- if let PathResult :: Module ( ..) = result { Some ( ( path, Vec :: new ( ) ) ) } else { None }
2116+ if let PathResult :: Module ( ..) = result { Some ( ( path, None ) ) } else { None }
21172117 }
21182118
21192119 /// Suggests a missing external crate name if that resolves to an correct module.
@@ -2130,7 +2130,7 @@ impl<'a, 'b> ImportResolver<'a, 'b> {
21302130 & mut self ,
21312131 mut path : Vec < Segment > ,
21322132 parent_scope : & ParentScope < ' b > ,
2133- ) -> Option < ( Vec < Segment > , Vec < String > ) > {
2133+ ) -> Option < ( Vec < Segment > , Option < String > ) > {
21342134 if path[ 1 ] . ident . span . rust_2015 ( ) {
21352135 return None ;
21362136 }
@@ -2151,7 +2151,7 @@ impl<'a, 'b> ImportResolver<'a, 'b> {
21512151 name, path, result
21522152 ) ;
21532153 if let PathResult :: Module ( ..) = result {
2154- return Some ( ( path, Vec :: new ( ) ) ) ;
2154+ return Some ( ( path, None ) ) ;
21552155 }
21562156 }
21572157
@@ -2175,7 +2175,7 @@ impl<'a, 'b> ImportResolver<'a, 'b> {
21752175 import : & ' b Import < ' b > ,
21762176 module : ModuleOrUniformRoot < ' b > ,
21772177 ident : Ident ,
2178- ) -> Option < ( Option < Suggestion > , Vec < String > ) > {
2178+ ) -> Option < ( Option < Suggestion > , Option < String > ) > {
21792179 let ModuleOrUniformRoot :: Module ( mut crate_module) = module else {
21802180 return None ;
21812181 } ;
@@ -2287,12 +2287,9 @@ impl<'a, 'b> ImportResolver<'a, 'b> {
22872287 String :: from ( "a macro with this name exists at the root of the crate" ) ,
22882288 Applicability :: MaybeIncorrect ,
22892289 ) ) ;
2290- let note = vec ! [
2291- "this could be because a macro annotated with `#[macro_export]` will be exported \
2292- at the root of the crate instead of the module where it is defined"
2293- . to_string( ) ,
2294- ] ;
2295- Some ( ( suggestion, note) )
2290+ Some ( ( suggestion, Some ( "this could be because a macro annotated with `#[macro_export]` will be exported \
2291+ at the root of the crate instead of the module where it is defined"
2292+ . to_string ( ) ) ) )
22962293 } else {
22972294 None
22982295 }
0 commit comments