@@ -515,6 +515,27 @@ fn check_virtual_manifest_one_project() {
515515 . run ( ) ;
516516}
517517
518+ #[ cargo_test]
519+ fn check_virtual_manifest_one_bin_project_not_in_default_members ( ) {
520+ let p = project ( )
521+ . file (
522+ "Cargo.toml" ,
523+ r#"
524+ [workspace]
525+ members = ["bar"]
526+ default-members = []
527+ resolver = "3"
528+ "# ,
529+ )
530+ . file ( "bar/Cargo.toml" , & basic_manifest ( "bar" , "0.1.0" ) )
531+ . file ( "bar/src/main.rs" , "fn main() { let _ = (1); }" )
532+ . build ( ) ;
533+
534+ p. cargo ( "check -p bar" )
535+ . with_stderr_contains ( "[..]run `cargo fix --bin \" bar\" -p bar` to apply[..]" )
536+ . run ( ) ;
537+ }
538+
518539#[ cargo_test]
519540fn check_virtual_manifest_glob ( ) {
520541 let p = project ( )
@@ -1400,7 +1421,7 @@ fn check_fixable_example() {
14001421 p. cargo ( "check --all-targets" )
14011422 . with_stderr_data ( str![ [ r#"
14021423...
1403- [WARNING] `foo` (example "ex1") generated 1 warning (run `cargo fix --example "ex1"` to apply 1 suggestion)
1424+ [WARNING] `foo` (example "ex1") generated 1 warning (run `cargo fix --example "ex1" -p foo ` to apply 1 suggestion)
14041425...
14051426"# ] ] )
14061427 . run ( ) ;
@@ -1446,7 +1467,7 @@ fn check_fixable_bench() {
14461467 p. cargo ( "check --all-targets" )
14471468 . with_stderr_data ( str![ [ r#"
14481469...
1449- [WARNING] `foo` (bench "bench") generated 1 warning (run `cargo fix --bench "bench"` to apply 1 suggestion)
1470+ [WARNING] `foo` (bench "bench") generated 1 warning (run `cargo fix --bench "bench" -p foo ` to apply 1 suggestion)
14501471...
14511472"# ] ] )
14521473 . run ( ) ;
@@ -1496,9 +1517,9 @@ fn check_fixable_mixed() {
14961517 . build ( ) ;
14971518 p. cargo ( "check --all-targets" )
14981519 . with_stderr_data ( str![ [ r#"
1499- [WARNING] `foo` (example "ex1") generated 1 warning (run `cargo fix --example "ex1"` to apply 1 suggestion)
1500- [WARNING] `foo` (bench "bench") generated 1 warning (run `cargo fix --bench "bench"` to apply 1 suggestion)
1501- [WARNING] `foo` (bin "foo" test) generated 2 warnings (run `cargo fix --bin "foo" --tests` to apply 2 suggestions)
1520+ [WARNING] `foo` (example "ex1") generated 1 warning (run `cargo fix --example "ex1" -p foo ` to apply 1 suggestion)
1521+ [WARNING] `foo` (bench "bench") generated 1 warning (run `cargo fix --bench "bench" -p foo ` to apply 1 suggestion)
1522+ [WARNING] `foo` (bin "foo" test) generated 2 warnings (run `cargo fix --bin "foo" -p foo - -tests` to apply 2 suggestions)
15021523...
15031524"# ] ] . unordered ( ) )
15041525 . run ( ) ;
0 commit comments