Skip to content

Examples produce clippy warnings #230

@Nemo157

Description

@Nemo157

Bug Report

Current Behavior

Examples currently output warnings when checked with clippy:

warning: this let-binding has unit value. Consider omitting `let msg =`
  --> examples/src/body_types.rs:30:5
   |
30 |     let msg = cx.body_json().await.client_err()?;
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
note: lint level defined here
  --> examples/src/lib.rs:2:9
   |
2  | #![warn(clippy::all)]
   |         ^^^^^^^^^^^
   = note: #[warn(clippy::let_unit_value)] implied by #[warn(clippy::all)]
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_unit_value

warning: passing a unit value to a function
  --> examples/src/body_types.rs:32:23
   |
32 |     Ok(response::json(msg))
   |                       ^^^
   |
note: lint level defined here
  --> examples/src/lib.rs:2:9
   |
2  | #![warn(clippy::all)]
   |         ^^^^^^^^^^^
   = note: #[warn(clippy::unit_arg)] implied by #[warn(clippy::all)]
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unit_arg
help: if you intended to pass a unit value, use a unit literal instead
   |
32 |     Ok(response::json(()))
   |                       ^^

warning: this let-binding has unit value. Consider omitting `let msg =`
  --> examples/src/body_types.rs:37:5
   |
37 |     let msg = cx.body_form().await?;
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_unit_value

warning: passing a unit value to a function
  --> examples/src/body_types.rs:39:20
   |
39 |     Ok(forms::form(msg))
   |                    ^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unit_arg
help: if you intended to pass a unit value, use a unit literal instead
   |
39 |     Ok(forms::form(()))
   |                    ^^

Expected behavior/code

High quality warning free code.

Additional context/Screenshots

#228 excludes the examples from being run under clippy in CI, once the warnings have been fixed they can be included back into the clippy build.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions