Mercurial > crates > nonstick
diff libpam-sys/libpam-sys-test/build.rs @ 113:178310336596
Fix up more constants, make things i32 rather than u32.
author | Paul Fisher <paul@pfish.zone> |
---|---|
date | Sun, 29 Jun 2025 03:11:33 -0400 |
parents | 04105e9a7de8 |
children | 93d423b65555 |
line wrap: on
line diff
--- a/libpam-sys/libpam-sys-test/build.rs Sun Jun 29 02:21:26 2025 -0400 +++ b/libpam-sys/libpam-sys-test/build.rs Sun Jun 29 03:11:33 2025 -0400 @@ -1,9 +1,9 @@ use bindgen::MacroTypeVariation; use libpam_sys_impls::cfg_pam_impl; -use quote::ToTokens; +use quote::{format_ident, ToTokens}; use std::path::PathBuf; use std::{env, fs}; -use syn::{Item, ItemConst}; +use syn::{Ident, Item, ItemConst, Path, Type, TypePath}; fn main() { generate_const_test(); @@ -31,7 +31,7 @@ "security/pam_appl.h".into(), "security/pam_constants.h".into(), ], - ignore_consts: vec![], + ignore_consts: vec!["OPENPAM_VERSION"], } } @@ -66,10 +66,15 @@ } }) .filter(|item| config.should_check_const(item)) - .map(|item| { - let tokens = item.expr.to_token_stream(); + .cloned() + .map(|mut item| { + item.ty = Box::new(Type::Path(TypePath { + qself: None, + path: format_ident!("i32").into(), + })); format!( "assert_eq!({tokens}, libpam_sys::{name});", + tokens = item.expr.to_token_stream(), name = item.ident ) }),