-
Notifications
You must be signed in to change notification settings - Fork 471
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
Fix net block hiding issue #897
Conversation
be enabled to ever hide the block on either case
src/blocks/net.rs
Outdated
@@ -855,6 +857,8 @@ impl Block for Net { | |||
let is_up = self.device.is_up()?; | |||
if !exists || !is_up { | |||
self.active = false; | |||
self.exists = exists; |
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.
Maybe better rewritten as:
let self.exists = self.device.exists()?;
let self.active = self.device.is_up()?;
if !self.exists || !self.active {
...
?
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.
Alright, i did it a little differently than you suggested because it's even cleaner to clarify that active
always implies exists
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.
LGTM, now hide_missing
actually does what it was supposed to do.
Can you update the docs to be more clear? For example, clarifying that "missing" means the device does not exist on the system.
Alright i updated the block docs and rewrote the logic there a bit |
No idea why the CI check is failing :/ |
Just need to run rustfmt, but otherwise it builds fine locally. Thanks! |
Fix net block issue where both
hide_inactive
andhide_missing
had to be enabled to ever hide the block on either case. (#891)This PR implements the functionality as i would expect it:
I tested all cases and it works as described.
Does that sound correct to you, @ammgws @mvdan ?