You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, I'm using gl-generator in my project and it works great, but I'm looking to enable clippy, and it is reporting many warnings in gl-generator's generated code. Any ideas how to best solve this?
My build script is nothing special, generating bindings for OpenGL 3.2 core:
use gl_generator::{Api,Fallbacks,GlobalGenerator,Profile,Registry};use std::env;use std::fs::File;use std::io::BufWriter;use std::path::Path;fnmain(){let out_dir = env::var("OUT_DIR").unwrap();let dest = Path::new(&out_dir);letmut file = BufWriter::new(File::create(&dest.join("bindings.rs")).unwrap());Registry::new(Api::Gl,(3,2),Profile::Core,Fallbacks::All,[]).write_bindings(GlobalGenerator,&mut file).unwrap();}
Breakdown of the warnings:
13 warning: this function has too many arguments (clippy::too_many_arguments)
290 warning: unneeded unit return type (clippy::unused_unit)
316 warning: unsafe function's docs miss # Safety section (clippy::missing_safety_doc)
These warnings might not make sense for generated code, so I tried to suppress them by writing #![allow(clippy::all)] at the top of the bindings.rs file (generated above). However this fails because #![] cannot be applied at this position. It may have be emitted before each module, or a more targeted fix with #[allow(clippy::too_many_arguments)] attached to the generated functions, etc. Or is there a better way to address these warnings systematically?
The text was updated successfully, but these errors were encountered:
The best way to use gl generator is to generate some bindings and then manually edit the file after the fact, so just edit the file by hand.
And then re-run it when you change some parameters just to have to re-apply all hand-edited changes? That's just madness. Would be more reasonable IMO to fix the warnings at the source (i.e. the generator). clippy::too_many_arguments might be hard to fix, but that one can at least be configured in a clippy.toml file on a project level. I don't see a reason to not fix the others though.
Hello, I'm using gl-generator in my project and it works great, but I'm looking to enable clippy, and it is reporting many warnings in gl-generator's generated code. Any ideas how to best solve this?
Complete output (619 warnings): https://gist.github.com/iceiix/60cdb5a3e1aae1550fec21690e18cd86
My build script is nothing special, generating bindings for OpenGL 3.2 core:
Breakdown of the warnings:
# Safety
section (clippy::missing_safety_doc)These warnings might not make sense for generated code, so I tried to suppress them by writing
#![allow(clippy::all)]
at the top of the bindings.rs file (generated above). However this fails because#![]
cannot be applied at this position. It may have be emitted before each module, or a more targeted fix with#[allow(clippy::too_many_arguments)]
attached to the generated functions, etc. Or is there a better way to address these warnings systematically?The text was updated successfully, but these errors were encountered: