Skip to content

Commit b899d27

Browse files
committed
address feedback
1 parent d76fbc0 commit b899d27

File tree

2 files changed

+37
-20
lines changed

2 files changed

+37
-20
lines changed

libc-test/Cargo.toml

+1-3
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,6 @@ harness = true
107107
# once MSRV is above 1.64 and replaced with `[lints] workspace=true`
108108

109109
[lints.rust]
110-
# FIXME(cleanup): make ident usage consistent in each file
111-
# Switching this to "warn" causes issues with generated code
112-
unused_qualifications = "allow"
110+
unused_qualifications = "warn"
113111

114112
[lints.clippy]

libc-test/build.rs

+36-17
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#![deny(warnings)]
2+
#![allow(clippy::match_like_matches_macro)]
23

34
use std::fs::File;
45
use std::io::{BufRead, BufReader, BufWriter, Write};
@@ -435,7 +436,10 @@ fn test_apple(target: &str) {
435436

436437
cfg.volatile_item(|i| {
437438
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+
}
439443
});
440444

441445
cfg.type_name(move |ty, is_struct, is_union| {
@@ -912,7 +916,10 @@ fn test_windows(target: &str) {
912916
}
913917
});
914918

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+
});
916923
// FIXME(windows): All functions point to the wrong addresses?
917924
cfg.skip_fn_ptrcheck(|_| true);
918925

@@ -1098,7 +1105,10 @@ fn test_solarish(target: &str) {
10981105
}
10991106
}
11001107

1101-
cfg.skip_type(|ty| ty == "sighandler_t");
1108+
cfg.skip_type(move |ty| match ty {
1109+
"sighandler_t" => true,
1110+
_ => false,
1111+
});
11021112

11031113
cfg.type_name(move |ty, is_struct, is_union| match ty {
11041114
"FILE" => "__FILE".to_string(),
@@ -4824,7 +4834,10 @@ fn test_linux_like_apis(target: &str) {
48244834
cfg.skip_type(|_| true).skip_static(|_| true);
48254835

48264836
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+
})
48284841
.skip_const(|_| true)
48294842
.skip_struct(|_| true);
48304843
cfg.generate(src_hotfix_dir().join("lib.rs"), "linux_strerror_r.rs");
@@ -4870,11 +4883,10 @@ fn test_linux_like_apis(target: &str) {
48704883
cfg.skip_type(|_| true)
48714884
.skip_static(|_| true)
48724885
.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,
48784890
})
48794891
.skip_struct(|s| s != "termios2")
48804892
.type_name(move |ty, is_struct, is_union| match ty {
@@ -4900,15 +4912,13 @@ fn test_linux_like_apis(target: &str) {
49004912
.skip_fn(|_| true)
49014913
.skip_const(|_| true)
49024914
.skip_struct(|_| true)
4903-
.skip_const(|name| {
4904-
!matches!(
4905-
name,
4915+
.skip_const(move |name| match name {
49064916
"IPV6_FLOWINFO"
49074917
| "IPV6_FLOWLABEL_MGR"
49084918
| "IPV6_FLOWINFO_SEND"
49094919
| "IPV6_FLOWINFO_FLOWLABEL"
4910-
| "IPV6_FLOWINFO_PRIORITY"
4911-
)
4920+
| "IPV6_FLOWINFO_PRIORITY" => false,
4921+
_ => true,
49124922
})
49134923
.type_name(move |ty, is_struct, is_union| match ty {
49144924
t if is_struct => format!("struct {t}"),
@@ -4930,8 +4940,14 @@ fn test_linux_like_apis(target: &str) {
49304940
.skip_static(|_| true)
49314941
.skip_const(|_| true)
49324942
.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+
});
49354951
cfg.generate(src_hotfix_dir().join("lib.rs"), "linux_elf.rs");
49364952
}
49374953

@@ -4942,7 +4958,10 @@ fn test_linux_like_apis(target: &str) {
49424958
cfg.header("linux/if_arp.h");
49434959
cfg.skip_fn(|_| true)
49444960
.skip_static(|_| true)
4945-
.skip_const(|name| name != "ARPHRD_CAN")
4961+
.skip_const(move |name| match name {
4962+
"ARPHRD_CAN" => false,
4963+
_ => true,
4964+
})
49464965
.skip_struct(|_| true)
49474966
.skip_type(|_| true);
49484967
cfg.generate(src_hotfix_dir().join("lib.rs"), "linux_if_arp.rs");

0 commit comments

Comments
 (0)