video: types: Empowers VideoEncodeType to support operations and dese… #105
Annotations
1 error and 9 warnings
type annotations needed for `Box<_>`:
/home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/time-0.3.30/src/format_description/parse/mod.rs#L83
error[E0282]: type annotations needed for `Box<_>`
--> /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/time-0.3.30/src/format_description/parse/mod.rs:83:9
|
83 | let items = format_items
| ^^^^^
...
86 | Ok(items.into())
| ---- type must be known at this point
|
help: consider giving `items` an explicit type, where the placeholders `_` are specified
|
83 | let items: Box<_> = format_items
| ++++++++
|
casting to the same type is unnecessary (`i64` -> `i64`):
src/video/video_source.rs#L84
warning: casting to the same type is unnecessary (`i64` -> `i64`)
--> src/video/video_source.rs:84:44
|
84 | .set_control_by_id(control.id, default_value as i64)
| ^^^^^^^^^^^^^^^^^^^^ help: try: `default_value`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast
= note: `#[warn(clippy::unnecessary_cast)]` on by default
|
methods with the following characteristics: (`to_*` and `self` type is not `Copy`) usually take `self` by reference:
src/video/types.rs#L131
warning: methods with the following characteristics: (`to_*` and `self` type is not `Copy`) usually take `self` by reference
--> src/video/types.rs:131:21
|
131 | pub fn to_codec(self) -> String {
| ^^^^
|
= help: consider choosing a less ambiguous name
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#wrong_self_convention
= note: `#[warn(clippy::wrong_self_convention)]` on by default
|
this `let...else` may be rewritten with the `?` operator:
src/stream/manager.rs#L299
warning: this `let...else` may be rewritten with the `?` operator
--> src/stream/manager.rs:299:21
|
299 | / let Some(stream) = manager.streams.values().find(|stream| {
300 | | let state = match stream.state.read() {
301 | | Ok(guard) => guard,
302 | | Err(error) => {
... |
317 | | return None;
318 | | };
| |______________________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#question_mark
= note: `#[warn(clippy::question_mark)]` on by default
help: replace it with
|
299 ~ let stream = manager.streams.values().find(|stream| {
300 + let state = match stream.state.read() {
301 + Ok(guard) => guard,
302 + Err(error) => {
303 + error!("Failed locking a Mutex. Reason: {error}");
304 + return false;
305 + }
306 + };
307 +
308 + state.as_ref().is_some_and(|state| {
309 + state
310 + .video_and_stream_information
311 + .video_source
312 + .inner()
313 + .source_string()
314 + == source
315 + })
316 + })?;
|
|
this `MutexGuard` is held across an `await` point:
src/stream/manager.rs#L320
warning: this `MutexGuard` is held across an `await` point
--> src/stream/manager.rs:320:25
|
320 | let state_guard = match stream.state.read() {
| ^^^^^^^^^^^
|
= help: consider using an async-aware `Mutex` type or ensuring the `MutexGuard` is dropped before calling await
note: these are all the `await` points this lock is held through
--> src/stream/manager.rs:343:75
|
343 | sinks.find(|sink| matches!(sink, Sink::Image(_))).await
| ^^^^^
...
351 | .await
| ^^^^^
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#await_holding_lock
|
this `MutexGuard` is held across an `await` point:
src/stream/manager.rs#L291
warning: this `MutexGuard` is held across an `await` point
--> src/stream/manager.rs:291:25
|
291 | let manager = match MANAGER.read() {
| ^^^^^^^
|
= help: consider using an async-aware `Mutex` type or ensuring the `MutexGuard` is dropped before calling await
note: these are all the `await` points this lock is held through
--> src/stream/manager.rs:343:75
|
343 | sinks.find(|sink| matches!(sink, Sink::Image(_))).await
| ^^^^^
...
351 | .await
| ^^^^^
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#await_holding_lock
= note: `#[warn(clippy::await_holding_lock)]` on by default
|
this async expression only awaits a single future:
src/server/manager.rs#L32
warning: this async expression only awaits a single future
--> src/server/manager.rs:32:17
|
32 | async { fut.await }
| ^^^^^^^^^^^^^^^^^^^ help: you can reduce it to: `fut`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_async_block
= note: `#[warn(clippy::redundant_async_block)]` on by default
|
associated items `to_codec` and `from_codec` are never used:
src/video/types.rs#L131
warning: associated items `to_codec` and `from_codec` are never used
--> src/video/types.rs:131:12
|
119 | impl VideoEncodeType {
| -------------------- associated items in this implementation
...
131 | pub fn to_codec(self) -> String {
| ^^^^^^^^
...
145 | pub fn from_codec(codec: &str) -> VideoEncodeType {
| ^^^^^^^^^^
|
= note: `#[warn(dead_code)]` on by default
|
build
Node.js 16 actions are deprecated. Please update the following actions to use Node.js 20: actions/checkout@v2, actions-rs/[email protected], actions-rs/clippy-check@v1. For more information see: https://github.blog/changelog/2023-09-22-github-actions-transitioning-from-node-16-to-node-20/.
|
build
The following actions uses node12 which is deprecated and will be forced to run on node16: actions/checkout@v2, actions-rs/[email protected], actions-rs/clippy-check@v1. For more info: https://github.blog/changelog/2023-06-13-github-actions-all-actions-will-run-on-node16-instead-of-node12-by-default/
|