File tree Expand file tree Collapse file tree 2 files changed +12
-5
lines changed Expand file tree Collapse file tree 2 files changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -224,16 +224,16 @@ fn emit_reexport(
224224 ImportKind :: Glob => path_components. push ( name. to_owned ( ) ) ,
225225 ImportKind :: TypeOnly => path_components. push ( "self" . to_owned ( ) ) ,
226226 } ;
227- let key = path_components. join ( "::" ) ;
228- // prevent duplicate imports
229- if uses. contains_key ( & key) {
230- return ;
231- }
232227
233228 let alias = alias. map ( |alias| match alias {
234229 ImportAlias :: Underscore => "_" . to_owned ( ) ,
235230 ImportAlias :: Alias ( name) => name. as_str ( ) . to_owned ( ) ,
236231 } ) ;
232+ let key = format ! (
233+ "{} as {}" ,
234+ path_components. join( "::" ) ,
235+ alias. as_ref( ) . unwrap_or( & "" . to_owned( ) )
236+ ) ;
237237 let rename = alias. map ( |name| {
238238 let name = Some ( trap. emit ( generated:: Name {
239239 id : trap:: TrapId :: Star ,
@@ -244,6 +244,10 @@ fn emit_reexport(
244244 name,
245245 } )
246246 } ) ;
247+ // prevent duplicate imports
248+ if uses. contains_key ( & key) {
249+ return ;
250+ }
247251 let path = make_qualified_path ( trap, path_components) ;
248252 let use_tree = trap. emit ( generated:: UseTree {
249253 id : trap:: TrapId :: Star ,
Original file line number Diff line number Diff line change @@ -44,6 +44,7 @@ lib.rs:
4444#-----| -> use ...::canonicalize
4545#-----| -> use ...::copy
4646#-----| -> use ...::create_dir
47+ #-----| -> use ...::create_dir as mkdir
4748#-----| -> use ...::create_dir_all
4849#-----| -> use ...::exists
4950#-----| -> use ...::hard_link
@@ -92,6 +93,8 @@ lib.rs:
9293
9394#-----| use ...::create_dir
9495
96+ #-----| use ...::create_dir as mkdir
97+
9598#-----| use ...::create_dir_all
9699
97100#-----| use ...::exists
You can’t perform that action at this time.
0 commit comments