diff libpam-sys/libpam-sys-test/build.rs @ 151:3a7cf05d2b5f

Fix libpam-sys-test from panicking over `mod aliases`.
author Paul Fisher <paul@pfish.zone>
date Mon, 07 Jul 2025 19:04:52 -0400
parents 4b3a5095f68c
children
line wrap: on
line diff
--- a/libpam-sys/libpam-sys-test/build.rs	Mon Jul 07 18:59:59 2025 -0400
+++ b/libpam-sys/libpam-sys-test/build.rs	Mon Jul 07 19:04:52 2025 -0400
@@ -159,8 +159,13 @@
 }
 
 fn remove_consts(file_contents: &str, out_file: impl AsRef<Path>) {
+    let lines: Vec<_> = file_contents
+        .lines()
+        .filter(|&l| !l.starts_with("pub mod"))
+        .collect();
+    let file_contents = lines.join("\n");
     let deconstified = deconstify(
-        TokenStream::from_str(file_contents).unwrap(),
+        TokenStream::from_str(&file_contents).unwrap(),
         &format_ident!("mut"),
     )
     .to_string();
@@ -191,8 +196,6 @@
     }))
 }
 
-enum ItemOr {}
-
 fn test_file(name: impl AsRef<str>) -> String {
     format!("{}/{}", env::var("OUT_DIR").unwrap(), name.as_ref())
 }