@@ -44,7 +44,7 @@ fn insert_not_group_empty() {
4444
4545#[ test]
4646fn insert_existing ( ) {
47- check_full ( "std::fs" , "use std::fs;" , "use std::fs;" )
47+ check_crate ( "std::fs" , "use std::fs;" , "use std::fs;" )
4848}
4949
5050#[ test]
@@ -249,7 +249,7 @@ use self::fmt;",
249249
250250#[ test]
251251fn insert_no_imports ( ) {
252- check_full (
252+ check_crate (
253253 "foo::bar" ,
254254 "fn main() {}" ,
255255 r"use foo::bar;
@@ -263,7 +263,7 @@ fn insert_empty_file() {
263263 cov_mark:: check!( insert_group_empty_file) ;
264264 // empty files will get two trailing newlines
265265 // this is due to the test case insert_no_imports above
266- check_full (
266+ check_crate (
267267 "foo::bar" ,
268268 "" ,
269269 r"use foo::bar;
@@ -290,7 +290,7 @@ fn insert_empty_module() {
290290#[ test]
291291fn insert_after_inner_attr ( ) {
292292 cov_mark:: check!( insert_group_empty_inner_attr) ;
293- check_full (
293+ check_crate (
294294 "foo::bar" ,
295295 r"#![allow(unused_imports)]" ,
296296 r"#![allow(unused_imports)]
@@ -301,7 +301,7 @@ use foo::bar;",
301301
302302#[ test]
303303fn insert_after_inner_attr2 ( ) {
304- check_full (
304+ check_crate (
305305 "foo::bar" ,
306306 r"#![allow(unused_imports)]
307307
@@ -371,12 +371,12 @@ fn main() {}"#,
371371
372372#[ test]
373373fn merge_groups ( ) {
374- check_last ( "std::io" , r"use std::fmt;" , r"use std::{fmt, io};" )
374+ check_module ( "std::io" , r"use std::fmt;" , r"use std::{fmt, io};" )
375375}
376376
377377#[ test]
378378fn merge_groups_last ( ) {
379- check_last (
379+ check_module (
380380 "std::io" ,
381381 r"use std::fmt::{Result, Display};" ,
382382 r"use std::fmt::{Result, Display};
@@ -386,12 +386,12 @@ use std::io;",
386386
387387#[ test]
388388fn merge_last_into_self ( ) {
389- check_last ( "foo::bar::baz" , r"use foo::bar;" , r"use foo::bar::{self, baz};" ) ;
389+ check_module ( "foo::bar::baz" , r"use foo::bar;" , r"use foo::bar::{self, baz};" ) ;
390390}
391391
392392#[ test]
393393fn merge_groups_full ( ) {
394- check_full (
394+ check_crate (
395395 "std::io" ,
396396 r"use std::fmt::{Result, Display};" ,
397397 r"use std::{fmt::{Result, Display}, io};" ,
@@ -400,17 +400,21 @@ fn merge_groups_full() {
400400
401401#[ test]
402402fn merge_groups_long_full ( ) {
403- check_full ( "std::foo::bar::Baz" , r"use std::foo::bar::Qux;" , r"use std::foo::bar::{Baz, Qux};" )
403+ check_crate ( "std::foo::bar::Baz" , r"use std::foo::bar::Qux;" , r"use std::foo::bar::{Baz, Qux};" )
404404}
405405
406406#[ test]
407407fn merge_groups_long_last ( ) {
408- check_last ( "std::foo::bar::Baz" , r"use std::foo::bar::Qux;" , r"use std::foo::bar::{Baz, Qux};" )
408+ check_module (
409+ "std::foo::bar::Baz" ,
410+ r"use std::foo::bar::Qux;" ,
411+ r"use std::foo::bar::{Baz, Qux};" ,
412+ )
409413}
410414
411415#[ test]
412416fn merge_groups_long_full_list ( ) {
413- check_full (
417+ check_crate (
414418 "std::foo::bar::Baz" ,
415419 r"use std::foo::bar::{Qux, Quux};" ,
416420 r"use std::foo::bar::{Baz, Quux, Qux};" ,
@@ -419,7 +423,7 @@ fn merge_groups_long_full_list() {
419423
420424#[ test]
421425fn merge_groups_long_last_list ( ) {
422- check_last (
426+ check_module (
423427 "std::foo::bar::Baz" ,
424428 r"use std::foo::bar::{Qux, Quux};" ,
425429 r"use std::foo::bar::{Baz, Quux, Qux};" ,
@@ -428,7 +432,7 @@ fn merge_groups_long_last_list() {
428432
429433#[ test]
430434fn merge_groups_long_full_nested ( ) {
431- check_full (
435+ check_crate (
432436 "std::foo::bar::Baz" ,
433437 r"use std::foo::bar::{Qux, quux::{Fez, Fizz}};" ,
434438 r"use std::foo::bar::{Baz, Qux, quux::{Fez, Fizz}};" ,
@@ -437,7 +441,7 @@ fn merge_groups_long_full_nested() {
437441
438442#[ test]
439443fn merge_groups_long_last_nested ( ) {
440- check_last (
444+ check_module (
441445 "std::foo::bar::Baz" ,
442446 r"use std::foo::bar::{Qux, quux::{Fez, Fizz}};" ,
443447 r"use std::foo::bar::Baz;
@@ -447,7 +451,7 @@ use std::foo::bar::{Qux, quux::{Fez, Fizz}};",
447451
448452#[ test]
449453fn merge_groups_full_nested_deep ( ) {
450- check_full (
454+ check_crate (
451455 "std::foo::bar::quux::Baz" ,
452456 r"use std::foo::bar::{Qux, quux::{Fez, Fizz}};" ,
453457 r"use std::foo::bar::{Qux, quux::{Baz, Fez, Fizz}};" ,
@@ -456,7 +460,7 @@ fn merge_groups_full_nested_deep() {
456460
457461#[ test]
458462fn merge_groups_full_nested_long ( ) {
459- check_full (
463+ check_crate (
460464 "std::foo::bar::Baz" ,
461465 r"use std::{foo::bar::Qux};" ,
462466 r"use std::{foo::bar::{Baz, Qux}};" ,
@@ -465,7 +469,7 @@ fn merge_groups_full_nested_long() {
465469
466470#[ test]
467471fn merge_groups_last_nested_long ( ) {
468- check_full (
472+ check_crate (
469473 "std::foo::bar::Baz" ,
470474 r"use std::{foo::bar::Qux};" ,
471475 r"use std::{foo::bar::{Baz, Qux}};" ,
@@ -474,7 +478,7 @@ fn merge_groups_last_nested_long() {
474478
475479#[ test]
476480fn merge_groups_skip_pub ( ) {
477- check_full (
481+ check_crate (
478482 "std::io" ,
479483 r"pub use std::fmt::{Result, Display};" ,
480484 r"pub use std::fmt::{Result, Display};
@@ -484,7 +488,7 @@ use std::io;",
484488
485489#[ test]
486490fn merge_groups_skip_pub_crate ( ) {
487- check_full (
491+ check_crate (
488492 "std::io" ,
489493 r"pub(crate) use std::fmt::{Result, Display};" ,
490494 r"pub(crate) use std::fmt::{Result, Display};
@@ -494,7 +498,7 @@ use std::io;",
494498
495499#[ test]
496500fn merge_groups_skip_attributed ( ) {
497- check_full (
501+ check_crate (
498502 "std::io" ,
499503 r#"
500504#[cfg(feature = "gated")] use std::fmt::{Result, Display};
@@ -509,7 +513,7 @@ use std::io;
509513#[ test]
510514#[ ignore] // FIXME: Support this
511515fn split_out_merge ( ) {
512- check_last (
516+ check_module (
513517 "std::fmt::Result" ,
514518 r"use std::{fmt, io};" ,
515519 r"use std::fmt::{self, Result};
@@ -519,29 +523,33 @@ use std::io;",
519523
520524#[ test]
521525fn merge_into_module_import ( ) {
522- check_full ( "std::fmt::Result" , r"use std::{fmt, io};" , r"use std::{fmt::{self, Result}, io};" )
526+ check_crate ( "std::fmt::Result" , r"use std::{fmt, io};" , r"use std::{fmt::{self, Result}, io};" )
523527}
524528
525529#[ test]
526530fn merge_groups_self ( ) {
527- check_full ( "std::fmt::Debug" , r"use std::fmt;" , r"use std::fmt::{self, Debug};" )
531+ check_crate ( "std::fmt::Debug" , r"use std::fmt;" , r"use std::fmt::{self, Debug};" )
528532}
529533
530534#[ test]
531535fn merge_mod_into_glob ( ) {
532- check_full ( "token::TokenKind" , r"use token::TokenKind::*;" , r"use token::TokenKind::{*, self};" )
536+ check_crate (
537+ "token::TokenKind" ,
538+ r"use token::TokenKind::*;" ,
539+ r"use token::TokenKind::{*, self};" ,
540+ )
533541 // FIXME: have it emit `use token::TokenKind::{self, *}`?
534542}
535543
536544#[ test]
537545fn merge_self_glob ( ) {
538- check_full ( "self" , r"use self::*;" , r"use self::{*, self};" )
546+ check_crate ( "self" , r"use self::*;" , r"use self::{*, self};" )
539547 // FIXME: have it emit `use {self, *}`?
540548}
541549
542550#[ test]
543551fn merge_glob_nested ( ) {
544- check_full (
552+ check_crate (
545553 "foo::bar::quux::Fez" ,
546554 r"use foo::bar::{Baz, quux::*};" ,
547555 r"use foo::bar::{Baz, quux::{self::*, Fez}};" ,
@@ -550,7 +558,7 @@ fn merge_glob_nested() {
550558
551559#[ test]
552560fn merge_nested_considers_first_segments ( ) {
553- check_full (
561+ check_crate (
554562 "hir_ty::display::write_bounds_like_dyn_trait" ,
555563 r"use hir_ty::{autoderef, display::{HirDisplayError, HirFormatter}, method_resolution};" ,
556564 r"use hir_ty::{autoderef, display::{HirDisplayError, HirFormatter, write_bounds_like_dyn_trait}, method_resolution};" ,
@@ -559,7 +567,7 @@ fn merge_nested_considers_first_segments() {
559567
560568#[ test]
561569fn skip_merge_last_too_long ( ) {
562- check_last (
570+ check_module (
563571 "foo::bar" ,
564572 r"use foo::bar::baz::Qux;" ,
565573 r"use foo::bar;
@@ -569,7 +577,7 @@ use foo::bar::baz::Qux;",
569577
570578#[ test]
571579fn skip_merge_last_too_long2 ( ) {
572- check_last (
580+ check_module (
573581 "foo::bar::baz::Qux" ,
574582 r"use foo::bar;" ,
575583 r"use foo::bar;
@@ -592,7 +600,7 @@ fn merge_last_fail() {
592600 check_merge_only_fail (
593601 r"use foo::bar::{baz::{Qux, Fez}};" ,
594602 r"use foo::bar::{baaz::{Quux, Feez}};" ,
595- MergeBehavior :: Last ,
603+ MergeBehavior :: Module ,
596604 ) ;
597605}
598606
@@ -601,7 +609,7 @@ fn merge_last_fail1() {
601609 check_merge_only_fail (
602610 r"use foo::bar::{baz::{Qux, Fez}};" ,
603611 r"use foo::bar::baaz::{Quux, Feez};" ,
604- MergeBehavior :: Last ,
612+ MergeBehavior :: Module ,
605613 ) ;
606614}
607615
@@ -610,7 +618,7 @@ fn merge_last_fail2() {
610618 check_merge_only_fail (
611619 r"use foo::bar::baz::{Qux, Fez};" ,
612620 r"use foo::bar::{baaz::{Quux, Feez}};" ,
613- MergeBehavior :: Last ,
621+ MergeBehavior :: Module ,
614622 ) ;
615623}
616624
@@ -619,7 +627,7 @@ fn merge_last_fail3() {
619627 check_merge_only_fail (
620628 r"use foo::bar::baz::{Qux, Fez};" ,
621629 r"use foo::bar::baaz::{Quux, Feez};" ,
622- MergeBehavior :: Last ,
630+ MergeBehavior :: Module ,
623631 ) ;
624632}
625633
@@ -648,12 +656,12 @@ fn check(
648656 assert_eq_text ! ( ra_fixture_after, & result) ;
649657}
650658
651- fn check_full ( path : & str , ra_fixture_before : & str , ra_fixture_after : & str ) {
652- check ( path, ra_fixture_before, ra_fixture_after, Some ( MergeBehavior :: Full ) , false , true )
659+ fn check_crate ( path : & str , ra_fixture_before : & str , ra_fixture_after : & str ) {
660+ check ( path, ra_fixture_before, ra_fixture_after, Some ( MergeBehavior :: Crate ) , false , true )
653661}
654662
655- fn check_last ( path : & str , ra_fixture_before : & str , ra_fixture_after : & str ) {
656- check ( path, ra_fixture_before, ra_fixture_after, Some ( MergeBehavior :: Last ) , false , true )
663+ fn check_module ( path : & str , ra_fixture_before : & str , ra_fixture_after : & str ) {
664+ check ( path, ra_fixture_before, ra_fixture_after, Some ( MergeBehavior :: Module ) , false , true )
657665}
658666
659667fn check_none ( path : & str , ra_fixture_before : & str , ra_fixture_after : & str ) {
0 commit comments