New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make the flate2 dependency optional #157
Conversation
let file = FileWrapper::open(PROC_CONFIG_GZ)?; | ||
let decoder = GzDecoder::new(file); | ||
Box::new(BufReader::new(decoder)) | ||
let reader: Box<dyn BufRead> = if Path::new(PROC_CONFIG_GZ).exists() && cfg!(feature = "flate2") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think && cfg!(feature = "flate2")
is useless
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if cfg!(feature = "flate2") == false, block would not execute
if cfg!(feature = "flate2") == true, block would execute flate2::read::GzDecoder
so the cfg(not(...flate2 block may never execute
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if cfg!(feature = "flate2") == false, block would not execute
if cfg!(feature = "flate2") == true, block would execute flate2::read::GzDecoder
so the cfg(not(...flate2 block may never execute
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, the #[cfg(not(feature = "flate2"))]
block is unreachable, but is needed to typecheck
Other prosible conditional compile logic:
|
This PR looks good to me, I can remove the flate2 dependency and speed up my project compile |
23420e5
to
de0a845
Compare
20028d7
to
14757fa
Compare
This is a breaking change, since anyone using procfs with |
CC #156