1
1
#![ deny( warnings) ]
2
+ #![ allow( clippy:: match_like_matches_macro) ]
2
3
3
4
use std:: fs:: File ;
4
5
use std:: io:: { BufRead , BufReader , BufWriter , Write } ;
@@ -435,7 +436,10 @@ fn test_apple(target: &str) {
435
436
436
437
cfg. volatile_item ( |i| {
437
438
use ctest:: VolatileItemKind :: * ;
438
- matches ! ( i, StructField ( ref n, ref f) if n == "aiocb" && f == "aio_buf" )
439
+ match i {
440
+ StructField ( ref n, ref f) if n == "aiocb" && f == "aio_buf" => true ,
441
+ _ => false ,
442
+ }
439
443
} ) ;
440
444
441
445
cfg. type_name ( move |ty, is_struct, is_union| {
@@ -912,7 +916,10 @@ fn test_windows(target: &str) {
912
916
}
913
917
} ) ;
914
918
915
- cfg. skip_field ( |s, field| s == "CONTEXT" && field == "Fp" ) ;
919
+ cfg. skip_field ( move |s, field| match s {
920
+ "CONTEXT" if field == "Fp" => true ,
921
+ _ => false ,
922
+ } ) ;
916
923
// FIXME(windows): All functions point to the wrong addresses?
917
924
cfg. skip_fn_ptrcheck ( |_| true ) ;
918
925
@@ -1098,7 +1105,10 @@ fn test_solarish(target: &str) {
1098
1105
}
1099
1106
}
1100
1107
1101
- cfg. skip_type ( |ty| ty == "sighandler_t" ) ;
1108
+ cfg. skip_type ( move |ty| match ty {
1109
+ "sighandler_t" => true ,
1110
+ _ => false ,
1111
+ } ) ;
1102
1112
1103
1113
cfg. type_name ( move |ty, is_struct, is_union| match ty {
1104
1114
"FILE" => "__FILE" . to_string ( ) ,
@@ -4824,7 +4834,10 @@ fn test_linux_like_apis(target: &str) {
4824
4834
cfg. skip_type ( |_| true ) . skip_static ( |_| true ) ;
4825
4835
4826
4836
headers ! { cfg: "string.h" }
4827
- cfg. skip_fn ( |f| f != "strerror_r" )
4837
+ cfg. skip_fn ( |f| match f {
4838
+ "strerror_r" => false ,
4839
+ _ => true ,
4840
+ } )
4828
4841
. skip_const ( |_| true )
4829
4842
. skip_struct ( |_| true ) ;
4830
4843
cfg. generate ( src_hotfix_dir ( ) . join ( "lib.rs" ) , "linux_strerror_r.rs" ) ;
@@ -4870,11 +4883,10 @@ fn test_linux_like_apis(target: &str) {
4870
4883
cfg. skip_type ( |_| true )
4871
4884
. skip_static ( |_| true )
4872
4885
. skip_fn ( |_| true )
4873
- . skip_const ( |c| {
4874
- !matches ! (
4875
- c,
4876
- "BOTHER" | "IBSHIFT" | "TCGETS2" | "TCSETS2" | "TCSETSW2" | "TCSETSF2"
4877
- )
4886
+ . skip_const ( |c| match c {
4887
+ "BOTHER" | "IBSHIFT" => false ,
4888
+ "TCGETS2" | "TCSETS2" | "TCSETSW2" | "TCSETSF2" => false ,
4889
+ _ => true ,
4878
4890
} )
4879
4891
. skip_struct ( |s| s != "termios2" )
4880
4892
. type_name ( move |ty, is_struct, is_union| match ty {
@@ -4900,15 +4912,13 @@ fn test_linux_like_apis(target: &str) {
4900
4912
. skip_fn ( |_| true )
4901
4913
. skip_const ( |_| true )
4902
4914
. skip_struct ( |_| true )
4903
- . skip_const ( |name| {
4904
- !matches ! (
4905
- name,
4915
+ . skip_const ( move |name| match name {
4906
4916
"IPV6_FLOWINFO"
4907
4917
| "IPV6_FLOWLABEL_MGR"
4908
4918
| "IPV6_FLOWINFO_SEND"
4909
4919
| "IPV6_FLOWINFO_FLOWLABEL"
4910
- | "IPV6_FLOWINFO_PRIORITY"
4911
- )
4920
+ | "IPV6_FLOWINFO_PRIORITY" => false ,
4921
+ _ => true ,
4912
4922
} )
4913
4923
. type_name ( move |ty, is_struct, is_union| match ty {
4914
4924
t if is_struct => format ! ( "struct {t}" ) ,
@@ -4930,8 +4940,14 @@ fn test_linux_like_apis(target: &str) {
4930
4940
. skip_static ( |_| true )
4931
4941
. skip_const ( |_| true )
4932
4942
. type_name ( move |ty, _is_struct, _is_union| ty. to_string ( ) )
4933
- . skip_struct ( |ty| !matches ! ( ty, "Elf64_Phdr" | "Elf32_Phdr" ) )
4934
- . skip_type ( |ty| !matches ! ( ty, "Elf64_Phdr" | "Elf32_Phdr" ) ) ;
4943
+ . skip_struct ( move |ty| match ty {
4944
+ "Elf64_Phdr" | "Elf32_Phdr" => false ,
4945
+ _ => true ,
4946
+ } )
4947
+ . skip_type ( move |ty| match ty {
4948
+ "Elf64_Phdr" | "Elf32_Phdr" => false ,
4949
+ _ => true ,
4950
+ } ) ;
4935
4951
cfg. generate ( src_hotfix_dir ( ) . join ( "lib.rs" ) , "linux_elf.rs" ) ;
4936
4952
}
4937
4953
@@ -4942,7 +4958,10 @@ fn test_linux_like_apis(target: &str) {
4942
4958
cfg. header ( "linux/if_arp.h" ) ;
4943
4959
cfg. skip_fn ( |_| true )
4944
4960
. skip_static ( |_| true )
4945
- . skip_const ( |name| name != "ARPHRD_CAN" )
4961
+ . skip_const ( move |name| match name {
4962
+ "ARPHRD_CAN" => false ,
4963
+ _ => true ,
4964
+ } )
4946
4965
. skip_struct ( |_| true )
4947
4966
. skip_type ( |_| true ) ;
4948
4967
cfg. generate ( src_hotfix_dir ( ) . join ( "lib.rs" ) , "linux_if_arp.rs" ) ;
0 commit comments