io: manage would block event #572
clippy
12 errors, 15 warnings
Details
Results
Message level | Amount |
---|---|
Internal compiler error | 0 |
Error | 12 |
Warning | 15 |
Note | 0 |
Help | 0 |
Versions
- rustc 1.77.0 (aedd173a2 2024-03-17)
- cargo 1.77.0 (3fe68eabf 2024-02-29)
- clippy 0.1.77 (aedd173 2024-03-17)
Annotations
Check warning on line 30 in plugin/src/types.rs
github-actions / clippy
this `let...else` may be rewritten with the `?` operator
warning: this `let...else` may be rewritten with the `?` operator
--> plugin/src/types.rs:28:9
|
28 | / let Some(ref value) = self.value else {
29 | | return None;
30 | | };
| |__________^ help: replace it with: `let ref value = self.value?;`
|
= 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
Check failure on line 296 in plugin/src/plugin.rs
github-actions / clippy
used `unwrap()` on a `Result` value
error: used `unwrap()` on a `Result` value
--> plugin/src/plugin.rs:296:29
|
296 | return Some(serde_json::to_string(&rpc_response).unwrap());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: if this value is an `Err`, it will panic
= help: consider using `expect()` to provide a better panic message
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unwrap_used
Check failure on line 284 in plugin/src/plugin.rs
github-actions / clippy
used `unwrap()` on a `Result` value
error: used `unwrap()` on a `Result` value
--> plugin/src/plugin.rs:284:55
|
284 | let request: Request<serde_json::Value> = serde_json::from_str(&buffer).unwrap();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: if this value is an `Err`, it will panic
= help: consider using `expect()` to provide a better panic message
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unwrap_used
Check warning on line 303 in plugin/src/plugin.rs
github-actions / clippy
unneeded `return` statement
warning: unneeded `return` statement
--> plugin/src/plugin.rs:303:17
|
303 | return None;
| ^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
help: remove `return`
|
303 - return None;
303 + None
|
Check warning on line 296 in plugin/src/plugin.rs
github-actions / clippy
unneeded `return` statement
warning: unneeded `return` statement
--> plugin/src/plugin.rs:296:17
|
296 | return Some(serde_json::to_string(&rpc_response).unwrap());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
= note: `#[warn(clippy::needless_return)]` on by default
help: remove `return`
|
296 - return Some(serde_json::to_string(&rpc_response).unwrap());
296 + Some(serde_json::to_string(&rpc_response).unwrap())
|
Check failure on line 268 in plugin/src/plugin.rs
github-actions / clippy
used `unwrap()` on a `Result` value
error: used `unwrap()` on a `Result` value
--> plugin/src/plugin.rs:268:25
|
268 | let level = LevelFilter::from_str(&level).unwrap();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: if this value is an `Err`, it will panic
= help: consider using `expect()` to provide a better panic message
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unwrap_used
Check failure on line 256 in plugin/src/plugin.rs
github-actions / clippy
used `unwrap()` on a `Result` value
error: used `unwrap()` on a `Result` value
--> plugin/src/plugin.rs:256:32
|
256 | let err_resp = serde_json::to_value(json_err).unwrap();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: if this value is an `Err`, it will panic
= help: consider using `expect()` to provide a better panic message
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unwrap_used
Check failure on line 215 in plugin/src/plugin.rs
github-actions / clippy
used `unwrap()` on an `Option` value
error: used `unwrap()` on an `Option` value
--> plugin/src/plugin.rs:215:28
|
215 | let notification = self.rpc_notification.get(name).unwrap().clone();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: if this value is `None`, it will panic
= help: consider using `expect()` to provide a better panic message
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unwrap_used
Check warning on line 148 in plugin/src/plugin.rs
github-actions / clippy
using `Option.and_then(|x| Some(y))`, which is more succinctly expressed as `map(|x| y)`
warning: using `Option.and_then(|x| Some(y))`, which is more succinctly expressed as `map(|x| y)`
--> plugin/src/plugin.rs:148:25
|
148 | "string" => def_val.and_then(|val| Some(serde_json::json!(val))),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `def_val.map(|val| serde_json::json!(val))`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#bind_instead_of_map
Check failure on line 147 in plugin/src/plugin.rs
github-actions / clippy
used `unwrap()` on a `Result` value
error: used `unwrap()` on a `Result` value
--> plugin/src/plugin.rs:147:68
|
147 | "int" => def_val.and_then(|val| Some(serde_json::json!(val.parse::<i64>().unwrap()))),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: if this value is an `Err`, it will panic
= help: consider using `expect()` to provide a better panic message
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unwrap_used
Check warning on line 147 in plugin/src/plugin.rs
github-actions / clippy
using `Option.and_then(|x| Some(y))`, which is more succinctly expressed as `map(|x| y)`
warning: using `Option.and_then(|x| Some(y))`, which is more succinctly expressed as `map(|x| y)`
--> plugin/src/plugin.rs:147:22
|
147 | "int" => def_val.and_then(|val| Some(serde_json::json!(val.parse::<i64>().unwrap()))),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `def_val.map(|val| serde_json::json!(val.parse::<i64>().unwrap()))`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#bind_instead_of_map
Check failure on line 145 in plugin/src/plugin.rs
github-actions / clippy
used `unwrap()` on a `Result` value
error: used `unwrap()` on a `Result` value
--> plugin/src/plugin.rs:145:63
|
145 | def_val.and_then(|val| Some(serde_json::json!(val.parse::<bool>().unwrap())))
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: if this value is an `Err`, it will panic
= help: consider using `expect()` to provide a better panic message
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unwrap_used
Check warning on line 145 in plugin/src/plugin.rs
github-actions / clippy
using `Option.and_then(|x| Some(y))`, which is more succinctly expressed as `map(|x| y)`
warning: using `Option.and_then(|x| Some(y))`, which is more succinctly expressed as `map(|x| y)`
--> plugin/src/plugin.rs:145:17
|
145 | def_val.and_then(|val| Some(serde_json::json!(val.parse::<bool>().unwrap())))
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `def_val.map(|val| serde_json::json!(val.parse::<bool>().unwrap()))`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#bind_instead_of_map
= note: `#[warn(clippy::bind_instead_of_map)]` on by default
Check failure on line 129 in plugin/src/plugin.rs
github-actions / clippy
used `unwrap()` on a `Result` value
error: used `unwrap()` on a `Result` value
--> plugin/src/plugin.rs:129:30
|
129 | writer.write_all(serde_json::to_string(&request).unwrap().as_bytes())
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: if this value is an `Err`, it will panic
= help: consider using `expect()` to provide a better panic message
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unwrap_used
Check failure on line 84 in plugin/src/plugin.rs
github-actions / clippy
used `unwrap()` on a `Result` value
error: used `unwrap()` on a `Result` value
--> plugin/src/plugin.rs:84:34
|
84 | writer.write_all(serde_json::to_string(&request).unwrap().as_bytes())
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: if this value is an `Err`, it will panic
= help: consider using `expect()` to provide a better panic message
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unwrap_used
Check warning on line 55 in plugin/src/plugin.rs
github-actions / clippy
very complex type used. Consider factoring parts into `type` definitions
warning: very complex type used. Consider factoring parts into `type` definitions
--> plugin/src/plugin.rs:55:14
|
55 | on_init: Option<Arc<dyn Fn(&mut Plugin<T>) -> Value>>,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#type_complexity
Check warning on line 69 in plugin/src/io.rs
github-actions / clippy
methods called `into_*` usually take `self` by value
warning: methods called `into_*` usually take `self` by value
--> plugin/src/io.rs:69:9
|
69 | &mut self,
| ^^^^^^^^^
|
= 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
Check warning on line 27 in plugin/src/commands/mod.rs
github-actions / clippy
the following explicit lifetimes could be elided: 'c
warning: the following explicit lifetimes could be elided: 'c
--> plugin/src/commands/mod.rs:27:18
|
27 | fn call_void<'c>(&self, _plugin: &mut Plugin<T>, _request: &'c serde_json::Value) {}
| ^^ ^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
= note: `#[warn(clippy::needless_lifetimes)]` on by default
help: elide the lifetimes
|
27 - fn call_void<'c>(&self, _plugin: &mut Plugin<T>, _request: &'c serde_json::Value) {}
27 + fn call_void(&self, _plugin: &mut Plugin<T>, _request: &serde_json::Value) {}
|
Check warning on line 18 in plugin/src/commands/mod.rs
github-actions / clippy
this lifetime isn't used in the function definition
warning: this lifetime isn't used in the function definition
--> plugin/src/commands/mod.rs:18:13
|
18 | fn call<'c>(
| ^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#extra_unused_lifetimes
= note: `#[warn(clippy::extra_unused_lifetimes)]` on by default
Check failure on line 69 in plugin/src/commands/builtin.rs
github-actions / clippy
used `unwrap()` on a `Result` value
error: used `unwrap()` on a `Result` value
--> plugin/src/commands/builtin.rs:69:30
|
69 | let init: InitConf = serde_json::from_value(request.to_owned()).unwrap();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: if this value is an `Err`, it will panic
= help: consider using `expect()` to provide a better panic message
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unwrap_used
Check failure on line 61 in plugin/src/commands/builtin.rs
github-actions / clippy
used `unwrap()` on an `Option` value
error: used `unwrap()` on an `Option` value
--> plugin/src/commands/builtin.rs:61:13
|
61 | plugin.option.get_mut(option_name).unwrap().value = Some(option.to_owned());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: if this value is `None`, it will panic
= help: consider using `expect()` to provide a better panic message
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unwrap_used
Check failure on line 60 in plugin/src/commands/builtin.rs
github-actions / clippy
used `unwrap()` on an `Option` value
error: used `unwrap()` on an `Option` value
--> plugin/src/commands/builtin.rs:60:26
|
60 | let option = options.get(option_name).unwrap();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: if this value is `None`, it will panic
= help: consider using `expect()` to provide a better panic message
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unwrap_used
note: the lint level is defined here
--> plugin/src/lib.rs:10:9
|
10 | #![deny(clippy::unwrap_used)]
| ^^^^^^^^^^^^^^^^^^^
Check warning on line 54 in plugin/src/commands/builtin.rs
github-actions / clippy
very complex type used. Consider factoring parts into `type` definitions
warning: very complex type used. Consider factoring parts into `type` definitions
--> plugin/src/commands/builtin.rs:54:25
|
54 | pub(crate) on_init: Option<Arc<dyn Fn(&mut Plugin<T>) -> Value>>,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#type_complexity
= note: `#[warn(clippy::type_complexity)]` on by default
Check warning on line 39 in plugin_macros/src/attr_parser.rs
github-actions / clippy
single-character string constant used as pattern
warning: single-character string constant used as pattern
--> plugin_macros/src/attr_parser.rs:39:47
|
39 | let value = value.to_string().replace("\"", "");
| ^^^^ help: consider using a `char`: `'"'`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_char_pattern
= note: `#[warn(clippy::single_char_pattern)]` on by default
Check warning on line 71 in plugin_macros/src/plugin.rs
github-actions / clippy
this `impl` can be derived
warning: this `impl` can be derived
--> plugin_macros/src/plugin.rs:61:1
|
61 | / impl Default for PluginDeclaration {
62 | | fn default() -> Self {
63 | | Self {
64 | | state: None,
... |
70 | | }
71 | | }
| |_^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derivable_impls
= note: `#[warn(clippy::derivable_impls)]` on by default
= help: remove the manual implementation...
help: ...and instead derive it
|
9 + #[derive(Default)]
10 | pub struct PluginDeclaration {
|