@@ -152,10 +152,10 @@ mod tests {
152152 fn test_replace_add_use_no_anchor ( ) {
153153 check_assist (
154154 replace_qualified_name_with_use,
155- "
155+ r "
156156std::fmt::Debug<|>
157157 " ,
158- "
158+ r "
159159use std::fmt::Debug;
160160
161161Debug
@@ -166,13 +166,13 @@ Debug
166166 fn test_replace_add_use_no_anchor_with_item_below ( ) {
167167 check_assist (
168168 replace_qualified_name_with_use,
169- "
169+ r "
170170std::fmt::Debug<|>
171171
172172fn main() {
173173}
174174 " ,
175- "
175+ r "
176176use std::fmt::Debug;
177177
178178Debug
@@ -187,13 +187,13 @@ fn main() {
187187 fn test_replace_add_use_no_anchor_with_item_above ( ) {
188188 check_assist (
189189 replace_qualified_name_with_use,
190- "
190+ r "
191191fn main() {
192192}
193193
194194std::fmt::Debug<|>
195195 " ,
196- "
196+ r "
197197use std::fmt::Debug;
198198
199199fn main() {
@@ -208,10 +208,10 @@ Debug
208208 fn test_replace_add_use_no_anchor_2seg ( ) {
209209 check_assist (
210210 replace_qualified_name_with_use,
211- "
211+ r "
212212std::fmt<|>::Debug
213213 " ,
214- "
214+ r "
215215use std::fmt;
216216
217217fmt::Debug
@@ -223,13 +223,13 @@ fmt::Debug
223223 fn test_replace_add_use ( ) {
224224 check_assist (
225225 replace_qualified_name_with_use,
226- "
226+ r "
227227use stdx;
228228
229229impl std::fmt::Debug<|> for Foo {
230230}
231231 " ,
232- "
232+ r "
233233use stdx;
234234use std::fmt::Debug;
235235
@@ -243,11 +243,11 @@ impl Debug for Foo {
243243 fn test_replace_file_use_other_anchor ( ) {
244244 check_assist (
245245 replace_qualified_name_with_use,
246- "
246+ r "
247247impl std::fmt::Debug<|> for Foo {
248248}
249249 " ,
250- "
250+ r "
251251use std::fmt::Debug;
252252
253253impl Debug for Foo {
@@ -260,11 +260,11 @@ impl Debug for Foo {
260260 fn test_replace_add_use_other_anchor_indent ( ) {
261261 check_assist (
262262 replace_qualified_name_with_use,
263- "
263+ r "
264264 impl std::fmt::Debug<|> for Foo {
265265 }
266266 " ,
267- "
267+ r "
268268 use std::fmt::Debug;
269269
270270 impl Debug for Foo {
@@ -277,13 +277,13 @@ impl Debug for Foo {
277277 fn test_replace_split_different ( ) {
278278 check_assist (
279279 replace_qualified_name_with_use,
280- "
280+ r "
281281use std::fmt;
282282
283283impl std::io<|> for Foo {
284284}
285285 " ,
286- "
286+ r "
287287use std::{io, fmt};
288288
289289impl io for Foo {
@@ -296,13 +296,13 @@ impl io for Foo {
296296 fn test_replace_split_self_for_use ( ) {
297297 check_assist (
298298 replace_qualified_name_with_use,
299- "
299+ r "
300300use std::fmt;
301301
302302impl std::fmt::Debug<|> for Foo {
303303}
304304 " ,
305- "
305+ r "
306306use std::fmt::{self, Debug, };
307307
308308impl Debug for Foo {
@@ -315,13 +315,13 @@ impl Debug for Foo {
315315 fn test_replace_split_self_for_target ( ) {
316316 check_assist (
317317 replace_qualified_name_with_use,
318- "
318+ r "
319319use std::fmt::Debug;
320320
321321impl std::fmt<|> for Foo {
322322}
323323 " ,
324- "
324+ r "
325325use std::fmt::{self, Debug};
326326
327327impl fmt for Foo {
@@ -334,13 +334,13 @@ impl fmt for Foo {
334334 fn test_replace_add_to_nested_self_nested ( ) {
335335 check_assist (
336336 replace_qualified_name_with_use,
337- "
337+ r "
338338use std::fmt::{Debug, nested::{Display}};
339339
340340impl std::fmt::nested<|> for Foo {
341341}
342342" ,
343- "
343+ r "
344344use std::fmt::{Debug, nested::{Display, self}};
345345
346346impl nested for Foo {
@@ -353,13 +353,13 @@ impl nested for Foo {
353353 fn test_replace_add_to_nested_self_already_included ( ) {
354354 check_assist (
355355 replace_qualified_name_with_use,
356- "
356+ r "
357357use std::fmt::{Debug, nested::{self, Display}};
358358
359359impl std::fmt::nested<|> for Foo {
360360}
361361" ,
362- "
362+ r "
363363use std::fmt::{Debug, nested::{self, Display}};
364364
365365impl nested for Foo {
@@ -372,13 +372,13 @@ impl nested for Foo {
372372 fn test_replace_add_to_nested_nested ( ) {
373373 check_assist (
374374 replace_qualified_name_with_use,
375- "
375+ r "
376376use std::fmt::{Debug, nested::{Display}};
377377
378378impl std::fmt::nested::Debug<|> for Foo {
379379}
380380" ,
381- "
381+ r "
382382use std::fmt::{Debug, nested::{Display, Debug}};
383383
384384impl Debug for Foo {
@@ -391,13 +391,13 @@ impl Debug for Foo {
391391 fn test_replace_split_common_target_longer ( ) {
392392 check_assist (
393393 replace_qualified_name_with_use,
394- "
394+ r "
395395use std::fmt::Debug;
396396
397397impl std::fmt::nested::Display<|> for Foo {
398398}
399399" ,
400- "
400+ r "
401401use std::fmt::{nested::Display, Debug};
402402
403403impl Display for Foo {
@@ -410,13 +410,13 @@ impl Display for Foo {
410410 fn test_replace_split_common_use_longer ( ) {
411411 check_assist (
412412 replace_qualified_name_with_use,
413- "
413+ r "
414414use std::fmt::nested::Debug;
415415
416416impl std::fmt::Display<|> for Foo {
417417}
418418" ,
419- "
419+ r "
420420use std::fmt::{Display, nested::Debug};
421421
422422impl Display for Foo {
@@ -429,15 +429,15 @@ impl Display for Foo {
429429 fn test_replace_use_nested_import ( ) {
430430 check_assist (
431431 replace_qualified_name_with_use,
432- "
432+ r "
433433use crate::{
434434 ty::{Substs, Ty},
435435 AssocItem,
436436};
437437
438438fn foo() { crate::ty::lower<|>::trait_env() }
439439" ,
440- "
440+ r "
441441use crate::{
442442 ty::{Substs, Ty, lower},
443443 AssocItem,
@@ -452,13 +452,13 @@ fn foo() { lower::trait_env() }
452452 fn test_replace_alias ( ) {
453453 check_assist (
454454 replace_qualified_name_with_use,
455- "
455+ r "
456456use std::fmt as foo;
457457
458458impl foo::Debug<|> for Foo {
459459}
460460" ,
461- "
461+ r "
462462use std::fmt as foo;
463463
464464impl Debug for Foo {
@@ -471,7 +471,7 @@ impl Debug for Foo {
471471 fn test_replace_not_applicable_one_segment ( ) {
472472 check_assist_not_applicable (
473473 replace_qualified_name_with_use,
474- "
474+ r "
475475impl foo<|> for Foo {
476476}
477477" ,
@@ -482,7 +482,7 @@ impl foo<|> for Foo {
482482 fn test_replace_not_applicable_in_use ( ) {
483483 check_assist_not_applicable (
484484 replace_qualified_name_with_use,
485- "
485+ r "
486486use std::fmt<|>;
487487" ,
488488 ) ;
@@ -492,14 +492,14 @@ use std::fmt<|>;
492492 fn test_replace_add_use_no_anchor_in_mod_mod ( ) {
493493 check_assist (
494494 replace_qualified_name_with_use,
495- "
495+ r "
496496mod foo {
497497 mod bar {
498498 std::fmt::Debug<|>
499499 }
500500}
501501 " ,
502- "
502+ r "
503503mod foo {
504504 mod bar {
505505 use std::fmt::Debug;
@@ -515,14 +515,14 @@ mod foo {
515515 fn inserts_imports_after_inner_attributes ( ) {
516516 check_assist (
517517 replace_qualified_name_with_use,
518- "
518+ r "
519519#![allow(dead_code)]
520520
521521fn main() {
522522 std::fmt::Debug<|>
523523}
524524 " ,
525- "
525+ r "
526526#![allow(dead_code)]
527527use std::fmt::Debug;
528528
@@ -537,13 +537,13 @@ fn main() {
537537 fn replaces_all_affected_paths ( ) {
538538 check_assist (
539539 replace_qualified_name_with_use,
540- "
540+ r "
541541fn main() {
542542 std::fmt::Debug<|>;
543543 let x: std::fmt::Debug = std::fmt::Debug;
544544}
545545 " ,
546- "
546+ r "
547547use std::fmt::Debug;
548548
549549fn main() {
@@ -558,7 +558,7 @@ fn main() {
558558 fn replaces_all_affected_paths_mod ( ) {
559559 check_assist (
560560 replace_qualified_name_with_use,
561- "
561+ r "
562562mod m {
563563 fn f() {
564564 std::fmt::Debug<|>;
@@ -573,7 +573,7 @@ fn f() {
573573 std::fmt::Debug;
574574}
575575 " ,
576- "
576+ r "
577577mod m {
578578 use std::fmt::Debug;
579579
@@ -597,7 +597,7 @@ fn f() {
597597 fn does_not_replace_in_submodules ( ) {
598598 check_assist (
599599 replace_qualified_name_with_use,
600- "
600+ r "
601601fn main() {
602602 std::fmt::Debug<|>;
603603}
@@ -608,7 +608,7 @@ mod sub {
608608 }
609609}
610610 " ,
611- "
611+ r "
612612use std::fmt::Debug;
613613
614614fn main() {
@@ -628,14 +628,14 @@ mod sub {
628628 fn does_not_replace_in_use ( ) {
629629 check_assist (
630630 replace_qualified_name_with_use,
631- "
631+ r "
632632use std::fmt::Display;
633633
634634fn main() {
635635 std::fmt<|>;
636636}
637637 " ,
638- "
638+ r "
639639use std::fmt::{self, Display};
640640
641641fn main() {
0 commit comments