summaryrefslogtreecommitdiff
path: root/impls/monero.rs/build.rs
diff options
context:
space:
mode:
authorsneurlax <sneurlax@gmail.com>2024-10-14 21:47:10 -0500
committersneurlax <sneurlax@gmail.com>2024-10-14 21:47:10 -0500
commit0d9b372d3c0b7feb021b41522a6dec10e61c02a2 (patch)
treec1d1f58296409aea8b536bdf222970e344321fbb /impls/monero.rs/build.rs
parent774091b550cac6df4f25127adb4047cf4334b973 (diff)
silence naming-related warnings
Diffstat (limited to 'impls/monero.rs/build.rs')
-rw-r--r--impls/monero.rs/build.rs19
1 files changed, 19 insertions, 0 deletions
diff --git a/impls/monero.rs/build.rs b/impls/monero.rs/build.rs
index 19a4394..3fe2f81 100644
--- a/impls/monero.rs/build.rs
+++ b/impls/monero.rs/build.rs
@@ -114,4 +114,23 @@ fn main() {
bindings
.write_to_file(out_path.clone())
.expect("Couldn't write bindings!");
+
+ // Annotate the generated bindings to ignore certain warnings.
+ if out_path.exists() {
+ let contents = fs::read_to_string(out_path.clone()).expect("Failed to read bindings.rs");
+
+ let prepend_content = "#![allow(non_upper_case_globals)]\n#![allow(dead_code)]\n";
+
+ if !contents.contains("#![allow(non_upper_case_globals)]") {
+ let new_contents = format!("{}{}", prepend_content, contents);
+
+ let mut file = OpenOptions::new()
+ .write(true)
+ .truncate(true)
+ .open(out_path.clone())
+ .expect("Failed to open bindings.rs");
+
+ file.write_all(new_contents.as_bytes()).expect("Failed to write to bindings.rs");
+ }
+ }
}