diff libpam-sys/libpam-sys-test/build.rs @ 130:80c07e5ab22f

Transfer over (almost) completely to using libpam-sys. This reimplements everything in nonstick on top of the new -sys crate. We don't yet use libpam-sys's helpers for binary message payloads. Soon.
author Paul Fisher <paul@pfish.zone>
date Tue, 01 Jul 2025 06:11:43 -0400
parents c77846f3a979
children a632a8874131
line wrap: on
line diff
--- a/libpam-sys/libpam-sys-test/build.rs	Mon Jun 30 23:49:54 2025 -0400
+++ b/libpam-sys/libpam-sys-test/build.rs	Tue Jul 01 06:11:43 2025 -0400
@@ -1,6 +1,6 @@
 use bindgen::MacroTypeVariation;
 use libpam_sys_impls::__pam_impl_enum__;
-use proc_macro2::{Group, TokenStream, TokenTree};
+use proc_macro2::{Group, Ident, TokenStream, TokenTree};
 use quote::{format_ident, ToTokens};
 use std::path::Path;
 use std::process::Command;
@@ -150,11 +150,7 @@
 fn remove_consts(file_contents: &str, out_file: impl AsRef<Path>) {
     let deconstified = deconstify(
         TokenStream::from_str(file_contents).unwrap(),
-        &TokenStream::from_str("mut")
-            .unwrap()
-            .into_iter()
-            .next()
-            .unwrap(),
+        &format_ident!("mut"),
     )
     .to_string();
     let out_file = out_file.as_ref();
@@ -170,7 +166,7 @@
     assert!(status.success(), "rustfmt exited with code {status}");
 }
 
-fn deconstify(stream: TokenStream, mut_token: &TokenTree) -> TokenStream {
+fn deconstify(stream: TokenStream, mut_token: &Ident) -> TokenStream {
     TokenStream::from_iter(stream.into_iter().map(|token| {
         match token {
             TokenTree::Group(g) => {