@@ -702,11 +702,11 @@ fn fix_features() {
702
702
#[ test]
703
703
fn shows_warnings ( ) {
704
704
let p = project ( )
705
- . file ( "src/lib.rs" , "use std::default::Default; pub fn foo() {}" )
705
+ . file ( "src/lib.rs" , "#[deprecated] fn bar() {} pub fn foo() { let _ = bar(); }" )
706
706
. build ( ) ;
707
707
708
708
p. cargo ( "fix --allow-no-vcs" )
709
- . with_stderr_contains ( "[..]warning: unused import [..]" )
709
+ . with_stderr_contains ( "[..]warning: use of deprecated item [..]" )
710
710
. run ( ) ;
711
711
}
712
712
@@ -982,20 +982,22 @@ fn shows_warnings_on_second_run_without_changes() {
982
982
. file (
983
983
"src/lib.rs" ,
984
984
r#"
985
- use std::default::Default;
985
+ #[deprecated]
986
+ fn bar() {}
986
987
987
988
pub fn foo() {
989
+ let _ = bar();
988
990
}
989
991
"# ,
990
992
)
991
993
. build ( ) ;
992
994
993
995
p. cargo ( "fix --allow-no-vcs" )
994
- . with_stderr_contains ( "[..]warning: unused import [..]" )
996
+ . with_stderr_contains ( "[..]warning: use of deprecated item [..]" )
995
997
. run ( ) ;
996
998
997
999
p. cargo ( "fix --allow-no-vcs" )
998
- . with_stderr_contains ( "[..]warning: unused import [..]" )
1000
+ . with_stderr_contains ( "[..]warning: use of deprecated item [..]" )
999
1001
. run ( ) ;
1000
1002
}
1001
1003
@@ -1005,65 +1007,76 @@ fn shows_warnings_on_second_run_without_changes_on_multiple_targets() {
1005
1007
. file (
1006
1008
"src/lib.rs" ,
1007
1009
r#"
1008
- use std::default::Default;
1010
+ #[deprecated]
1011
+ fn bar() {}
1009
1012
1010
- pub fn a() -> u32 { 3 }
1013
+ pub fn foo() {
1014
+ let _ = bar();
1015
+ }
1011
1016
"# ,
1012
1017
)
1013
1018
. file (
1014
1019
"src/main.rs" ,
1015
1020
r#"
1016
- use std::default::Default;
1017
- fn main() { println!("3"); }
1021
+ #[deprecated]
1022
+ fn bar() {}
1023
+
1024
+ fn main() {
1025
+ let _ = bar();
1026
+ }
1018
1027
"# ,
1019
1028
)
1020
1029
. file (
1021
1030
"tests/foo.rs" ,
1022
1031
r#"
1023
- use std::default::Default;
1032
+ #[deprecated]
1033
+ fn bar() {}
1034
+
1024
1035
#[test]
1025
1036
fn foo_test() {
1026
- println!("3" );
1037
+ let _ = bar( );
1027
1038
}
1028
1039
"# ,
1029
1040
)
1030
1041
. file (
1031
1042
"tests/bar.rs" ,
1032
1043
r#"
1033
- use std::default::Default;
1044
+ #[deprecated]
1045
+ fn bar() {}
1034
1046
1035
1047
#[test]
1036
1048
fn foo_test() {
1037
- println!("3" );
1049
+ let _ = bar( );
1038
1050
}
1039
1051
"# ,
1040
1052
)
1041
1053
. file (
1042
1054
"examples/fooxample.rs" ,
1043
1055
r#"
1044
- use std::default::Default;
1056
+ #[deprecated]
1057
+ fn bar() {}
1045
1058
1046
1059
fn main() {
1047
- println!("3" );
1060
+ let _ = bar( );
1048
1061
}
1049
1062
"# ,
1050
1063
)
1051
1064
. build ( ) ;
1052
1065
1053
1066
p. cargo ( "fix --allow-no-vcs --all-targets" )
1054
- . with_stderr_contains ( " --> examples/fooxample.rs:2:21 " )
1055
- . with_stderr_contains ( " --> src/lib.rs:2:21 " )
1056
- . with_stderr_contains ( " --> src/main.rs:2:21 " )
1057
- . with_stderr_contains ( " --> tests/bar.rs:2:21 " )
1058
- . with_stderr_contains ( " --> tests/foo.rs:2:21 " )
1067
+ . with_stderr_contains ( " --> examples/fooxample.rs:6:29 " )
1068
+ . with_stderr_contains ( " --> src/lib.rs:6:29 " )
1069
+ . with_stderr_contains ( " --> src/main.rs:6:29 " )
1070
+ . with_stderr_contains ( " --> tests/bar.rs:7:29 " )
1071
+ . with_stderr_contains ( " --> tests/foo.rs:7:29 " )
1059
1072
. run ( ) ;
1060
1073
1061
1074
p. cargo ( "fix --allow-no-vcs --all-targets" )
1062
- . with_stderr_contains ( " --> examples/fooxample.rs:2:21 " )
1063
- . with_stderr_contains ( " --> src/lib.rs:2:21 " )
1064
- . with_stderr_contains ( " --> src/main.rs:2:21 " )
1065
- . with_stderr_contains ( " --> tests/bar.rs:2:21 " )
1066
- . with_stderr_contains ( " --> tests/foo.rs:2:21 " )
1075
+ . with_stderr_contains ( " --> examples/fooxample.rs:6:29 " )
1076
+ . with_stderr_contains ( " --> src/lib.rs:6:29 " )
1077
+ . with_stderr_contains ( " --> src/main.rs:6:29 " )
1078
+ . with_stderr_contains ( " --> tests/bar.rs:7:29 " )
1079
+ . with_stderr_contains ( " --> tests/foo.rs:7:29 " )
1067
1080
. run ( ) ;
1068
1081
}
1069
1082
0 commit comments