Skip to content

fixup! feat(plugin): add async io for the plugin #568

fixup! feat(plugin): add async io for the plugin

fixup! feat(plugin): add async io for the plugin #568

GitHub Actions / clippy failed Mar 24, 2024 in 0s

clippy

15 errors, 15 warnings

Details

Results

Message level Amount
Internal compiler error 0
Error 15
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

See this annotation in the file changed.

@github-actions 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 294 in plugin/src/plugin.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

used `unwrap()` on a `Result` value

error: used `unwrap()` on a `Result` value
   --> plugin/src/plugin.rs:294:29
    |
294 |                 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 282 in plugin/src/plugin.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

used `unwrap()` on a `Result` value

error: used `unwrap()` on a `Result` value
   --> plugin/src/plugin.rs:282:55
    |
282 |             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 301 in plugin/src/plugin.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unneeded `return` statement

warning: unneeded `return` statement
   --> plugin/src/plugin.rs:301:17
    |
301 |                 return None;
    |                 ^^^^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
help: remove `return`
    |
301 -                 return None;
301 +                 None
    |

Check warning on line 294 in plugin/src/plugin.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unneeded `return` statement

warning: unneeded `return` statement
   --> plugin/src/plugin.rs:294:17
    |
294 |                 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`
    |
294 -                 return Some(serde_json::to_string(&rpc_response).unwrap());
294 +                 Some(serde_json::to_string(&rpc_response).unwrap())
    |

Check failure on line 266 in plugin/src/plugin.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

used `unwrap()` on a `Result` value

error: used `unwrap()` on a `Result` value
   --> plugin/src/plugin.rs:266:25
    |
266 |             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 254 in plugin/src/plugin.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

used `unwrap()` on a `Result` value

error: used `unwrap()` on a `Result` value
   --> plugin/src/plugin.rs:254:32
    |
254 |                 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 213 in plugin/src/plugin.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

used `unwrap()` on an `Option` value

error: used `unwrap()` on an `Option` value
   --> plugin/src/plugin.rs:213:28
    |
213 |         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 146 in plugin/src/plugin.rs

See this annotation in the file changed.

@github-actions 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:146:25
    |
146 |             "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 145 in plugin/src/plugin.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

used `unwrap()` on a `Result` value

error: used `unwrap()` on a `Result` value
   --> plugin/src/plugin.rs:145:68
    |
145 |             "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 145 in plugin/src/plugin.rs

See this annotation in the file changed.

@github-actions 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:22
    |
145 |             "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 143 in plugin/src/plugin.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

used `unwrap()` on a `Result` value

error: used `unwrap()` on a `Result` value
   --> plugin/src/plugin.rs:143:63
    |
143 |                 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 143 in plugin/src/plugin.rs

See this annotation in the file changed.

@github-actions 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:143:17
    |
143 |                 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 128 in plugin/src/plugin.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

used `unwrap()` on a `Result` value

error: used `unwrap()` on a `Result` value
   --> plugin/src/plugin.rs:128:34
    |
128 |         let _ = 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 85 in plugin/src/plugin.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

used `unwrap()` on a `Result` value

error: used `unwrap()` on a `Result` value
  --> plugin/src/plugin.rs:85:13
   |
85 |             writer.flush().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 83 in plugin/src/plugin.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

used `unwrap()` on a `Result` value

error: used `unwrap()` on a `Result` value
  --> plugin/src/plugin.rs:83:28
   |
83 |                 .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

See this annotation in the file changed.

@github-actions github-actions / clippy

used `unwrap()` on a `Result` value

error: used `unwrap()` on a `Result` value
  --> plugin/src/plugin.rs:82:13
   |
82 | /             writer
83 | |                 .write_all(serde_json::to_string(&request).unwrap().as_bytes())
84 | |                 .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 55 in plugin/src/plugin.rs

See this annotation in the file changed.

@github-actions 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 failure on line 51 in plugin/src/io.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

used `unwrap()` on a `Result` value

error: used `unwrap()` on a `Result` value
  --> plugin/src/io.rs:51:33
   |
51 | ...                   reader.read_exact(&mut byte).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 35 in plugin/src/io.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

methods called `into_*` usually take `self` by value

warning: methods called `into_*` usually take `self` by value
  --> plugin/src/io.rs:35:9
   |
35 |         &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

See this annotation in the file changed.

@github-actions 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

See this annotation in the file changed.

@github-actions 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

See this annotation in the file changed.

@github-actions 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

See this annotation in the file changed.

@github-actions 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

See this annotation in the file changed.

@github-actions 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)]
   |         ^^^^^^^^^^^^^^^^^^^