Fix some small Clippy lints + format Cargo.toml - #112
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
MarijnS95
left a comment
There was a problem hiding this comment.
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.
| /// 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.
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.
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.
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.
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) { |
|
|
||
| /// Deprecated, do not use | ||
| #[deprecated] | ||
| Private = 0x80, |
There was a problem hiding this comment.
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.