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