diff options
| author | sneurlax <sneurlax@gmail.com> | 2024-10-14 21:47:10 -0500 |
|---|---|---|
| committer | sneurlax <sneurlax@gmail.com> | 2024-10-14 21:47:10 -0500 |
| commit | 0d9b372d3c0b7feb021b41522a6dec10e61c02a2 (patch) | |
| tree | c1d1f58296409aea8b536bdf222970e344321fbb /impls | |
| parent | 774091b550cac6df4f25127adb4047cf4334b973 (diff) | |
silence naming-related warnings
Diffstat (limited to 'impls')
| -rw-r--r-- | impls/monero.rs/build.rs | 19 | ||||
| -rw-r--r-- | impls/monero.rs/src/bindings.rs | 2 |
2 files changed, 21 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"); + } + } } diff --git a/impls/monero.rs/src/bindings.rs b/impls/monero.rs/src/bindings.rs index 7e61492..556f5ad 100644 --- a/impls/monero.rs/src/bindings.rs +++ b/impls/monero.rs/src/bindings.rs @@ -1,3 +1,5 @@ +#![allow(non_upper_case_globals)] +#![allow(dead_code)] /* automatically generated by rust-bindgen 0.70.1 */ pub const MONERO_wallet2_api_c_h_sha256: &[u8; 65] = |
