Skip to content

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

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

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

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

clippy

20 errors, 15 warnings

Details

Results

Message level Amount
Internal compiler error 0
Error 20
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 289 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:289:24
    |
289 |                 return 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 283 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:283:55
    |
283 |             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 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 String::new();
    |                 ^^^^^^^^^^^^^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
help: remove `return`
    |
294 -                 return String::new();
294 +                 String::new()
    |

Check warning on line 289 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:289:17
    |
289 |                 return 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`
    |
289 -                 return serde_json::to_string(&rpc_response).unwrap();
289 +                 serde_json::to_string(&rpc_response).unwrap()
    |

Check failure on line 277 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:277:9
    |
277 |         asyncio.register().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 276 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:276:27
    |
276 |         let mut asyncio = AsyncIO::new().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 265 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:265:25
    |
265 |             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 253 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:253:32
    |
253 |                 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 212 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:212:28
    |
212 |         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 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:25
    |
145 |             "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 144 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:144:68
    |
144 |             "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 144 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:144:22
    |
144 |             "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 142 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:142:63
    |
142 |                 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 142 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:142:17
    |
142 |                 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 127 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:127:34
    |
127 |         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 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:84:13
   |
84 |             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 82 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:28
   |
82 |                 .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 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:81:13
   |
81 | /             writer
82 | |                 .write_all(serde_json::to_string(&request).unwrap().as_bytes())
83 | |                 .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 54 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:54:14
   |
54 |     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 62 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:62:29
   |
62 | ...                   io::stdout().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 61 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:61:29
   |
61 | ...                   io::stdout().write_all(resp.as_bytes()).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 50 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:50:33
   |
50 | ...                   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 failure on line 40 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:40:13
   |
40 |             self.poll.poll(&mut events, None).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 37 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:37:50
   |
37 |     pub fn into_loop<F: FnMut(String) -> String>(&mut self, mut async_callback: F) {
   |                                                  ^^^^^^^^^
   |
   = 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