-
Notifications
You must be signed in to change notification settings - Fork 65
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 some small Clippy lints + format Cargo.toml #112
base: master
Are you sure you want to change the base?
Conversation
seems like this file was added with the "deprecated" doc-comment. i assume no one has ever used it, and it's not referenced in the code anywhere might be a good idea to remove this in a major release
since the generics are only used once, the compiler knows them already
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.
Looks like we (unfortunately) have to tackle a lot more on the consistency front (separate from cleaning up lint nits) too :/
/// Deprecated, do not use | ||
#[deprecated] |
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.
/// Deprecated, do not use | |
#[deprecated] | |
#[deprecated = "do not use"] |
?
Err(e) => { | ||
if controls.is_empty() || e.kind() != io::ErrorKind::InvalidInput { | ||
return Err(e); | ||
} else { | ||
break; | ||
} | ||
break; | ||
} |
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.
We could've almost written something like break if ... { Err(e) } else { Ok(controls) };
showing that this is the only exit.
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.
Woah, that works just fine! I'm somewhat unfamiliar with this syntax, so please do check to ensure it's right:
Err(e) => { | |
if controls.is_empty() || e.kind() != io::ErrorKind::InvalidInput { | |
return Err(e); | |
} else { | |
break; | |
} | |
break; | |
} | |
Err(e) => { | |
break if controls.is_empty() || e.kind() != io::ErrorKind::InvalidInput { | |
Err(e) | |
} else { | |
Ok(controls) | |
}; |
@@ -27,9 +27,8 @@ macro_rules! impl_enum_frameintervals { | |||
if ret.is_err() { | |||
if v4l2_struct.index == 0 { | |||
return Err(ret.err().unwrap()); |
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.
No conversion here, can we use if let Err(e)
to get rid of the unwrap()
?
if v4l2_struct.index == 0 { | ||
return Err(ret.err().unwrap()); | ||
} else { | ||
return Ok(frameintervals); | ||
} | ||
return Ok(frameintervals); | ||
} | ||
|
||
if let Ok(frame_interval) = FrameInterval::try_from(v4l2_struct) { |
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.
Is this what you were thinking about? It's a little scary in the macro, but cargo check
is happy!
if v4l2_struct.index == 0 { | |
return Err(ret.err().unwrap()); | |
} else { | |
return Ok(frameintervals); | |
} | |
return Ok(frameintervals); | |
} | |
if let Ok(frame_interval) = FrameInterval::try_from(v4l2_struct) { | |
if let Err(e) = ret { | |
if v4l2_struct.index == 0 { | |
return Err(e); | |
} | |
return Ok(frameintervals); | |
} | |
if let Ok(frame_interval) = FrameInterval::try_from(v4l2_struct) { |
@@ -26,6 +26,7 @@ pub enum Type { | |||
MetaOutput = 14, | |||
|
|||
/// Deprecated, do not use | |||
#[deprecated] | |||
Private = 0x80, |
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 feel like this may not be useful. If you have a better reason than "do not use", it'd work much better here! :D
Private = 0x80, | |
#[deprecated(note = "do not use")] | |
Private = 0x80, |
Nothing fancy here! Please let me know if any of these are unwanted changes.