@@ -2023,7 +2023,7 @@ impl<'a, 'b> ImportResolver<'a, 'b> {
2023
2023
span : Span ,
2024
2024
mut path : Vec < Segment > ,
2025
2025
parent_scope : & ParentScope < ' b > ,
2026
- ) -> Option < ( Vec < Segment > , Vec < String > ) > {
2026
+ ) -> Option < ( Vec < Segment > , Option < String > ) > {
2027
2027
debug ! ( "make_path_suggestion: span={:?} path={:?}" , span, path) ;
2028
2028
2029
2029
match ( path. get ( 0 ) , path. get ( 1 ) ) {
@@ -2058,12 +2058,12 @@ impl<'a, 'b> ImportResolver<'a, 'b> {
2058
2058
& mut self ,
2059
2059
mut path : Vec < Segment > ,
2060
2060
parent_scope : & ParentScope < ' b > ,
2061
- ) -> Option < ( Vec < Segment > , Vec < String > ) > {
2061
+ ) -> Option < ( Vec < Segment > , Option < String > ) > {
2062
2062
// Replace first ident with `self` and check if that is valid.
2063
2063
path[ 0 ] . ident . name = kw:: SelfLower ;
2064
2064
let result = self . r . maybe_resolve_path ( & path, None , parent_scope) ;
2065
2065
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 }
2067
2067
}
2068
2068
2069
2069
/// Suggests a missing `crate::` if that resolves to an correct module.
@@ -2077,20 +2077,20 @@ impl<'a, 'b> ImportResolver<'a, 'b> {
2077
2077
& mut self ,
2078
2078
mut path : Vec < Segment > ,
2079
2079
parent_scope : & ParentScope < ' b > ,
2080
- ) -> Option < ( Vec < Segment > , Vec < String > ) > {
2080
+ ) -> Option < ( Vec < Segment > , Option < String > ) > {
2081
2081
// Replace first ident with `crate` and check if that is valid.
2082
2082
path[ 0 ] . ident . name = kw:: Crate ;
2083
2083
let result = self . r . maybe_resolve_path ( & path, None , parent_scope) ;
2084
2084
debug ! ( "make_missing_crate_suggestion: path={:?} result={:?}" , path, result) ;
2085
2085
if let PathResult :: Module ( ..) = result {
2086
2086
Some ( (
2087
2087
path,
2088
- vec ! [
2088
+ Some (
2089
2089
"`use` statements changed in Rust 2018; read more at \
2090
2090
<https://doc.rust-lang.org/edition-guide/rust-2018/module-system/path-\
2091
2091
clarity.html>"
2092
2092
. to_string ( ) ,
2093
- ] ,
2093
+ ) ,
2094
2094
) )
2095
2095
} else {
2096
2096
None
@@ -2108,12 +2108,12 @@ impl<'a, 'b> ImportResolver<'a, 'b> {
2108
2108
& mut self ,
2109
2109
mut path : Vec < Segment > ,
2110
2110
parent_scope : & ParentScope < ' b > ,
2111
- ) -> Option < ( Vec < Segment > , Vec < String > ) > {
2111
+ ) -> Option < ( Vec < Segment > , Option < String > ) > {
2112
2112
// Replace first ident with `crate` and check if that is valid.
2113
2113
path[ 0 ] . ident . name = kw:: Super ;
2114
2114
let result = self . r . maybe_resolve_path ( & path, None , parent_scope) ;
2115
2115
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 }
2117
2117
}
2118
2118
2119
2119
/// Suggests a missing external crate name if that resolves to an correct module.
@@ -2130,7 +2130,7 @@ impl<'a, 'b> ImportResolver<'a, 'b> {
2130
2130
& mut self ,
2131
2131
mut path : Vec < Segment > ,
2132
2132
parent_scope : & ParentScope < ' b > ,
2133
- ) -> Option < ( Vec < Segment > , Vec < String > ) > {
2133
+ ) -> Option < ( Vec < Segment > , Option < String > ) > {
2134
2134
if path[ 1 ] . ident . span . rust_2015 ( ) {
2135
2135
return None ;
2136
2136
}
@@ -2151,7 +2151,7 @@ impl<'a, 'b> ImportResolver<'a, 'b> {
2151
2151
name, path, result
2152
2152
) ;
2153
2153
if let PathResult :: Module ( ..) = result {
2154
- return Some ( ( path, Vec :: new ( ) ) ) ;
2154
+ return Some ( ( path, None ) ) ;
2155
2155
}
2156
2156
}
2157
2157
@@ -2175,7 +2175,7 @@ impl<'a, 'b> ImportResolver<'a, 'b> {
2175
2175
import : & ' b Import < ' b > ,
2176
2176
module : ModuleOrUniformRoot < ' b > ,
2177
2177
ident : Ident ,
2178
- ) -> Option < ( Option < Suggestion > , Vec < String > ) > {
2178
+ ) -> Option < ( Option < Suggestion > , Option < String > ) > {
2179
2179
let ModuleOrUniformRoot :: Module ( mut crate_module) = module else {
2180
2180
return None ;
2181
2181
} ;
@@ -2287,12 +2287,9 @@ impl<'a, 'b> ImportResolver<'a, 'b> {
2287
2287
String :: from ( "a macro with this name exists at the root of the crate" ) ,
2288
2288
Applicability :: MaybeIncorrect ,
2289
2289
) ) ;
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 ( ) ) ) )
2296
2293
} else {
2297
2294
None
2298
2295
}
0 commit comments