Skip to content

simplify tokio deps #509

simplify tokio deps

simplify tokio deps #509

GitHub Actions / clippy failed Sep 16, 2024 in 1s

clippy

3 errors

Details

Results

Message level Amount
Internal compiler error 0
Error 3
Warning 0
Note 0
Help 0

Versions

  • rustc 1.81.0 (eeb90cda1 2024-09-04)
  • cargo 1.81.0 (2dbb1af80 2024-08-20)
  • clippy 0.1.81 (eeb90cd 2024-09-04)

Annotations

Check failure on line 239 in src/quickjsruntimeadapter.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

if let can be simplified with `.unwrap_or_default()`

error: if let can be simplified with `.unwrap_or_default()`
   --> src/quickjsruntimeadapter.rs:216:13
    |
216 | /             if let Some(res) = q_js_rt.with_all_module_loaders(|module_loader| {
217 | |                 if module_loader.has_module(q_ctx, module_name.as_str()) {
218 | |                     match module_loader.init_module(q_ctx, module) {
219 | |                         Ok(_) => {
...   |
238 | |                 0
239 | |             }
    | |_____________^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_unwrap_or_default
    = note: `-D clippy::manual-unwrap-or-default` implied by `-D warnings`
    = help: to override `-D warnings` add `#[allow(clippy::manual_unwrap_or_default)]`
help: replace it with
    |
216 ~             q_js_rt.with_all_module_loaders(|module_loader| {
217 +                 if module_loader.has_module(q_ctx, module_name.as_str()) {
218 +                     match module_loader.init_module(q_ctx, module) {
219 +                         Ok(_) => {
220 +                             Some(0) // ok
221 +                         }
222 +                         Err(e) => {
223 +                             q_ctx.report_ex(
224 +                                 format!(
225 +                                     "Failed to init native module: {module_name} caused by {e}"
226 +                                 )
227 +                                 .as_str(),
228 +                             );
229 +                             Some(1)
230 +                         }
231 +                     }
232 +                 } else {
233 +                     None
234 +                 }
235 +             }).unwrap_or_default()
    |

Check failure on line 239 in src/quickjsruntimeadapter.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

this pattern reimplements `Option::unwrap_or`

error: this pattern reimplements `Option::unwrap_or`
   --> src/quickjsruntimeadapter.rs:216:13
    |
216 | /             if let Some(res) = q_js_rt.with_all_module_loaders(|module_loader| {
217 | |                 if module_loader.has_module(q_ctx, module_name.as_str()) {
218 | |                     match module_loader.init_module(q_ctx, module) {
219 | |                         Ok(_) => {
...   |
238 | |                 0
239 | |             }
    | |_____________^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_unwrap_or
    = note: `-D clippy::manual-unwrap-or` implied by `-D warnings`
    = help: to override `-D warnings` add `#[allow(clippy::manual_unwrap_or)]`
help: replace with
    |
216 ~             q_js_rt.with_all_module_loaders(|module_loader| {
217 +                 if module_loader.has_module(q_ctx, module_name.as_str()) {
218 +                     match module_loader.init_module(q_ctx, module) {
219 +                         Ok(_) => {
220 +                             Some(0) // ok
221 +                         }
222 +                         Err(e) => {
223 +                             q_ctx.report_ex(
224 +                                 format!(
225 +                                     "Failed to init native module: {module_name} caused by {e}"
226 +                                 )
227 +                                 .as_str(),
228 +                             );
229 +                             Some(1)
230 +                         }
231 +                     }
232 +                 } else {
233 +                     None
234 +                 }
235 +             }).unwrap_or(0)
    |

Check failure on line 29 in src/quickjsrealmadapter.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

importing legacy numeric constants

error: importing legacy numeric constants
  --> src/quickjsrealmadapter.rs:29:5
   |
29 | use std::i32;
   |     ^^^^^^^^
   |
   = help: remove this import
   = note: then `i32::<CONST>` will resolve to the respective associated constant
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#legacy_numeric_constants
   = note: `-D clippy::legacy-numeric-constants` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(clippy::legacy_numeric_constants)]`