Repository: rust-lang/rust-bindgen
Pull request #3010 (2024-11-30 22:22:20)

Improve debug str generator
Generates more optimized code per https://rust-lang.github.io/rust-clippy/master/index.html#format_collect


Patch:
diff --git a/Cargo.lock b/Cargo.lock
index e5918dcc..f7accc9e 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -4,9 +4,9 @@ version = 3
 
 [[package]]
 name = "aho-corasick"
-version = "0.7.20"
+version = "1.1.3"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "cc936419f96fa211c1b9166887b38e5e40b19958e5b895be7c1f93adec7071ac"
+checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916"
 dependencies = [
  "memchr",
 ]
@@ -23,9 +23,15 @@ dependencies = [
 
 [[package]]
 name = "anstyle"
-version = "1.0.8"
+version = "1.0.10"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1bec1de6f59aedf83baf9ff929c98f2ad654b97c9510f4e70cf6f661d49fd5b1"
+checksum = "55cc3b69f167a1ef2e161439aa98aed94e6028e5f9a59be9a6ffb47aef1651f9"
+
+[[package]]
+name = "autocfg"
+version = "1.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26"
 
 [[package]]
 name = "bindgen"
@@ -45,7 +51,7 @@ dependencies = [
  "regex",
  "rustc-hash",
  "shlex",
- "syn 2.0.18",
+ "syn 2.0.90",
 ]
 
 [[package]]
@@ -77,7 +83,7 @@ dependencies = [
  "proc-macro2",
  "shlex",
  "similar",
- "syn 2.0.18",
+ "syn 2.0.90",
  "tempfile",
 ]
 
@@ -101,9 +107,12 @@ checksum = "0d8c1fef690941d3e7788d328517591fecc684c084084702d6ff1641e993699a"
 
 [[package]]
 name = "cc"
-version = "1.0.78"
+version = "1.2.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a20104e2335ce8a659d6dd92a51a767a0c062599c73b343fd152cb401e828c3d"
+checksum = "f34d93e62b03caf570cccc334cbc6c2fceca82f39211051345108adcba3eebdc"
+dependencies = [
+ "shlex",
+]
 
 [[package]]
 name = "cexpr"
@@ -122,9 +131,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
 
 [[package]]
 name = "clang-sys"
-version = "1.4.0"
+version = "1.8.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fa2e27ae6ab525c3d369ded447057bca5438d86dc3a68f6faafb8269ba82ebf3"
+checksum = "0b023947811758c97c59bf9d1c188fd619ad4718dcaa767947df1cadb14f39f4"
 dependencies = [
  "glob",
  "libc",
@@ -165,7 +174,7 @@ dependencies = [
  "proc-macro-error",
  "proc-macro2",
  "quote",
- "syn 1.0.107",
+ "syn 1.0.109",
 ]
 
 [[package]]
@@ -179,9 +188,9 @@ dependencies = [
 
 [[package]]
 name = "either"
-version = "1.8.1"
+version = "1.13.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91"
+checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0"
 
 [[package]]
 name = "env_logger"
@@ -208,39 +217,28 @@ dependencies = [
 
 [[package]]
 name = "errno"
-version = "0.3.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4bcfec3a70f97c962c307b2d2c56e358cf1d00b558d74262b5f929ee8cc7e73a"
-dependencies = [
- "errno-dragonfly",
- "libc",
- "windows-sys 0.48.0",
-]
-
-[[package]]
-name = "errno-dragonfly"
-version = "0.1.2"
+version = "0.3.10"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf"
+checksum = "33d852cb9b869c2a9b3df2f71a3074817f01e1844f839a144f5fcef059a4eb5d"
 dependencies = [
- "cc",
  "libc",
+ "windows-sys 0.52.0",
 ]
 
 [[package]]
 name = "fastrand"
-version = "1.8.0"
+version = "1.9.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a7a407cfaa3385c4ae6b23e84623d48c2798d06e3e6a1878f7f59f17b3f86499"
+checksum = "e51093e27b0797c359783294ca4f0a911c270184cb10f85783b118614a1501be"
 dependencies = [
  "instant",
 ]
 
 [[package]]
 name = "getrandom"
-version = "0.2.8"
+version = "0.2.15"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c05aeb6a22b8f62540c194aac980f2115af067bfe15a0734d7277a768d396b31"
+checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7"
 dependencies = [
  "cfg-if",
  "libc",
@@ -255,15 +253,21 @@ checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b"
 
 [[package]]
 name = "heck"
-version = "0.4.0"
+version = "0.4.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2540771e65fc8cb83cd6e8a237f70c319bd5c29f78ed1084ba5d50eeac86f7f9"
+checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8"
 
 [[package]]
 name = "hermit-abi"
-version = "0.3.2"
+version = "0.3.9"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "443144c8cdadd93ebf52ddb4056d257f5b52c04d3c804e657d19eb73fc33668b"
+checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024"
+
+[[package]]
+name = "hermit-abi"
+version = "0.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "fbf6a919d6cf397374f7dfeeea91d974c7c0a7221d0d0f4f20d859d329e53fcc"
 
 [[package]]
 name = "humantime"
@@ -282,24 +286,24 @@ dependencies = [
 
 [[package]]
 name = "io-lifetimes"
-version = "1.0.4"
+version = "1.0.11"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e7d6c6f8c91b4b9ed43484ad1a938e393caf35960fce7f82a040497207bd8e9e"
+checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2"
 dependencies = [
+ "hermit-abi 0.3.9",
  "libc",
- "windows-sys 0.42.0",
+ "windows-sys 0.48.0",
 ]
 
 [[package]]
 name = "is-terminal"
-version = "0.4.7"
+version = "0.4.13"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "adcf93614601c8129ddf72e2d5633df827ba6551541c6d8c59520a371475be1f"
+checksum = "261f68e344040fbd0edea105bef17c66edf46f984ddb1115b775ce31be948f4b"
 dependencies = [
- "hermit-abi",
- "io-lifetimes",
- "rustix",
- "windows-sys 0.48.0",
+ "hermit-abi 0.4.0",
+ "libc",
+ "windows-sys 0.52.0",
 ]
 
 [[package]]
@@ -313,18 +317,18 @@ dependencies = [
 
 [[package]]
 name = "libc"
-version = "0.2.159"
+version = "0.2.167"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "561d97a539a36e26a9a5fad1ea11a3039a67714694aaa379433e580854bc3dc5"
+checksum = "09d6582e104315a817dff97f75133544b2e094ee22447d2acf4a74e189ba06fc"
 
 [[package]]
 name = "libloading"
-version = "0.7.4"
+version = "0.8.6"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b67380fd3b2fbe7527a606e18729d21c6f3951633d0500574c4dc22d2d638b9f"
+checksum = "fc2f4eb4bc735547cfed7c0a4922cbd04a4655978c09b54f1f7b228750664c34"
 dependencies = [
  "cfg-if",
- "winapi",
+ "windows-targets 0.52.6",
 ]
 
 [[package]]
@@ -335,12 +339,9 @@ checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519"
 
 [[package]]
 name = "log"
-version = "0.4.17"
+version = "0.4.22"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e"
-dependencies = [
- "cfg-if",
-]
+checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24"
 
 [[package]]
 name = "malloc_buf"
@@ -353,9 +354,9 @@ dependencies = [
 
 [[package]]
 name = "memchr"
-version = "2.5.0"
+version = "2.7.4"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d"
+checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3"
 
 [[package]]
 name = "minimal-lexical"
@@ -384,9 +385,9 @@ dependencies = [
 
 [[package]]
 name = "once_cell"
-version = "1.17.0"
+version = "1.20.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6f61fba1741ea2b3d6a1e3178721804bb716a68a6aeba1149b5d52e3d464ea66"
+checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775"
 
 [[package]]
 name = "os_str_bytes"
@@ -396,18 +397,18 @@ checksum = "9b7820b9daea5457c9f21c69448905d723fbd21136ccf521748f23fd49e723ee"
 
 [[package]]
 name = "owo-colors"
-version = "3.5.0"
+version = "4.1.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c1b04fb49957986fdce4d6ee7a65027d55d4b6d2265e5848bbb507b58ccfdb6f"
+checksum = "fb37767f6569cd834a413442455e0f066d0d522de8630436e2a1761d9726ba56"
 
 [[package]]
 name = "prettyplease"
-version = "0.2.7"
+version = "0.2.25"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "43ded2b5b204571f065ab8540367d738dfe1b3606ab9eb669dcfb5e7a3a07501"
+checksum = "64d1ec885c64d0457d564db4ec299b2dae3f9c02808b8ad9c3a089c591b18033"
 dependencies = [
  "proc-macro2",
- "syn 2.0.18",
+ "syn 2.0.90",
 ]
 
 [[package]]
@@ -419,7 +420,7 @@ dependencies = [
  "proc-macro-error-attr",
  "proc-macro2",
  "quote",
- "syn 1.0.107",
+ "syn 1.0.109",
  "version_check",
 ]
 
@@ -465,9 +466,9 @@ dependencies = [
 
 [[package]]
 name = "quote"
-version = "1.0.28"
+version = "1.0.37"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488"
+checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af"
 dependencies = [
  "proc-macro2",
 ]
@@ -501,9 +502,21 @@ dependencies = [
 
 [[package]]
 name = "regex"
-version = "1.7.1"
+version = "1.11.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191"
+dependencies = [
+ "aho-corasick",
+ "memchr",
+ "regex-automata",
+ "regex-syntax",
+]
+
+[[package]]
+name = "regex-automata"
+version = "0.4.9"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "48aaa5748ba571fb95cd2c85c09f629215d3a6ece942baa100950af03a34f733"
+checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908"
 dependencies = [
  "aho-corasick",
  "memchr",
@@ -512,28 +525,28 @@ dependencies = [
 
 [[package]]
 name = "regex-syntax"
-version = "0.6.28"
+version = "0.8.5"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "456c603be3e8d448b072f410900c09faf164fbce2d480456f50eea6e25f9c848"
+checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c"
 
 [[package]]
 name = "rustc-hash"
-version = "1.1.0"
+version = "2.1.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2"
+checksum = "c7fb8039b3032c191086b10f11f319a6e99e1e82889c5cc6046f515c9db1d497"
 
 [[package]]
 name = "rustix"
-version = "0.37.7"
+version = "0.37.27"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2aae838e49b3d63e9274e1c01833cc8139d3fec468c3b84688c628f44b1ae11d"
+checksum = "fea8ca367a3a01fe35e6943c400addf443c0f57670e6ec51196f71a4b8762dd2"
 dependencies = [
  "bitflags 1.3.2",
  "errno",
  "io-lifetimes",
  "libc",
  "linux-raw-sys",
- "windows-sys 0.45.0",
+ "windows-sys 0.48.0",
 ]
 
 [[package]]
@@ -544,9 +557,9 @@ checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
 
 [[package]]
 name = "similar"
-version = "2.2.1"
+version = "2.6.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "420acb44afdae038210c99e69aae24109f32f15500aa708e81d46c9f29d55fcf"
+checksum = "1de1d4f81173b03af4c0cbed3c898f6bff5b870e4a7f5d6f4057d62a7a4b686e"
 
 [[package]]
 name = "strsim"
@@ -556,9 +569,9 @@ checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623"
 
 [[package]]
 name = "syn"
-version = "1.0.107"
+version = "1.0.109"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1f4064b5b16e03ae50984a5a8ed5d4f8803e6bc1fd170a3cda91a1be4b18e3f5"
+checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237"
 dependencies = [
  "proc-macro2",
  "quote",
@@ -567,9 +580,9 @@ dependencies = [
 
 [[package]]
 name = "syn"
-version = "2.0.18"
+version = "2.0.90"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "32d41677bcbe24c20c52e7c70b0d8db04134c5d1066bf98662e2871ad200ea3e"
+checksum = "919d3b74a5dd0ccd15aeb8f93e7006bd9e14c295087c9896a110f490752bcf31"
 dependencies = [
  "proc-macro2",
  "quote",
@@ -578,15 +591,16 @@ dependencies = [
 
 [[package]]
 name = "tempfile"
-version = "3.5.0"
+version = "3.6.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b9fbec84f381d5795b08656e4912bec604d162bff9291d6189a78f4c8ab87998"
+checksum = "31c0432476357e58790aaa47a8efb0c5138f137343f3b5f23bd36a27e3b0a6d6"
 dependencies = [
+ "autocfg",
  "cfg-if",
  "fastrand",
  "redox_syscall",
  "rustix",
- "windows-sys 0.45.0",
+ "windows-sys 0.48.0",
 ]
 
 [[package]]
@@ -609,15 +623,15 @@ dependencies = [
 
 [[package]]
 name = "unicode-ident"
-version = "1.0.6"
+version = "1.0.14"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "84a22b9f218b40614adcb3f4ff08b703773ad44fa9423e4e0d346d5db86e4ebc"
+checksum = "adb9e6ca4f869e1180728b7950e35922a7fc6397f7b641499e8f3ef06e50dc83"
 
 [[package]]
 name = "unicode-width"
-version = "0.1.13"
+version = "0.1.14"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0336d538f7abc86d282a4189614dfaa90810dfc2c6f6427eaf88e16311dd225d"
+checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af"
 
 [[package]]
 name = "version_check"
@@ -664,147 +678,139 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
 
 [[package]]
 name = "windows-sys"
-version = "0.42.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7"
-dependencies = [
- "windows_aarch64_gnullvm 0.42.2",
- "windows_aarch64_msvc 0.42.2",
- "windows_i686_gnu 0.42.2",
- "windows_i686_msvc 0.42.2",
- "windows_x86_64_gnu 0.42.2",
- "windows_x86_64_gnullvm 0.42.2",
- "windows_x86_64_msvc 0.42.2",
-]
-
-[[package]]
-name = "windows-sys"
-version = "0.45.0"
+version = "0.48.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0"
+checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9"
 dependencies = [
- "windows-targets 0.42.2",
+ "windows-targets 0.48.5",
 ]
 
 [[package]]
 name = "windows-sys"
-version = "0.48.0"
+version = "0.52.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9"
+checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d"
 dependencies = [
- "windows-targets 0.48.1",
+ "windows-targets 0.52.6",
 ]
 
 [[package]]
 name = "windows-targets"
-version = "0.42.2"
+version = "0.48.5"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071"
+checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c"
 dependencies = [
- "windows_aarch64_gnullvm 0.42.2",
- "windows_aarch64_msvc 0.42.2",
- "windows_i686_gnu 0.42.2",
- "windows_i686_msvc 0.42.2",
- "windows_x86_64_gnu 0.42.2",
- "windows_x86_64_gnullvm 0.42.2",
- "windows_x86_64_msvc 0.42.2",
+ "windows_aarch64_gnullvm 0.48.5",
+ "windows_aarch64_msvc 0.48.5",
+ "windows_i686_gnu 0.48.5",
+ "windows_i686_msvc 0.48.5",
+ "windows_x86_64_gnu 0.48.5",
+ "windows_x86_64_gnullvm 0.48.5",
+ "windows_x86_64_msvc 0.48.5",
 ]
 
 [[package]]
 name = "windows-targets"
-version = "0.48.1"
+version = "0.52.6"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "05d4b17490f70499f20b9e791dcf6a299785ce8af4d709018206dc5b4953e95f"
+checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973"
 dependencies = [
- "windows_aarch64_gnullvm 0.48.0",
- "windows_aarch64_msvc 0.48.0",
- "windows_i686_gnu 0.48.0",
- "windows_i686_msvc 0.48.0",
- "windows_x86_64_gnu 0.48.0",
- "windows_x86_64_gnullvm 0.48.0",
- "windows_x86_64_msvc 0.48.0",
+ "windows_aarch64_gnullvm 0.52.6",
+ "windows_aarch64_msvc 0.52.6",
+ "windows_i686_gnu 0.52.6",
+ "windows_i686_gnullvm",
+ "windows_i686_msvc 0.52.6",
+ "windows_x86_64_gnu 0.52.6",
+ "windows_x86_64_gnullvm 0.52.6",
+ "windows_x86_64_msvc 0.52.6",
 ]
 
 [[package]]
 name = "windows_aarch64_gnullvm"
-version = "0.42.2"
+version = "0.48.5"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8"
+checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8"
 
 [[package]]
 name = "windows_aarch64_gnullvm"
-version = "0.48.0"
+version = "0.52.6"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc"
+checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3"
 
 [[package]]
 name = "windows_aarch64_msvc"
-version = "0.42.2"
+version = "0.48.5"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43"
+checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc"
 
 [[package]]
 name = "windows_aarch64_msvc"
-version = "0.48.0"
+version = "0.52.6"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3"
+checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469"
 
 [[package]]
 name = "windows_i686_gnu"
-version = "0.42.2"
+version = "0.48.5"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f"
+checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e"
 
 [[package]]
 name = "windows_i686_gnu"
-version = "0.48.0"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b"
+
+[[package]]
+name = "windows_i686_gnullvm"
+version = "0.52.6"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241"
+checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66"
 
 [[package]]
 name = "windows_i686_msvc"
-version = "0.42.2"
+version = "0.48.5"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060"
+checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406"
 
 [[package]]
 name = "windows_i686_msvc"
-version = "0.48.0"
+version = "0.52.6"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00"
+checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66"
 
 [[package]]
 name = "windows_x86_64_gnu"
-version = "0.42.2"
+version = "0.48.5"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36"
+checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e"
 
 [[package]]
 name = "windows_x86_64_gnu"
-version = "0.48.0"
+version = "0.52.6"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1"
+checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78"
 
 [[package]]
 name = "windows_x86_64_gnullvm"
-version = "0.42.2"
+version = "0.48.5"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3"
+checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc"
 
 [[package]]
 name = "windows_x86_64_gnullvm"
-version = "0.48.0"
+version = "0.52.6"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953"
+checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d"
 
 [[package]]
 name = "windows_x86_64_msvc"
-version = "0.42.2"
+version = "0.48.5"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0"
+checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538"
 
 [[package]]
 name = "windows_x86_64_msvc"
-version = "0.48.0"
+version = "0.52.6"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a"
+checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
diff --git a/Cargo.toml b/Cargo.toml
index 87b464aa..cd5e4e62 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -32,21 +32,35 @@ clap = "4"
 clap_complete = "4"
 env_logger = "0.10.0"
 itertools = { version = ">=0.10,<0.14", default-features = false }
-libloading = "0.7"
+libloading = "0.8"
 log = "0.4"
 objc = "0.2"
-owo-colors = "3.5.0"
+owo-colors = "4.1.0"
 prettyplease = "0.2.7"
 proc-macro2 = "1"
 quickcheck = "1.0"
 quote = { version = "1", default-features = false }
 regex = { version = "1.5.3", default-features = false }
-rustc-hash = "1.0.1"
+rustc-hash = "2.1.0"
 shlex = "1"
 similar = "2.2.1"
 syn = "2.0"
 tempfile = "3"
 
+[workspace.lints.rust]
+# unused_qualifications = "warn"
+
+[workspace.lints.clippy]
+# disallowed-names = "allow"
+# manual-c-str-literals = "allow"
+# missing-safety-doc = "allow"
+# op-ref = "allow"
+# ptr-offset-with-cast = "allow"
+# too-many-arguments = "allow"
+# transmute-int-to-bool = "allow"
+# unnecessary-cast = "allow"
+# useless-transmute  = "allow"
+
 # Config for 'cargo dist'
 [workspace.metadata.dist]
 # The preferred cargo-dist version to use in CI (Cargo.toml SemVer syntax)
diff --git a/bindgen-cli/Cargo.toml b/bindgen-cli/Cargo.toml
index 09a3f554..d1e0bf40 100644
--- a/bindgen-cli/Cargo.toml
+++ b/bindgen-cli/Cargo.toml
@@ -1,3 +1,5 @@
+lints.workspace = true
+
 [package]
 authors = [
     "The rust-bindgen project contributors",
diff --git a/bindgen-integration/Cargo.toml b/bindgen-integration/Cargo.toml
index 13bbcd09..5c8c89d5 100644
--- a/bindgen-integration/Cargo.toml
+++ b/bindgen-integration/Cargo.toml
@@ -1,3 +1,5 @@
+lints.workspace = true
+
 [package]
 name = "bindgen-integration"
 description = "A package to test various bindgen features"
diff --git a/bindgen-integration/build.rs b/bindgen-integration/build.rs
index c7125698..583f46ea 100644
--- a/bindgen-integration/build.rs
+++ b/bindgen-integration/build.rs
@@ -183,7 +183,7 @@ fn setup_macro_test() {
     let out_path = PathBuf::from(env::var("OUT_DIR").unwrap());
     let out_rust_file = out_path.join("test.rs");
     let out_rust_file_relative = out_rust_file
-        .strip_prefix(std::env::current_dir().unwrap().parent().unwrap())
+        .strip_prefix(env::current_dir().unwrap().parent().unwrap())
         .unwrap();
     let out_dep_file = out_path.join("test.d");
 
diff --git a/bindgen/Cargo.toml b/bindgen/Cargo.toml
index dd4166de..8f61afe2 100644
--- a/bindgen/Cargo.toml
+++ b/bindgen/Cargo.toml
@@ -1,3 +1,5 @@
+lints.workspace = true
+
 [package]
 authors = [
     "Jyun-Yan You <jyyou.tw@gmail.com>",
diff --git a/bindgen/build.rs b/bindgen/build.rs
index 8407ceae..4fb2d307 100644
--- a/bindgen/build.rs
+++ b/bindgen/build.rs
@@ -20,10 +20,10 @@ fn main() {
     println!("cargo:rerun-if-env-changed=BINDGEN_EXTRA_CLANG_ARGS");
     println!(
         "cargo:rerun-if-env-changed=BINDGEN_EXTRA_CLANG_ARGS_{}",
-        std::env::var("TARGET").unwrap()
+        env::var("TARGET").unwrap()
     );
     println!(
         "cargo:rerun-if-env-changed=BINDGEN_EXTRA_CLANG_ARGS_{}",
-        std::env::var("TARGET").unwrap().replace('-', "_")
+        env::var("TARGET").unwrap().replace('-', "_")
     );
 }
diff --git a/bindgen/clang.rs b/bindgen/clang.rs
index bca4a809..7a21aa9f 100644
--- a/bindgen/clang.rs
+++ b/bindgen/clang.rs
@@ -216,10 +216,10 @@ impl Cursor {
             })
             .or_else(|| {
                 let canonical = self.canonical();
-                if canonical != *self {
-                    canonical.num_template_args()
-                } else {
+                if canonical == *self {
                     None
+                } else {
+                    canonical.num_template_args()
                 }
             })
     }
@@ -961,13 +961,11 @@ impl Cursor {
     ///
     /// Returns None if the cursor does not include a file, otherwise the file's full name
     pub(crate) fn get_included_file_name(&self) -> Option<String> {
-        let file = unsafe { clang_sys::clang_getIncludedFile(self.x) };
+        let file = unsafe { clang_getIncludedFile(self.x) };
         if file.is_null() {
             None
         } else {
-            Some(unsafe {
-                cxstring_into_string(clang_sys::clang_getFileName(file))
-            })
+            Some(unsafe { cxstring_into_string(clang_getFileName(file)) })
         }
     }
 
@@ -1112,10 +1110,8 @@ impl Iterator for ClangTokenIterator<'_> {
 /// (including '_') and does not start with a digit.
 pub(crate) fn is_valid_identifier(name: &str) -> bool {
     let mut chars = name.chars();
-    let first_valid = chars
-        .next()
-        .map(|c| c.is_alphabetic() || c == '_')
-        .unwrap_or(false);
+    let first_valid =
+        chars.next().is_some_and(|c| c.is_alphabetic() || c == '_');
 
     first_valid && chars.all(|c| c.is_alphanumeric() || c == '_')
 }
@@ -1447,10 +1443,10 @@ impl Type {
     /// elements.
     pub(crate) fn num_elements(&self) -> Option<usize> {
         let num_elements_returned = unsafe { clang_getNumElements(self.x) };
-        if num_elements_returned != -1 {
-            Some(num_elements_returned as usize)
-        } else {
+        if num_elements_returned == -1 {
             None
+        } else {
+            Some(num_elements_returned as usize)
         }
     }
 
@@ -1793,7 +1789,7 @@ impl Index {
     pub(crate) fn new(pch: bool, diag: bool) -> Index {
         unsafe {
             Index {
-                x: clang_createIndex(pch as c_int, diag as c_int),
+                x: clang_createIndex(c_int::from(pch), c_int::from(diag)),
             }
         }
     }
@@ -1886,9 +1882,7 @@ impl TranslationUnit {
 
     /// Save a translation unit to the given file.
     pub(crate) fn save(&mut self, file: &str) -> Result<(), CXSaveError> {
-        let file = if let Ok(cstring) = CString::new(file) {
-            cstring
-        } else {
+        let Ok(file) = CString::new(file) else {
             return Err(CXSaveError_Unknown);
         };
         let ret = unsafe {
diff --git a/bindgen/codegen/dyngen.rs b/bindgen/codegen/dyngen.rs
index e75e11a2..6bdea51e 100644
--- a/bindgen/codegen/dyngen.rs
+++ b/bindgen/codegen/dyngen.rs
@@ -14,7 +14,7 @@ pub(crate) struct DynamicItems {
     ///    ...
     /// }
     /// ```
-    struct_members: Vec<proc_macro2::TokenStream>,
+    struct_members: Vec<TokenStream>,
 
     /// Tracks the tokens that will appear inside the library struct's implementation, e.g.:
     ///
@@ -26,7 +26,7 @@ pub(crate) struct DynamicItems {
     ///     }
     /// }
     /// ```
-    struct_implementation: Vec<proc_macro2::TokenStream>,
+    struct_implementation: Vec<TokenStream>,
 
     /// Tracks the initialization of the fields inside the `::new` constructor of the library
     /// struct, e.g.:
@@ -45,7 +45,7 @@ pub(crate) struct DynamicItems {
     ///     ...
     /// }
     /// ```
-    constructor_inits: Vec<proc_macro2::TokenStream>,
+    constructor_inits: Vec<TokenStream>,
 
     /// Tracks the information that is passed to the library struct at the end of the `::new`
     /// constructor, e.g.:
@@ -65,7 +65,7 @@ pub(crate) struct DynamicItems {
     ///     }
     /// }
     /// ```
-    init_fields: Vec<proc_macro2::TokenStream>,
+    init_fields: Vec<TokenStream>,
 }
 
 impl DynamicItems {
@@ -77,7 +77,7 @@ impl DynamicItems {
         &self,
         lib_ident: Ident,
         ctx: &BindgenContext,
-    ) -> proc_macro2::TokenStream {
+    ) -> TokenStream {
         let struct_members = &self.struct_members;
         let constructor_inits = &self.constructor_inits;
         let init_fields = &self.init_fields;
@@ -134,11 +134,11 @@ impl DynamicItems {
         abi: ClangAbi,
         is_variadic: bool,
         is_required: bool,
-        args: Vec<proc_macro2::TokenStream>,
-        args_identifiers: Vec<proc_macro2::TokenStream>,
-        ret: proc_macro2::TokenStream,
-        ret_ty: proc_macro2::TokenStream,
-        attributes: Vec<proc_macro2::TokenStream>,
+        args: Vec<TokenStream>,
+        args_identifiers: Vec<TokenStream>,
+        ret: TokenStream,
+        ret_ty: TokenStream,
+        attributes: Vec<TokenStream>,
         ctx: &BindgenContext,
     ) {
         if !is_variadic {
diff --git a/bindgen/codegen/helpers.rs b/bindgen/codegen/helpers.rs
index abefeba3..aac04a12 100644
--- a/bindgen/codegen/helpers.rs
+++ b/bindgen/codegen/helpers.rs
@@ -84,13 +84,10 @@ pub(crate) fn blob(layout: Layout) -> syn::Type {
     // some things that legitimately are more than 8-byte aligned.
     //
     // Eventually we should be able to `unwrap` here, but...
-    let ty = match opaque.known_rust_type_for_array() {
-        Some(ty) => ty,
-        None => {
-            warn!("Found unknown alignment on code generation!");
-            syn::parse_quote! { u8 }
-        }
-    };
+    let ty = opaque.known_rust_type_for_array().unwrap_or_else(|| {
+        warn!("Found unknown alignment on code generation!");
+        syn::parse_quote! { u8 }
+    });
 
     let data_len = opaque.array_size().unwrap_or(layout.size);
 
@@ -245,24 +242,21 @@ pub(crate) mod ast_ty {
             (FloatKind::Float, false) => raw_type(ctx, "c_float"),
             (FloatKind::Double, false) => raw_type(ctx, "c_double"),
             (FloatKind::LongDouble, _) => {
-                match layout {
-                    Some(layout) => {
-                        match layout.size {
-                            4 => syn::parse_quote! { f32 },
-                            8 => syn::parse_quote! { f64 },
-                            // TODO(emilio): If rust ever gains f128 we should
-                            // use it here and below.
-                            _ => super::integer_type(layout)
-                                .unwrap_or(syn::parse_quote! { f64 }),
-                        }
-                    }
-                    None => {
-                        debug_assert!(
-                            false,
-                            "How didn't we know the layout for a primitive type?"
-                        );
-                        syn::parse_quote! { f64 }
+                if let Some(layout) = layout {
+                    match layout.size {
+                        4 => syn::parse_quote! { f32 },
+                        8 => syn::parse_quote! { f64 },
+                        // TODO(emilio): If rust ever gains f128 we should
+                        // use it here and below.
+                        _ => super::integer_type(layout)
+                            .unwrap_or(syn::parse_quote! { f64 }),
                     }
+                } else {
+                    debug_assert!(
+                        false,
+                        "How didn't we know the layout for a primitive type?"
+                    );
+                    syn::parse_quote! { f64 }
                 }
             }
             (FloatKind::Float128, _) => {
@@ -365,17 +359,14 @@ pub(crate) mod ast_ty {
         signature
             .argument_types()
             .iter()
-            .map(|&(ref name, _ty)| match *name {
-                Some(ref name) => {
-                    let name = ctx.rust_ident(name);
-                    quote! { #name }
-                }
-                None => {
+            .map(|&(ref name, _ty)| {
+                let name = if let Some(ref name) = *name {
+                    ctx.rust_ident(name)
+                } else {
                     unnamed_arguments += 1;
-                    let name =
-                        ctx.rust_ident(format!("arg{unnamed_arguments}"));
-                    quote! { #name }
-                }
+                    ctx.rust_ident(format!("arg{unnamed_arguments}"))
+                };
+                quote! { #name }
             })
             .collect()
     }
diff --git a/bindgen/codegen/impl_debug.rs b/bindgen/codegen/impl_debug.rs
index b0e73b61..319c89b5 100644
--- a/bindgen/codegen/impl_debug.rs
+++ b/bindgen/codegen/impl_debug.rs
@@ -126,12 +126,7 @@ impl<'a> ImplDebug<'a> for Item {
             return None;
         }
 
-        let ty = match self.as_type() {
-            Some(ty) => ty,
-            None => {
-                return None;
-            }
-        };
+        let ty = self.as_type()?;
 
         fn debug_print(
             name: &str,
@@ -191,13 +186,18 @@ impl<'a> ImplDebug<'a> for Item {
                     // Let's implement our own print function
                     Some((
                         format!("{name}: [{{}}]"),
-                        vec![quote! {
-                            self.#name_ident
-                                .iter()
-                                .enumerate()
-                                .map(|(i, v)| format!("{}{:?}", if i > 0 { ", " } else { "" }, v))
-                                .collect::<String>()
-                        }],
+                        vec![quote! {{
+                            use std::fmt::Write as _;
+                            let mut output = String::new();
+                            let mut iter = self.#name_ident.iter();
+                            if let Some(value) = iter.next() {
+                                let _ = write!(output, "{value:?}");
+                                for value in iter {
+                                    let _ = write!(output, ", {value:?}");
+                                }
+                            }
+                            output
+                        }}],
                     ))
                 }
             }
diff --git a/bindgen/codegen/impl_partialeq.rs b/bindgen/codegen/impl_partialeq.rs
index 42fabf6a..6c7b4395 100644
--- a/bindgen/codegen/impl_partialeq.rs
+++ b/bindgen/codegen/impl_partialeq.rs
@@ -23,7 +23,7 @@ pub(crate) fn gen_partialeq_impl(
             &self.bindgen_union_field[..] == &other.bindgen_union_field[..]
         });
     } else {
-        for base in comp_info.base_members().iter() {
+        for base in comp_info.base_members() {
             if !base.requires_storage(ctx) {
                 continue;
             }
diff --git a/bindgen/codegen/mod.rs b/bindgen/codegen/mod.rs
index c58237c1..82dd8b71 100644
--- a/bindgen/codegen/mod.rs
+++ b/bindgen/codegen/mod.rs
@@ -1198,10 +1198,7 @@ impl CodeGenerator for Vtable<'_> {
                     let function_item = ctx.resolve_item(m.signature());
                     let function = function_item.expect_function();
                     let signature_item = ctx.resolve_item(function.signature());
-                    let signature = match signature_item.expect_type().kind() {
-                        TypeKind::Function(ref sig) => sig,
-                        _ => panic!("Function signature type mismatch"),
-                    };
+                    let TypeKind::Function(ref signature) = signature_item.expect_type().kind() else { panic!("Function signature type mismatch") };
 
                     // FIXME: Is there a canonical name without the class prepended?
                     let function_name = function_item.canonical_name(ctx);
@@ -1943,16 +1940,14 @@ impl<'a> FieldCodegen<'a> for Bitfield {
         let bitfield_ty_layout = bitfield_ty
             .layout(ctx)
             .expect("Bitfield without layout? Gah!");
-        let bitfield_int_ty = match helpers::integer_type(bitfield_ty_layout) {
-            Some(int_ty) => {
+        let bitfield_int_ty =
+            if let Some(int_ty) = helpers::integer_type(bitfield_ty_layout) {
                 *bitfield_representable_as_int = true;
                 int_ty
-            }
-            None => {
+            } else {
                 *bitfield_representable_as_int = false;
                 return;
-            }
-        };
+            };
 
         let bitfield_ty =
             bitfield_ty.to_rust_ty_or_opaque(ctx, bitfield_ty_item);
@@ -2777,13 +2772,13 @@ impl CodeGenerator for CompInfo {
                 item,
                 &ty_for_impl,
             ) {
-                let partialeq_bounds = if !generic_param_names.is_empty() {
+                let partialeq_bounds = if generic_param_names.is_empty() {
+                    quote! {}
+                } else {
                     let bounds = generic_param_names.iter().map(|t| {
                         quote! { #t: PartialEq }
                     });
                     quote! { where #( #bounds ),* }
-                } else {
-                    quote! {}
                 };
 
                 let prefix = ctx.trait_prefix();
@@ -2974,10 +2969,7 @@ impl Method {
         }
         let function = function_item.expect_function();
         let times_seen = function.codegen(ctx, result, function_item);
-        let times_seen = match times_seen {
-            Some(seen) => seen,
-            None => return,
-        };
+        let Some(times_seen) = times_seen else { return };
         let signature_item = ctx.resolve_item(function.signature());
         let mut name = match self.kind() {
             MethodKind::Constructor => "new".into(),
@@ -2985,9 +2977,10 @@ impl Method {
             _ => function.name().to_owned(),
         };
 
-        let signature = match *signature_item.expect_type().kind() {
-            TypeKind::Function(ref sig) => sig,
-            _ => panic!("How in the world?"),
+        let TypeKind::Function(ref signature) =
+            *signature_item.expect_type().kind()
+        else {
+            panic!("How in the world?")
         };
 
         let supported_abi = signature.abi(ctx, Some(&*name)).is_ok();
@@ -3180,7 +3173,7 @@ impl fmt::Display for EnumVariation {
     }
 }
 
-impl std::str::FromStr for EnumVariation {
+impl FromStr for EnumVariation {
     type Err = std::io::Error;
 
     /// Create a `EnumVariation` from a string.
@@ -3329,7 +3322,7 @@ impl<'a> EnumBuilder<'a> {
         let is_rust_enum = self.is_rust_enum();
         let expr = match variant.val() {
             EnumVariantValue::Boolean(v) if is_rust_enum => {
-                helpers::ast_ty::uint_expr(v as u64)
+                helpers::ast_ty::uint_expr(u64::from(v))
             }
             EnumVariantValue::Boolean(v) => quote!(#v),
             EnumVariantValue::Signed(v) => helpers::ast_ty::int_expr(v),
@@ -3444,10 +3437,10 @@ impl<'a> EnumBuilder<'a> {
                 emitted_any_variants,
                 ..
             } => {
-                let variants = if !emitted_any_variants {
-                    quote!(__bindgen_cannot_repr_c_on_empty_enum = 0)
-                } else {
+                let variants = if emitted_any_variants {
                     tokens
+                } else {
+                    quote!(__bindgen_cannot_repr_c_on_empty_enum = 0)
                 };
 
                 quote! {
@@ -3564,18 +3557,17 @@ impl CodeGenerator for Enum {
                 // * the representation couldn't be determined from the C source
                 // * it was explicitly requested as a bindgen option
 
-                let kind = match repr {
-                    Some(repr) => match *repr.canonical_type(ctx).kind() {
+                let kind = if let Some(repr) = repr {
+                    match *repr.canonical_type(ctx).kind() {
                         TypeKind::Int(int_kind) => int_kind,
                         _ => panic!("Unexpected type as enum repr"),
-                    },
-                    None => {
-                        warn!(
-                            "Guessing type of enum! Forward declarations of enums \
-                             shouldn't be legal!"
-                        );
-                        IntKind::Int
                     }
+                } else {
+                    warn!(
+                        "Guessing type of enum! Forward declarations of enums \
+                         shouldn't be legal!"
+                    );
+                    IntKind::Int
                 };
 
                 let signed = kind.is_signed();
@@ -3653,7 +3645,7 @@ impl CodeGenerator for Enum {
                     DerivableTraits::EQ,
             );
             let mut derives: Vec<_> = derives.into();
-            for derive in item.annotations().derives().iter() {
+            for derive in item.annotations().derives() {
                 if !derives.contains(&derive.as_str()) {
                     derives.push(derive);
                 }
@@ -3886,7 +3878,7 @@ impl fmt::Display for MacroTypeVariation {
     }
 }
 
-impl std::str::FromStr for MacroTypeVariation {
+impl FromStr for MacroTypeVariation {
     type Err = std::io::Error;
 
     /// Create a `MacroTypeVariation` from a string.
@@ -3929,7 +3921,7 @@ impl fmt::Display for AliasVariation {
     }
 }
 
-impl std::str::FromStr for AliasVariation {
+impl FromStr for AliasVariation {
     type Err = std::io::Error;
 
     /// Create an `AliasVariation` from a string.
@@ -3978,7 +3970,7 @@ impl Default for NonCopyUnionStyle {
     }
 }
 
-impl std::str::FromStr for NonCopyUnionStyle {
+impl FromStr for NonCopyUnionStyle {
     type Err = std::io::Error;
 
     fn from_str(s: &str) -> Result<Self, Self::Err> {
@@ -4096,7 +4088,7 @@ where
             if let Ok(layout) = self.try_get_layout(ctx, extra) {
                 Ok(helpers::blob(layout))
             } else {
-                Err(error::Error::NoLayoutForOpaqueBlob)
+                Err(Error::NoLayoutForOpaqueBlob)
             }
         })
     }
@@ -4207,7 +4199,7 @@ impl TryToOpaque for Type {
         ctx: &BindgenContext,
         _: &Item,
     ) -> error::Result<Layout> {
-        self.layout(ctx).ok_or(error::Error::NoLayoutForOpaqueBlob)
+        self.layout(ctx).ok_or(Error::NoLayoutForOpaqueBlob)
     }
 }
 
@@ -4365,7 +4357,7 @@ impl TryToOpaque for TemplateInstantiation {
     ) -> error::Result<Layout> {
         item.expect_type()
             .layout(ctx)
-            .ok_or(error::Error::NoLayoutForOpaqueBlob)
+            .ok_or(Error::NoLayoutForOpaqueBlob)
     }
 }
 
@@ -4378,7 +4370,7 @@ impl TryToRustTy for TemplateInstantiation {
         item: &Item,
     ) -> error::Result<syn::Type> {
         if self.is_opaque(ctx, item) {
-            return Err(error::Error::InstantiationOfOpaqueType);
+            return Err(Error::InstantiationOfOpaqueType);
         }
 
         let def = self
@@ -4400,7 +4392,7 @@ impl TryToRustTy for TemplateInstantiation {
             // template specialization, and we've hit an instantiation of
             // that partial specialization.
             extra_assert!(def.is_opaque(ctx, &()));
-            return Err(error::Error::InstantiationOfOpaqueType);
+            return Err(Error::InstantiationOfOpaqueType);
         }
 
         // TODO: If the definition type is a template class/struct
@@ -4452,7 +4444,7 @@ impl TryToRustTy for FunctionSig {
                 syn::parse_quote! { unsafe extern #abi fn ( #( #arguments ),* ) #ret },
             ),
             Err(err) => {
-                if matches!(err, error::Error::UnsupportedAbi(_)) {
+                if matches!(err, Error::UnsupportedAbi(_)) {
                     unsupported_abi_diagnostic(
                         self.name(),
                         self.is_variadic(),
@@ -4488,9 +4480,8 @@ impl CodeGenerator for Function {
 
         let signature_item = ctx.resolve_item(self.signature());
         let signature = signature_item.kind().expect_type().canonical_type(ctx);
-        let signature = match *signature.kind() {
-            TypeKind::Function(ref sig) => sig,
-            _ => panic!("Signature kind is not a Function: {signature:?}"),
+        let TypeKind::Function(ref signature) = *signature.kind() else {
+            panic!("Signature kind is not a Function: {signature:?}")
         };
 
         if is_internal {
@@ -4568,7 +4559,7 @@ impl CodeGenerator for Function {
 
         let abi = match signature.abi(ctx, Some(name)) {
             Err(err) => {
-                if matches!(err, error::Error::UnsupportedAbi(_)) {
+                if matches!(err, Error::UnsupportedAbi(_)) {
                     unsupported_abi_diagnostic(
                         name,
                         signature.is_variadic(),
@@ -4709,7 +4700,7 @@ fn unsupported_abi_diagnostic(
     variadic: bool,
     location: Option<&crate::clang::SourceLocation>,
     ctx: &BindgenContext,
-    error: &error::Error,
+    error: &Error,
 ) {
     warn!(
         "Skipping {}function `{fn_name}` because the {error}",
@@ -4944,7 +4935,7 @@ impl CodeGenerator for ObjCInterface {
             };
             result.push(struct_block);
             let mut protocol_set: HashSet<ItemId> = Default::default();
-            for protocol_id in self.conforms_to.iter() {
+            for protocol_id in &self.conforms_to {
                 protocol_set.insert(*protocol_id);
                 let protocol_name = ctx.rust_ident(
                     ctx.resolve_type(protocol_id.expect_type_id(ctx))
@@ -4966,9 +4957,8 @@ impl CodeGenerator for ObjCInterface {
                     .expect_type()
                     .kind();
 
-                let parent = match parent {
-                    TypeKind::ObjCInterface(ref parent) => parent,
-                    _ => break,
+                let TypeKind::ObjCInterface(parent) = parent else {
+                    break;
                 };
                 parent_class = parent.parent_class;
 
@@ -4989,7 +4979,7 @@ impl CodeGenerator for ObjCInterface {
                     }
                 };
                 result.push(impl_trait);
-                for protocol_id in parent.conforms_to.iter() {
+                for protocol_id in &parent.conforms_to {
                     if protocol_set.insert(*protocol_id) {
                         let protocol_name = ctx.rust_ident(
                             ctx.resolve_type(protocol_id.expect_type_id(ctx))
@@ -5145,14 +5135,10 @@ pub(crate) mod utils {
             return Ok(());
         }
 
-        let path = context
-            .options()
-            .wrap_static_fns_path
-            .as_ref()
-            .map(PathBuf::from)
-            .unwrap_or_else(|| {
-                std::env::temp_dir().join("bindgen").join("extern")
-            });
+        let path = context.options().wrap_static_fns_path.as_ref().map_or_else(
+            || std::env::temp_dir().join("bindgen").join("extern"),
+            PathBuf::from,
+        );
 
         let dir = path.parent().unwrap();
 
@@ -5676,7 +5662,7 @@ pub(crate) mod utils {
 
     pub(crate) fn fnsig_arguments_iter<
         'a,
-        I: Iterator<Item = &'a (Option<String>, crate::ir::context::TypeId)>,
+        I: Iterator<Item = &'a (Option<String>, TypeId)>,
     >(
         ctx: &BindgenContext,
         args_iter: I,
@@ -5687,12 +5673,11 @@ pub(crate) mod utils {
             .map(|(name, ty)| {
                 let arg_ty = fnsig_argument_type(ctx, ty);
 
-                let arg_name = match *name {
-                    Some(ref name) => ctx.rust_mangle(name).into_owned(),
-                    None => {
-                        unnamed_arguments += 1;
-                        format!("arg{unnamed_arguments}")
-                    }
+                let arg_name = if let Some(ref name) = *name {
+                    ctx.rust_mangle(name).into_owned()
+                } else {
+                    unnamed_arguments += 1;
+                    format!("arg{unnamed_arguments}")
                 };
 
                 assert!(!arg_name.is_empty());
@@ -5731,12 +5716,11 @@ pub(crate) mod utils {
             .argument_types()
             .iter()
             .map(|&(ref name, _ty)| {
-                let arg_name = match *name {
-                    Some(ref name) => ctx.rust_mangle(name).into_owned(),
-                    None => {
-                        unnamed_arguments += 1;
-                        format!("arg{unnamed_arguments}")
-                    }
+                let arg_name = if let Some(ref name) = *name {
+                    ctx.rust_mangle(name).into_owned()
+                } else {
+                    unnamed_arguments += 1;
+                    format!("arg{unnamed_arguments}")
                 };
 
                 assert!(!arg_name.is_empty());
diff --git a/bindgen/codegen/serialize.rs b/bindgen/codegen/serialize.rs
index 864d86b4..c7bb6cec 100644
--- a/bindgen/codegen/serialize.rs
+++ b/bindgen/codegen/serialize.rs
@@ -14,8 +14,7 @@ use super::{CodegenError, WrapAsVariadic};
 
 fn get_loc(item: &Item) -> String {
     item.location()
-        .map(|x| x.to_string())
-        .unwrap_or_else(|| "unknown".to_owned())
+        .map_or_else(|| "unknown".to_owned(), |x| x.to_string())
 }
 
 pub(super) trait CSerialize<'a> {
@@ -72,9 +71,10 @@ impl<'a> CSerialize<'a> for Function {
             });
         }
 
-        let signature = match ctx.resolve_type(self.signature()).kind() {
-            TypeKind::Function(signature) => signature,
-            _ => unreachable!(),
+        let TypeKind::Function(signature) =
+            ctx.resolve_type(self.signature()).kind()
+        else {
+            unreachable!()
         };
 
         assert!(!signature.is_variadic());
diff --git a/bindgen/codegen/struct_layout.rs b/bindgen/codegen/struct_layout.rs
index 40edefd5..0645d8a8 100644
--- a/bindgen/codegen/struct_layout.rs
+++ b/bindgen/codegen/struct_layout.rs
@@ -421,9 +421,8 @@ impl<'a> StructLayoutTracker<'a> {
             return false;
         }
 
-        let layout = match self.latest_field_layout {
-            Some(l) => l,
-            None => return false,
+        let Some(layout) = self.latest_field_layout else {
+            return false;
         };
 
         // If it was, we may or may not need to align, depending on what the
diff --git a/bindgen/features.rs b/bindgen/features.rs
index af36ffca..c278d10f 100644
--- a/bindgen/features.rs
+++ b/bindgen/features.rs
@@ -368,22 +368,21 @@ impl FromStr for RustTarget {
             ));
         }
 
-        let (minor, patch) = match tail.split_once('.') {
-            Some((minor_str, patch_str)) => {
-                let Ok(minor) = minor_str.parse::<u64>() else {
-                    return Err(invalid_input(input, "the minor version number must be an unsigned 64-bit integer"));
-                };
-                let Ok(patch) = patch_str.parse::<u64>() else {
-                    return Err(invalid_input(input, "the patch version number must be an unsigned 64-bit integer"));
-                };
-                (minor, patch)
-            }
-            None => {
-                let Ok(minor) = tail.parse::<u64>() else {
-                    return Err(invalid_input(input, "the minor version number must be an unsigned 64-bit integer"));
-                };
-                (minor, 0)
-            }
+        let (minor, patch) = if let Some((minor_str, patch_str)) =
+            tail.split_once('.')
+        {
+            let Ok(minor) = minor_str.parse::<u64>() else {
+                return Err(invalid_input(input, "the minor version number must be an unsigned 64-bit integer"));
+            };
+            let Ok(patch) = patch_str.parse::<u64>() else {
+                return Err(invalid_input(input, "the patch version number must be an unsigned 64-bit integer"));
+            };
+            (minor, patch)
+        } else {
+            let Ok(minor) = tail.parse::<u64>() else {
+                return Err(invalid_input(input, "the minor version number must be an unsigned 64-bit integer"));
+            };
+            (minor, 0)
         };
 
         Self::stable(minor, patch).map_err(|err| invalid_input(input, err))
diff --git a/bindgen/ir/analysis/derive.rs b/bindgen/ir/analysis/derive.rs
index ef063e18..1643a914 100644
--- a/bindgen/ir/analysis/derive.rs
+++ b/bindgen/ir/analysis/derive.rs
@@ -540,31 +540,25 @@ impl DeriveTrait {
     }
 
     fn can_derive_vector(&self) -> CanDerive {
-        match self {
-            DeriveTrait::PartialEqOrPartialOrd => {
-                // FIXME: vectors always can derive PartialEq, but they should
-                // not derive PartialOrd:
-                // https://github.com/rust-lang-nursery/packed_simd/issues/48
-                trace!("    vectors cannot derive PartialOrd");
-                CanDerive::No
-            }
-            _ => {
-                trace!("    vector can derive {self}");
-                CanDerive::Yes
-            }
+        if *self == DeriveTrait::PartialEqOrPartialOrd {
+            // FIXME: vectors always can derive PartialEq, but they should
+            // not derive PartialOrd:
+            // https://github.com/rust-lang-nursery/packed_simd/issues/48
+            trace!("    vectors cannot derive PartialOrd");
+            CanDerive::No
+        } else {
+            trace!("    vector can derive {self}");
+            CanDerive::Yes
         }
     }
 
     fn can_derive_pointer(&self) -> CanDerive {
-        match self {
-            DeriveTrait::Default => {
-                trace!("    pointer cannot derive Default");
-                CanDerive::No
-            }
-            _ => {
-                trace!("    pointer can derive {self}");
-                CanDerive::Yes
-            }
+        if *self == DeriveTrait::Default {
+            trace!("    pointer cannot derive Default");
+            CanDerive::No
+        } else {
+            trace!("    pointer can derive {self}");
+            CanDerive::Yes
         }
     }
 
@@ -722,6 +716,6 @@ pub(crate) fn as_cannot_derive_set(
 ) -> HashSet<ItemId> {
     can_derive
         .into_iter()
-        .filter_map(|(k, v)| if v != CanDerive::Yes { Some(k) } else { None })
+        .filter_map(|(k, v)| if v == CanDerive::Yes { None } else { Some(k) })
         .collect()
 }
diff --git a/bindgen/ir/analysis/has_float.rs b/bindgen/ir/analysis/has_float.rs
index 630458e5..da4b4133 100644
--- a/bindgen/ir/analysis/has_float.rs
+++ b/bindgen/ir/analysis/has_float.rs
@@ -105,12 +105,9 @@ impl<'ctx> MonotoneFramework for HasFloat<'ctx> {
         }
 
         let item = self.ctx.resolve_item(id);
-        let ty = match item.as_type() {
-            Some(ty) => ty,
-            None => {
-                trace!("    not a type; ignoring");
-                return ConstrainResult::Same;
-            }
+        let Some(ty) = item.as_type() else {
+            trace!("    not a type; ignoring");
+            return ConstrainResult::Same;
         };
 
         match *ty.kind() {
diff --git a/bindgen/ir/analysis/has_type_param_in_array.rs b/bindgen/ir/analysis/has_type_param_in_array.rs
index 61a8d631..466ccb2a 100644
--- a/bindgen/ir/analysis/has_type_param_in_array.rs
+++ b/bindgen/ir/analysis/has_type_param_in_array.rs
@@ -108,12 +108,9 @@ impl<'ctx> MonotoneFramework for HasTypeParameterInArray<'ctx> {
         }
 
         let item = self.ctx.resolve_item(id);
-        let ty = match item.as_type() {
-            Some(ty) => ty,
-            None => {
-                trace!("    not a type; ignoring");
-                return ConstrainResult::Same;
-            }
+        let Some(ty) = item.as_type() else {
+            trace!("    not a type; ignoring");
+            return ConstrainResult::Same;
         };
 
         match *ty.kind() {
@@ -142,17 +139,14 @@ impl<'ctx> MonotoneFramework for HasTypeParameterInArray<'ctx> {
             TypeKind::Array(t, _) => {
                 let inner_ty =
                     self.ctx.resolve_type(t).canonical_type(self.ctx);
-                match *inner_ty.kind() {
-                    TypeKind::TypeParam => {
-                        trace!("    Array with Named type has type parameter");
-                        self.insert(id)
-                    }
-                    _ => {
-                        trace!(
-                            "    Array without Named type does have type parameter"
-                        );
-                        ConstrainResult::Same
-                    }
+                if let TypeKind::TypeParam = *inner_ty.kind() {
+                    trace!("    Array with Named type has type parameter");
+                    self.insert(id)
+                } else {
+                    trace!(
+                        "    Array without Named type does have type parameter"
+                    );
+                    ConstrainResult::Same
                 }
             }
 
diff --git a/bindgen/ir/analysis/mod.rs b/bindgen/ir/analysis/mod.rs
index 731080cb..74a305ed 100644
--- a/bindgen/ir/analysis/mod.rs
+++ b/bindgen/ir/analysis/mod.rs
@@ -280,9 +280,9 @@ mod tests {
 
         fn reverse(&self) -> Graph {
             let mut reversed = Graph::default();
-            for (node, edges) in self.0.iter() {
+            for (node, edges) in &self.0 {
                 reversed.0.entry(*node).or_insert_with(Vec::new);
-                for referent in edges.iter() {
+                for referent in edges {
                     reversed
                         .0
                         .entry(*referent)
@@ -331,7 +331,7 @@ mod tests {
 
             let original_size = self.reachable.entry(node).or_default().len();
 
-            for sub_node in self.graph.0[&node].iter() {
+            for sub_node in &self.graph.0[&node] {
                 self.reachable.get_mut(&node).unwrap().insert(*sub_node);
 
                 let sub_reachable =
@@ -343,10 +343,10 @@ mod tests {
             }
 
             let new_size = self.reachable[&node].len();
-            if original_size != new_size {
-                ConstrainResult::Changed
-            } else {
+            if original_size == new_size {
                 ConstrainResult::Same
+            } else {
+                ConstrainResult::Changed
             }
         }
 
@@ -354,7 +354,7 @@ mod tests {
         where
             F: FnMut(Node),
         {
-            for dep in self.reversed.0[&node].iter() {
+            for dep in &self.reversed.0[&node] {
                 f(*dep);
             }
         }
diff --git a/bindgen/ir/analysis/template_params.rs b/bindgen/ir/analysis/template_params.rs
index 778a515d..df8f861c 100644
--- a/bindgen/ir/analysis/template_params.rs
+++ b/bindgen/ir/analysis/template_params.rs
@@ -464,7 +464,7 @@ impl<'ctx> MonotoneFramework for UsedTemplateParameters<'ctx> {
             // (This is so that every item we call `constrain` on is guaranteed
             // to have a set of template parameters, and we can allow
             // blocklisted templates to use all of their parameters).
-            for item in allowlisted_items.iter() {
+            for item in &allowlisted_items {
                 extra_assert!(used.contains_key(item));
                 extra_assert!(dependencies.contains_key(item));
                 item.trace(
@@ -570,10 +570,10 @@ impl<'ctx> MonotoneFramework for UsedTemplateParameters<'ctx> {
         self.used.insert(id, Some(used_by_this_id));
         extra_assert!(self.used.values().all(|v| v.is_some()));
 
-        if new_len != original_len {
-            ConstrainResult::Changed
-        } else {
+        if new_len == original_len {
             ConstrainResult::Same
+        } else {
+            ConstrainResult::Changed
         }
     }
 
diff --git a/bindgen/ir/annotations.rs b/bindgen/ir/annotations.rs
index 600bfa8b..7f5d74b3 100644
--- a/bindgen/ir/annotations.rs
+++ b/bindgen/ir/annotations.rs
@@ -232,10 +232,10 @@ impl Annotations {
                     "derive" => self.derives.push(attr.value),
                     "attribute" => self.attributes.push(attr.value),
                     "private" => {
-                        self.visibility_kind = if attr.value != "false" {
-                            Some(FieldVisibilityKind::Private)
-                        } else {
+                        self.visibility_kind = if attr.value == "false" {
                             Some(FieldVisibilityKind::Public)
+                        } else {
+                            Some(FieldVisibilityKind::Private)
                         };
                     }
                     "accessor" => {
diff --git a/bindgen/ir/comment.rs b/bindgen/ir/comment.rs
index 03fc76ff..a4ba3201 100644
--- a/bindgen/ir/comment.rs
+++ b/bindgen/ir/comment.rs
@@ -13,7 +13,7 @@ enum Kind {
 
 /// Preprocesses a C/C++ comment so that it is a valid Rust comment.
 pub(crate) fn preprocess(comment: &str) -> String {
-    match self::kind(comment) {
+    match kind(comment) {
         Some(Kind::SingleLines) => preprocess_single_lines(comment),
         Some(Kind::MultiLine) => preprocess_multi_line(comment),
         None => comment.to_owned(),
diff --git a/bindgen/ir/comp.rs b/bindgen/ir/comp.rs
index 68884bd2..a978af58 100644
--- a/bindgen/ir/comp.rs
+++ b/bindgen/ir/comp.rs
@@ -1162,14 +1162,14 @@ impl CompInfo {
         match self.fields {
             CompFields::Error => {}
             CompFields::After { ref fields, .. } => {
-                for field in fields.iter() {
+                for field in fields {
                     if let Some(layout) = field.layout(ctx) {
                         callback(layout);
                     }
                 }
             }
             CompFields::Before(ref raw_fields) => {
-                for field in raw_fields.iter() {
+                for field in raw_fields {
                     let field_ty = ctx.resolve_type(field.0.ty);
                     if let Some(layout) = field_ty.layout(ctx) {
                         callback(layout);
@@ -1473,8 +1473,7 @@ impl CompInfo {
                         ty: type_id,
                         kind,
                         field_name,
-                        is_pub: cur.access_specifier() ==
-                            clang_sys::CX_CXXPublic,
+                        is_pub: cur.access_specifier() == CX_CXXPublic,
                     });
                 }
                 CXCursor_Constructor | CXCursor_Destructor |
@@ -1673,7 +1672,7 @@ impl CompInfo {
     pub(crate) fn already_packed(&self, ctx: &BindgenContext) -> Option<bool> {
         let mut total_size: usize = 0;
 
-        for field in self.fields().iter() {
+        for field in self.fields() {
             let layout = field.layout(ctx)?;
 
             if layout.align != 0 && total_size % layout.align != 0 {
diff --git a/bindgen/ir/context.rs b/bindgen/ir/context.rs
index d8bcaba1..df7db899 100644
--- a/bindgen/ir/context.rs
+++ b/bindgen/ir/context.rs
@@ -319,7 +319,7 @@ pub(crate) struct BindgenContext {
 
     /// Maps from a cursor to the item ID of the named template type parameter
     /// for that cursor.
-    type_params: HashMap<clang::Cursor, TypeId>,
+    type_params: HashMap<Cursor, TypeId>,
 
     /// A cursor to module map. Similar reason than above.
     modules: HashMap<Cursor, ModuleId>,
@@ -336,7 +336,7 @@ pub(crate) struct BindgenContext {
     /// This is used to handle the cases where the semantic and the lexical
     /// parents of the cursor differ, like when a nested class is defined
     /// outside of the parent class.
-    semantic_parents: HashMap<clang::Cursor, ItemId>,
+    semantic_parents: HashMap<Cursor, ItemId>,
 
     /// A stack with the current type declarations and types we're parsing. This
     /// is needed to avoid infinite recursion when parsing a type like:
@@ -810,11 +810,7 @@ If you encounter an error missing from this list, please file an issue or a PR!"
     }
 
     /// Add a new named template type parameter to this context's item set.
-    pub(crate) fn add_type_param(
-        &mut self,
-        item: Item,
-        definition: clang::Cursor,
-    ) {
+    pub(crate) fn add_type_param(&mut self, item: Item, definition: Cursor) {
         debug!("BindgenContext::add_type_param: item = {item:?}; definition = {definition:?}");
 
         assert!(
@@ -846,10 +842,7 @@ If you encounter an error missing from this list, please file an issue or a PR!"
 
     /// Get the named type defined at the given cursor location, if we've
     /// already added one.
-    pub(crate) fn get_type_param(
-        &self,
-        definition: &clang::Cursor,
-    ) -> Option<TypeId> {
+    pub(crate) fn get_type_param(&self, definition: &Cursor) -> Option<TypeId> {
         assert_eq!(
             definition.kind(),
             clang_sys::CXCursor_TemplateTypeParameter
@@ -923,17 +916,14 @@ If you encounter an error missing from this list, please file an issue or a PR!"
     /// Gather all the unresolved type references.
     fn collect_typerefs(
         &mut self,
-    ) -> Vec<(ItemId, clang::Type, clang::Cursor, Option<ItemId>)> {
+    ) -> Vec<(ItemId, clang::Type, Cursor, Option<ItemId>)> {
         debug_assert!(!self.collected_typerefs);
         self.collected_typerefs = true;
         let mut typerefs = vec![];
 
         for (id, item) in self.items() {
             let kind = item.kind();
-            let ty = match kind.as_type() {
-                Some(ty) => ty,
-                None => continue,
-            };
+            let Some(ty) = kind.as_type() else { continue };
 
             if let TypeKind::UnresolvedTypeRef(ref ty, loc, parent_id) =
                 *ty.kind()
@@ -1070,9 +1060,8 @@ If you encounter an error missing from this list, please file an issue or a PR!"
 
             // Calls to `canonical_name` are expensive, so eagerly filter out
             // items that cannot be replaced.
-            let ty = match item.kind().as_type() {
-                Some(ty) => ty,
-                None => continue,
+            let Some(ty) = item.kind().as_type() else {
+                continue;
             };
 
             match *ty.kind() {
@@ -1517,7 +1506,7 @@ If you encounter an error missing from this list, please file an issue or a PR!"
     /// not sure it's worth it.
     pub(crate) fn add_semantic_parent(
         &mut self,
-        definition: clang::Cursor,
+        definition: Cursor,
         parent_id: ItemId,
     ) {
         self.semantic_parents.insert(definition, parent_id);
@@ -1526,7 +1515,7 @@ If you encounter an error missing from this list, please file an issue or a PR!"
     /// Returns a known semantic parent for a given definition.
     pub(crate) fn known_semantic_parent(
         &self,
-        definition: clang::Cursor,
+        definition: Cursor,
     ) -> Option<ItemId> {
         self.semantic_parents.get(&definition).copied()
     }
@@ -1631,7 +1620,7 @@ If you encounter an error missing from this list, please file an issue or a PR!"
         with_id: ItemId,
         template: TypeId,
         ty: &clang::Type,
-        location: clang::Cursor,
+        location: Cursor,
     ) -> Option<TypeId> {
         let num_expected_args =
             self.resolve_type(template).num_self_template_params(self);
@@ -1856,7 +1845,7 @@ If you encounter an error missing from this list, please file an issue or a PR!"
         with_id: ItemId,
         parent_id: Option<ItemId>,
         ty: &clang::Type,
-        location: Option<clang::Cursor>,
+        location: Option<Cursor>,
     ) -> Option<TypeId> {
         use clang_sys::{CXCursor_TypeAliasTemplateDecl, CXCursor_TypeRef};
         debug!("builtin_or_resolved_ty: {ty:?}, {location:?}, {with_id:?}, {parent_id:?}");
@@ -2062,7 +2051,7 @@ If you encounter an error missing from this list, please file an issue or a PR!"
             let mut header_names_to_compile = Vec::new();
             let mut header_paths = Vec::new();
             let mut header_contents = String::new();
-            for input_header in self.options.input_headers.iter() {
+            for input_header in &self.options.input_headers {
                 let path = Path::new(input_header.as_ref());
                 if let Some(header_path) = path.parent() {
                     if header_path == Path::new("") {
@@ -2227,7 +2216,7 @@ If you encounter an error missing from this list, please file an issue or a PR!"
     /// namespace.
     fn tokenize_namespace(
         &self,
-        cursor: &clang::Cursor,
+        cursor: &Cursor,
     ) -> (Option<String>, ModuleKind) {
         assert_eq!(
             cursor.kind(),
@@ -2306,7 +2295,7 @@ If you encounter an error missing from this list, please file an issue or a PR!"
 
     /// Given a CXCursor_Namespace cursor, return the item ID of the
     /// corresponding module, or create one on the fly.
-    pub(crate) fn module(&mut self, cursor: clang::Cursor) -> ModuleId {
+    pub(crate) fn module(&mut self, cursor: Cursor) -> ModuleId {
         use clang_sys::*;
         assert_eq!(cursor.kind(), CXCursor_Namespace, "Be a nice person");
         let cursor = cursor.canonical();
@@ -2524,9 +2513,8 @@ If you encounter an error missing from this list, please file an issue or a PR!"
                                 return false;
                             }
 
-                            let enum_ = match *ty.kind() {
-                                TypeKind::Enum(ref e) => e,
-                                _ => return false,
+                            let TypeKind::Enum(ref enum_) = *ty.kind() else {
+                                return false;
                             };
 
                             if ty.name().is_some() {
diff --git a/bindgen/ir/dot.rs b/bindgen/ir/dot.rs
index 9b81b874..0ccee42c 100644
--- a/bindgen/ir/dot.rs
+++ b/bindgen/ir/dot.rs
@@ -17,7 +17,7 @@ pub(crate) trait DotAttributes {
         out: &mut W,
     ) -> io::Result<()>
     where
-        W: io::Write;
+        W: Write;
 }
 
 /// Write a graphviz dot file containing our IR.
diff --git a/bindgen/ir/item.rs b/bindgen/ir/item.rs
index ee0fdc52..01029761 100644
--- a/bindgen/ir/item.rs
+++ b/bindgen/ir/item.rs
@@ -582,9 +582,8 @@ impl Item {
 
         let mut parent = self.parent_id;
         loop {
-            let parent_item = match ctx.resolve_item_fallible(parent) {
-                Some(item) => item,
-                None => return false,
+            let Some(parent_item) = ctx.resolve_item_fallible(parent) else {
+                return false;
             };
 
             if parent_item.id() == ctx.root_module() {
@@ -786,16 +785,14 @@ impl Item {
 
         match *self.kind() {
             ItemKind::Var(ref var) => var.name().to_owned(),
-            ItemKind::Module(ref module) => {
-                module.name().map(ToOwned::to_owned).unwrap_or_else(|| {
-                    format!("_bindgen_mod_{}", self.exposed_id(ctx))
-                })
-            }
-            ItemKind::Type(ref ty) => {
-                ty.sanitized_name(ctx).map(Into::into).unwrap_or_else(|| {
-                    format!("_bindgen_ty_{}", self.exposed_id(ctx))
-                })
-            }
+            ItemKind::Module(ref module) => module.name().map_or_else(
+                || format!("_bindgen_mod_{}", self.exposed_id(ctx)),
+                ToOwned::to_owned,
+            ),
+            ItemKind::Type(ref ty) => ty.sanitized_name(ctx).map_or_else(
+                || format!("_bindgen_ty_{}", self.exposed_id(ctx)),
+                Into::into,
+            ),
             ItemKind::Function(ref fun) => {
                 let mut name = fun.name().to_owned();
 
@@ -978,9 +975,8 @@ impl Item {
         // Do not jump through aliases, except for aliases that point to a type
         // with the same name, since we dont generate coe for them.
         let item = self.id.into_resolver().through_type_refs().resolve(ctx);
-        let type_ = match *item.kind() {
-            ItemKind::Type(ref type_) => type_,
-            _ => return false,
+        let ItemKind::Type(ref type_) = *item.kind() else {
+            return false;
         };
 
         match *type_.kind() {
@@ -1077,9 +1073,8 @@ impl Item {
 
     /// Returns a prefix for the canonical name when C naming is enabled.
     fn c_naming_prefix(&self) -> Option<&str> {
-        let ty = match self.kind {
-            ItemKind::Type(ref ty) => ty,
-            _ => return None,
+        let ItemKind::Type(ref ty) = self.kind else {
+            return None;
         };
 
         Some(match ty.kind() {
@@ -1563,8 +1558,8 @@ impl Item {
              \tlocation = {location:?}",
         );
 
-        if ty.kind() == clang_sys::CXType_Unexposed ||
-            location.cur_type().kind() == clang_sys::CXType_Unexposed
+        if ty.kind() == CXType_Unexposed ||
+            location.cur_type().kind() == CXType_Unexposed
         {
             if ty.is_associated_type() ||
                 location.cur_type().is_associated_type()
@@ -1702,8 +1697,7 @@ impl Item {
                         ty.spelling()
                     );
                     Item::type_param(Some(id), location, ctx)
-                        .map(Ok)
-                        .unwrap_or(Err(ParseError::Recurse))
+                        .ok_or(ParseError::Recurse)
                 } else {
                     result
                 }
diff --git a/bindgen/ir/layout.rs b/bindgen/ir/layout.rs
index fc248e1d..905e47c7 100644
--- a/bindgen/ir/layout.rs
+++ b/bindgen/ir/layout.rs
@@ -19,9 +19,8 @@ pub(crate) struct Layout {
 
 #[test]
 fn test_layout_for_size() {
-    use std::mem;
-
-    let ptr_size = mem::size_of::<*mut ()>();
+    use std::mem::size_of;
+    let ptr_size = size_of::<*mut ()>();
     assert_eq!(
         Layout::for_size_internal(ptr_size, ptr_size),
         Layout::new(ptr_size, ptr_size)
diff --git a/bindgen/ir/objc.rs b/bindgen/ir/objc.rs
index 6d830959..81560da4 100644
--- a/bindgen/ir/objc.rs
+++ b/bindgen/ir/objc.rs
@@ -301,7 +301,7 @@ impl ObjCMethod {
 
         // Get arguments without type signatures to pass to `msg_send!`
         let mut args_without_types = vec![];
-        for arg in args.iter() {
+        for arg in args {
             let arg = arg.to_string();
             let name_and_sig: Vec<&str> = arg.split(' ').collect();
             let name = name_and_sig[0];
diff --git a/bindgen/ir/template.rs b/bindgen/ir/template.rs
index 59bd4bfd..2783b414 100644
--- a/bindgen/ir/template.rs
+++ b/bindgen/ir/template.rs
@@ -266,17 +266,14 @@ impl TemplateInstantiation {
             })
         };
 
-        let definition = match definition {
-            Some(def) => def,
-            None => {
-                if !ty.declaration().is_builtin() {
-                    warn!(
-                        "Could not find template definition for template \
+        let Some(definition) = definition else {
+            if !ty.declaration().is_builtin() {
+                warn!(
+                    "Could not find template definition for template \
                          instantiation"
-                    );
-                }
-                return None;
+                );
             }
+            return None;
         };
 
         let template_definition =
diff --git a/bindgen/ir/ty.rs b/bindgen/ir/ty.rs
index fc3bfa60..31606465 100644
--- a/bindgen/ir/ty.rs
+++ b/bindgen/ir/ty.rs
@@ -637,12 +637,7 @@ pub(crate) enum TypeKind {
     /// already known types, and are converted to ResolvedTypeRef.
     ///
     /// see tests/headers/typeref.hpp to see somewhere where this is a problem.
-    UnresolvedTypeRef(
-        clang::Type,
-        clang::Cursor,
-        /* parent_id */
-        Option<ItemId>,
-    ),
+    UnresolvedTypeRef(clang::Type, Cursor, /* parent_id */ Option<ItemId>),
 
     /// An indirection to another type.
     ///
@@ -865,20 +860,16 @@ impl Type {
                                     Some(location),
                                     ctx,
                                 );
-                                match complex {
-                                    Ok(complex) => TypeKind::Comp(complex),
-                                    Err(_) => {
-                                        warn!(
-                                            "Could not create complex type \
-                                             from class template or base \
-                                             specifier, using opaque blob"
-                                        );
-                                        let opaque =
-                                            Opaque::from_clang_ty(ty, ctx);
-                                        return Ok(ParseResult::New(
-                                            opaque, None,
-                                        ));
-                                    }
+                                if let Ok(complex) = complex {
+                                    TypeKind::Comp(complex)
+                                } else {
+                                    warn!(
+                                        "Could not create complex type \
+                                         from class template or base \
+                                         specifier, using opaque blob"
+                                    );
+                                    let opaque = Opaque::from_clang_ty(ty, ctx);
+                                    return Ok(ParseResult::New(opaque, None));
                                 }
                             }
                             CXCursor_TypeAliasTemplateDecl => {
@@ -926,16 +917,13 @@ impl Type {
                                     CXChildVisit_Continue
                                 });
 
-                                let inner_type = match inner {
-                                    Ok(inner) => inner,
-                                    Err(..) => {
-                                        warn!(
-                                            "Failed to parse template alias \
+                                let Ok(inner_type) = inner else {
+                                    warn!(
+                                        "Failed to parse template alias \
                                              {:?}",
-                                            location
-                                        );
-                                        return Err(ParseError::Continue);
-                                    }
+                                        location
+                                    );
+                                    return Err(ParseError::Continue);
                                 };
 
                                 TypeKind::TemplateAlias(inner_type, args)
diff --git a/bindgen/ir/var.rs b/bindgen/ir/var.rs
index 2aa92f84..fa6930ec 100644
--- a/bindgen/ir/var.rs
+++ b/bindgen/ir/var.rs
@@ -125,23 +125,24 @@ fn default_macro_constant_type(ctx: &BindgenContext, value: i64) -> IntKind {
         ctx.options().default_macro_constant_type ==
             MacroTypeVariation::Signed
     {
-        if value < i32::MIN as i64 || value > i32::MAX as i64 {
+        if value < i64::from(i32::MIN) || value > i64::from(i32::MAX) {
             IntKind::I64
         } else if !ctx.options().fit_macro_constants ||
-            value < i16::MIN as i64 ||
-            value > i16::MAX as i64
+            value < i64::from(i16::MIN) ||
+            value > i64::from(i16::MAX)
         {
             IntKind::I32
-        } else if value < i8::MIN as i64 || value > i8::MAX as i64 {
+        } else if value < i64::from(i8::MIN) || value > i64::from(i8::MAX) {
             IntKind::I16
         } else {
             IntKind::I8
         }
-    } else if value > u32::MAX as i64 {
+    } else if value > i64::from(u32::MAX) {
         IntKind::U64
-    } else if !ctx.options().fit_macro_constants || value > u16::MAX as i64 {
+    } else if !ctx.options().fit_macro_constants || value > i64::from(u16::MAX)
+    {
         IntKind::U32
-    } else if value > u8::MAX as i64 {
+    } else if value > i64::from(u8::MAX) {
         IntKind::U16
     } else {
         IntKind::U8
@@ -198,9 +199,8 @@ impl ClangSubItemParser for Var {
 
                 let value = parse_macro(ctx, &cursor);
 
-                let (id, value) = match value {
-                    Some(v) => v,
-                    None => return Err(ParseError::Continue),
+                let Some((id, value)) = value else {
+                    return Err(ParseError::Continue);
                 };
 
                 assert!(!id.is_empty(), "Empty macro name?");
@@ -235,7 +235,7 @@ impl ClangSubItemParser for Var {
                                 c as u8
                             }
                             CChar::Raw(c) => {
-                                assert!(c <= u8::MAX as u64);
+                                assert!(c <= u64::from(u8::MAX));
                                 c as u8
                             }
                         };
@@ -338,9 +338,9 @@ impl ClangSubItemParser for Var {
                 // to look at the canonical type of the pointee too, and check
                 // is char, u8, or i8 I guess).
                 let value = if is_integer {
-                    let kind = match *canonical_ty.unwrap().kind() {
-                        TypeKind::Int(kind) => kind,
-                        _ => unreachable!(),
+                    let TypeKind::Int(kind) = *canonical_ty.unwrap().kind()
+                    else {
+                        unreachable!()
                     };
 
                     let mut val = cursor.evaluate().and_then(|v| v.as_int());
@@ -477,7 +477,7 @@ fn get_integer_literal_from_cursor(cursor: &clang::Cursor) -> Option<i64> {
 
 fn duplicated_macro_diagnostic(
     macro_name: &str,
-    _location: crate::clang::SourceLocation,
+    _location: clang::SourceLocation,
     _ctx: &BindgenContext,
 ) {
     warn!("Duplicated macro definition: {macro_name}");
diff --git a/bindgen/lib.rs b/bindgen/lib.rs
index e599f759..58e1da86 100644
--- a/bindgen/lib.rs
+++ b/bindgen/lib.rs
@@ -70,6 +70,7 @@ use std::env;
 use std::ffi::OsStr;
 use std::fs::{File, OpenOptions};
 use std::io::{self, Write};
+use std::mem::size_of;
 use std::path::{Path, PathBuf};
 use std::process::{Command, Stdio};
 use std::rc::Rc;
@@ -888,7 +889,7 @@ impl Bindings {
         if is_host_build {
             debug_assert_eq!(
                 context.target_pointer_size(),
-                std::mem::size_of::<*mut ()>(),
+                size_of::<*mut ()>(),
                 "{effective_target:?} {HOST_TARGET:?}"
             );
         }
@@ -928,7 +929,7 @@ impl Bindings {
             )?;
         }
 
-        for line in self.options.raw_lines.iter() {
+        for line in &self.options.raw_lines {
             writer.write_all(line.as_bytes())?;
             writer.write_all(NL.as_bytes())?;
         }
@@ -1103,7 +1104,7 @@ fn parse(context: &mut BindgenContext) -> Result<(), BindgenError> {
     use clang_sys::*;
 
     let mut error = None;
-    for d in context.translation_unit().diags().iter() {
+    for d in &context.translation_unit().diags() {
         let msg = d.format();
         let is_err = d.severity() >= CXDiagnostic_Error;
         if is_err {
@@ -1123,10 +1124,10 @@ fn parse(context: &mut BindgenContext) -> Result<(), BindgenError> {
 
     if context.options().emit_ast {
         fn dump_if_not_builtin(cur: &clang::Cursor) -> CXChildVisitResult {
-            if !cur.is_builtin() {
-                clang::ast_dump(cur, 0)
-            } else {
+            if cur.is_builtin() {
                 CXChildVisit_Continue
+            } else {
+                clang::ast_dump(cur, 0)
             }
         }
         cursor.visit(|cur| dump_if_not_builtin(&cur));
@@ -1184,11 +1185,11 @@ pub fn clang_version() -> ClangVersion {
 fn env_var<K: AsRef<str> + AsRef<OsStr>>(
     parse_callbacks: &[Rc<dyn callbacks::ParseCallbacks>],
     key: K,
-) -> Result<String, std::env::VarError> {
+) -> Result<String, env::VarError> {
     for callback in parse_callbacks {
         callback.read_env_var(key.as_ref());
     }
-    std::env::var(key)
+    env::var(key)
 }
 
 /// Looks for the env var `var_${TARGET}`, and falls back to just `var` when it is not found.
@@ -1281,7 +1282,7 @@ impl callbacks::ParseCallbacks for CargoCallbacks {
 #[test]
 fn commandline_flag_unit_test_function() {
     //Test 1
-    let bindings = crate::builder();
+    let bindings = builder();
     let command_line_flags = bindings.command_line_flags();
 
     let test_cases = [
@@ -1297,7 +1298,7 @@ fn commandline_flag_unit_test_function() {
     assert!(test_cases.iter().all(|x| command_line_flags.contains(x)));
 
     //Test 2
-    let bindings = crate::builder()
+    let bindings = builder()
         .header("input_header")
         .allowlist_type("Distinct_Type")
         .allowlist_function("safe_function");
diff --git a/bindgen/options/cli.rs b/bindgen/options/cli.rs
index 834c7c76..29b4413b 100644
--- a/bindgen/options/cli.rs
+++ b/bindgen/options/cli.rs
@@ -1,3 +1,5 @@
+#![allow(unused_qualifications)] // Clap somehow generates a lot of these
+
 use crate::{
     builder,
     callbacks::{
@@ -703,7 +705,7 @@ where
         }
 
         fn add_derives(&self, info: &DeriveInfo<'_>) -> Vec<String> {
-            if self.kind.map(|kind| kind == info.kind).unwrap_or(true) &&
+            if self.kind.map_or(true, |kind| kind == info.kind) &&
                 self.regex_set.matches(info.name)
             {
                 return self.derives.clone();
@@ -743,7 +745,7 @@ where
         }
 
         fn add_attributes(&self, info: &AttributeInfo<'_>) -> Vec<String> {
-            if self.kind.map(|kind| kind == info.kind).unwrap_or(true) &&
+            if self.kind.map_or(true, |kind| kind == info.kind) &&
                 self.regex_set.matches(info.name)
             {
                 return self.attributes.clone();
@@ -810,7 +812,7 @@ where
                     shell,
                     &mut BindgenCommand::command(),
                     "bindgen",
-                    &mut std::io::stdout(),
+                    &mut io::stdout(),
                 );
 
                 exit(0)
diff --git a/bindgen/options/mod.rs b/bindgen/options/mod.rs
index 4e68dfb7..6bf652d4 100644
--- a/bindgen/options/mod.rs
+++ b/bindgen/options/mod.rs
@@ -1143,7 +1143,7 @@ options! {
         },
         as_args: |module_lines, args| {
             for (module, lines) in module_lines {
-                for line in lines.iter() {
+                for line in lines {
                     args.push("--module-raw-line".to_owned());
                     args.push(module.clone().into());
                     args.push(line.clone().into());
diff --git a/bindgen/regex_set.rs b/bindgen/regex_set.rs
index be0041dc..3b6aa341 100644
--- a/bindgen/regex_set.rs
+++ b/bindgen/regex_set.rs
@@ -115,9 +115,8 @@ impl RegexSet {
         S: AsRef<str>,
     {
         let s = string.as_ref();
-        let set = match self.set {
-            Some(ref set) => set,
-            None => return false,
+        let Some(ref set) = self.set else {
+            return false;
         };
 
         if !self.record_matches {
@@ -128,7 +127,7 @@ impl RegexSet {
         if !matches.matched_any() {
             return false;
         }
-        for i in matches.iter() {
+        for i in &matches {
             self.matched[i].set(true);
         }
 
diff --git a/bindgen/time.rs b/bindgen/time.rs
index 435890c4..a220de7d 100644
--- a/bindgen/time.rs
+++ b/bindgen/time.rs
@@ -36,7 +36,7 @@ impl<'a> Timer<'a> {
         if self.output {
             let elapsed = self.elapsed();
             let time = (elapsed.as_secs() as f64) * 1e3 +
-                (elapsed.subsec_nanos() as f64) / 1e6;
+                f64::from(elapsed.subsec_nanos()) / 1e6;
             let stderr = io::stderr();
             // Arbitrary output format, subject to change.
             writeln!(stderr.lock(), "  time: {time:>9.3} ms.\t{}", self.name)


Test patch:
diff --git a/bindgen-tests/Cargo.toml b/bindgen-tests/Cargo.toml
index 346be51c..3a13c59c 100644
--- a/bindgen-tests/Cargo.toml
+++ b/bindgen-tests/Cargo.toml
@@ -1,3 +1,5 @@
+lints.workspace = true
+
 [package]
 name = "bindgen-tests"
 version = "0.1.0"
diff --git a/bindgen-tests/build.rs b/bindgen-tests/build.rs
index 713dbb3c..d98e8239 100644
--- a/bindgen-tests/build.rs
+++ b/bindgen-tests/build.rs
@@ -12,10 +12,9 @@ pub fn main() {
     let manifest_dir = PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap());
     let headers_dir = manifest_dir.join("tests").join("headers");
 
-    let headers = match fs::read_dir(headers_dir) {
-        Ok(dir) => dir,
+    let Ok(headers) = fs::read_dir(headers_dir) else {
         // We may not have headers directory after packaging.
-        Err(..) => return,
+        return;
     };
 
     let entries =
diff --git a/bindgen-tests/tests/expectations/Cargo.toml b/bindgen-tests/tests/expectations/Cargo.toml
index 2f77baf7..975fd166 100644
--- a/bindgen-tests/tests/expectations/Cargo.toml
+++ b/bindgen-tests/tests/expectations/Cargo.toml
@@ -16,17 +16,22 @@ block.workspace = true
 libloading.workspace = true
 objc.workspace = true
 
+# Both of these sections need to be copied here from the workspace because
+# Cargo currently does not allow overriding workspace settings in a member
 [lints.rust]
 ### FIXME: these might need to be fixed,
 ###   esp the calling convention, because it is a hard error now
 # deprecated = "allow"
 # invalid-value = "allow"
 # unsupported_calling_conventions = "allow"
+#
+# Different from the workspace
 dead_code = "allow"
 non-snake-case = "allow"
 non_camel_case_types = "allow"
 non_upper_case_globals = "allow"
 unexpected-cfgs = "allow"
+unused_qualifications = "allow"
 
 [lints.clippy]
 disallowed-names = "allow"
diff --git a/bindgen-tests/tests/expectations/tests/derive-bitfield-method-same-name.rs b/bindgen-tests/tests/expectations/tests/derive-bitfield-method-same-name.rs
index c8f19bc5..05e66a72 100644
--- a/bindgen-tests/tests/expectations/tests/derive-bitfield-method-same-name.rs
+++ b/bindgen-tests/tests/expectations/tests/derive-bitfield-method-same-name.rs
@@ -136,12 +136,18 @@ impl ::std::fmt::Debug for Foo {
         write!(
             f,
             "Foo {{ large: [{}], type_ : {:?},  }}",
-            self
-                .large
-                .iter()
-                .enumerate()
-                .map(|(i, v)| format!("{}{:?}", if i > 0 { ", " } else { "" }, v))
-                .collect::<String>(),
+            {
+                use std::fmt::Write as _;
+                let mut output = String::new();
+                let mut iter = self.large.iter();
+                if let Some(value) = iter.next() {
+                    let _ = write!(output, "{value:?}");
+                    for value in iter {
+                        let _ = write!(output, ", {value:?}");
+                    }
+                }
+                output
+            },
             self.type__bindgen_bitfield(),
         )
     }
diff --git a/bindgen-tests/tests/expectations/tests/derive-debug-bitfield.rs b/bindgen-tests/tests/expectations/tests/derive-debug-bitfield.rs
index 20c7cf0c..e2668805 100644
--- a/bindgen-tests/tests/expectations/tests/derive-debug-bitfield.rs
+++ b/bindgen-tests/tests/expectations/tests/derive-debug-bitfield.rs
@@ -122,12 +122,18 @@ impl ::std::fmt::Debug for C {
             "C {{ a : {:?}, b : {:?}, large_array: [{}] }}",
             self.a(),
             self.b(),
-            self
-                .large_array
-                .iter()
-                .enumerate()
-                .map(|(i, v)| format!("{}{:?}", if i > 0 { ", " } else { "" }, v))
-                .collect::<String>(),
+            {
+                use std::fmt::Write as _;
+                let mut output = String::new();
+                let mut iter = self.large_array.iter();
+                if let Some(value) = iter.next() {
+                    let _ = write!(output, "{value:?}");
+                    for value in iter {
+                        let _ = write!(output, ", {value:?}");
+                    }
+                }
+                output
+            },
         )
     }
 }
diff --git a/bindgen-tests/tests/expectations/tests/derive-debug-function-pointer.rs b/bindgen-tests/tests/expectations/tests/derive-debug-function-pointer.rs
index 9077201a..9fe1f551 100644
--- a/bindgen-tests/tests/expectations/tests/derive-debug-function-pointer.rs
+++ b/bindgen-tests/tests/expectations/tests/derive-debug-function-pointer.rs
@@ -40,12 +40,18 @@ impl ::std::fmt::Debug for Nice {
             f,
             "Nice {{ pointer: {:?}, large_array: [{}] }}",
             self.pointer,
-            self
-                .large_array
-                .iter()
-                .enumerate()
-                .map(|(i, v)| format!("{}{:?}", if i > 0 { ", " } else { "" }, v))
-                .collect::<String>(),
+            {
+                use std::fmt::Write as _;
+                let mut output = String::new();
+                let mut iter = self.large_array.iter();
+                if let Some(value) = iter.next() {
+                    let _ = write!(output, "{value:?}");
+                    for value in iter {
+                        let _ = write!(output, ", {value:?}");
+                    }
+                }
+                output
+            },
         )
     }
 }
diff --git a/bindgen-tests/tests/quickchecking/Cargo.toml b/bindgen-tests/tests/quickchecking/Cargo.toml
index ca36eb1c..b26ba3b3 100644
--- a/bindgen-tests/tests/quickchecking/Cargo.toml
+++ b/bindgen-tests/tests/quickchecking/Cargo.toml
@@ -1,3 +1,5 @@
+lints.workspace = true
+
 [package]
 name = "quickchecking"
 description = "Bindgen property tests with quickcheck. Generate random valid C code and pass it to the csmith/predicate.py script"
diff --git a/bindgen-tests/tests/tests.rs b/bindgen-tests/tests/tests.rs
index bbe7eb2e..0b3ebe15 100644
--- a/bindgen-tests/tests/tests.rs
+++ b/bindgen-tests/tests/tests.rs
@@ -55,9 +55,10 @@ fn error_diff_mismatch(
 
     if let Some(var) = env::var_os("BINDGEN_TESTS_DIFFTOOL") {
         //usecase: var = "meld" -> You can hand check differences
-        let name = match filename.components().last() {
-            Some(std::path::Component::Normal(name)) => name,
-            _ => panic!("Why is the header variable so weird?"),
+        let Some(std::path::Component::Normal(name)) =
+            filename.components().last()
+        else {
+            panic!("Why is the header variable so weird?")
         };
         let actual_result_path =
             PathBuf::from(env::var("OUT_DIR").unwrap()).join(name);
@@ -371,7 +372,7 @@ include!(concat!(env!("OUT_DIR"), "/tests.rs"));
 #[test]
 #[cfg_attr(target_os = "windows", ignore)]
 fn test_clang_env_args() {
-    std::env::set_var(
+    env::set_var(
         "BINDGEN_EXTRA_CLANG_ARGS",
         "-D_ENV_ONE=1 -D_ENV_TWO=\"2 -DNOT_THREE=1\"",
     );
@@ -581,29 +582,28 @@ fn test_macro_fallback_non_system_dir() {
 
     let actual = format_code(actual).unwrap();
 
-    let (expected_filename, expected) = match clang_version().parsed {
-        Some((9, _)) => {
-            let expected_filename = concat!(
-                env!("CARGO_MANIFEST_DIR"),
-                "/tests/expectations/tests/libclang-9/macro_fallback_non_system_dir.rs",
-            );
-            let expected = include_str!(concat!(
-                env!("CARGO_MANIFEST_DIR"),
-                "/tests/expectations/tests/libclang-9/macro_fallback_non_system_dir.rs",
-            ));
-            (expected_filename, expected)
-        }
-        _ => {
-            let expected_filename = concat!(
-                env!("CARGO_MANIFEST_DIR"),
-                "/tests/expectations/tests/test_macro_fallback_non_system_dir.rs",
-            );
-            let expected = include_str!(concat!(
-                env!("CARGO_MANIFEST_DIR"),
-                "/tests/expectations/tests/test_macro_fallback_non_system_dir.rs",
-            ));
-            (expected_filename, expected)
-        }
+    let (expected_filename, expected) = if let Some((9, _)) =
+        clang_version().parsed
+    {
+        let expected_filename = concat!(
+            env!("CARGO_MANIFEST_DIR"),
+            "/tests/expectations/tests/libclang-9/macro_fallback_non_system_dir.rs",
+        );
+        let expected = include_str!(concat!(
+            env!("CARGO_MANIFEST_DIR"),
+            "/tests/expectations/tests/libclang-9/macro_fallback_non_system_dir.rs",
+        ));
+        (expected_filename, expected)
+    } else {
+        let expected_filename = concat!(
+            env!("CARGO_MANIFEST_DIR"),
+            "/tests/expectations/tests/test_macro_fallback_non_system_dir.rs",
+        );
+        let expected = include_str!(concat!(
+            env!("CARGO_MANIFEST_DIR"),
+            "/tests/expectations/tests/test_macro_fallback_non_system_dir.rs",
+        ));
+        (expected_filename, expected)
     };
     let expected = format_code(expected).unwrap();
     if expected != actual {
@@ -653,8 +653,8 @@ fn emit_depfile() {
         builder.into_builder(check_roundtrip).unwrap();
     let _bindings = builder.generate().unwrap();
 
-    let observed = std::fs::read_to_string(observed_depfile).unwrap();
-    let expected = std::fs::read_to_string(expected_depfile).unwrap();
+    let observed = fs::read_to_string(observed_depfile).unwrap();
+    let expected = fs::read_to_string(expected_depfile).unwrap();
     assert_eq!(observed.trim(), expected.trim());
 }
 
@@ -694,7 +694,7 @@ fn dump_preprocessed_input() {
     );
 }
 
-fn build_flags_output_helper(builder: &bindgen::Builder) {
+fn build_flags_output_helper(builder: &Builder) {
     let mut command_line_flags = builder.command_line_flags();
     command_line_flags.insert(0, "bindgen".to_string());
 
@@ -712,7 +712,7 @@ fn build_flags_output_helper(builder: &bindgen::Builder) {
 
 #[test]
 fn commandline_multiple_headers() {
-    let bindings = bindgen::Builder::default()
+    let bindings = Builder::default()
         .header("tests/headers/char.h")
         .header("tests/headers/func_ptr.h")
         .header("tests/headers/16-byte-alignment.h");