@@ -151,7 +151,7 @@ pub struct NoPrivateImportsState {
151
151
range : TextRange ,
152
152
153
153
/// The path where the visibility of the imported symbol is defined.
154
- path : Box < str > ,
154
+ path : String ,
155
155
156
156
/// The visibility of the offending symbol.
157
157
visibility : Visibility ,
@@ -271,15 +271,13 @@ fn get_restricted_imports_from_module_source(
271
271
node : & JsModuleSource ,
272
272
options : & GetRestrictedImportOptions ,
273
273
) -> SyntaxResult < Vec < NoPrivateImportsState > > {
274
- let path: Box < str > = options. target_path . as_str ( ) . into ( ) ;
275
-
276
274
let results = match node. syntax ( ) . parent ( ) . and_then ( AnyJsImportClause :: cast) {
277
275
Some ( AnyJsImportClause :: JsImportCombinedClause ( node) ) => {
278
276
let range = node. default_specifier ( ) ?. range ( ) ;
279
277
get_restricted_import_visibility ( & Text :: new_static ( "default" ) , options)
280
278
. map ( |visibility| NoPrivateImportsState {
281
279
range,
282
- path : path . clone ( ) ,
280
+ path : options . target_path . to_string ( ) ,
283
281
visibility,
284
282
} )
285
283
. into_iter ( )
@@ -298,7 +296,7 @@ fn get_restricted_imports_from_module_source(
298
296
)
299
297
. map ( |visibility| NoPrivateImportsState {
300
298
range : name. text_trimmed_range ( ) ,
301
- path : path . clone ( ) ,
299
+ path : options . target_path . to_string ( ) ,
302
300
visibility,
303
301
} )
304
302
} ) ,
@@ -310,7 +308,7 @@ fn get_restricted_imports_from_module_source(
310
308
get_restricted_import_visibility ( & Text :: new_static ( "default" ) , options)
311
309
. map ( |visibility| NoPrivateImportsState {
312
310
range,
313
- path,
311
+ path : options . target_path . to_string ( ) ,
314
312
visibility,
315
313
} )
316
314
. into_iter ( )
@@ -326,7 +324,7 @@ fn get_restricted_imports_from_module_source(
326
324
get_restricted_import_visibility ( & Text :: from ( name. token_text_trimmed ( ) ) , options)
327
325
. map ( |visibility| NoPrivateImportsState {
328
326
range : name. text_trimmed_range ( ) ,
329
- path : path . clone ( ) ,
327
+ path : options . target_path . to_string ( ) ,
330
328
visibility,
331
329
} )
332
330
} )
0 commit comments