Skip to content

Warnings when compiling with packed_struct, crash with clippy #10

Closed
@alexandre-janniaux

Description

@alexandre-janniaux

Hello, I'm using your library for a student's project. Thank you for your work.

On any simple program implementing packed_struct, rustc is emitting the following warnings:

warning: unnecessary parentheses around assigned value
  --> src/main.rs:43:30
   |
43 | #[derive(Debug, Deserialize, PackedStruct)]
   |                              ^^^^^^^^^^^^ help: remove these parentheses
   |
   = note: #[warn(unused_parens)] on by default

warning: unnecessary parentheses around assigned value
  --> src/main.rs:43:30
   |
43 | #[derive(Debug, Deserialize, PackedStruct)]
   |                              ^^^^^^^^^^^^ help: remove these parentheses

warning: unnecessary parentheses around assigned value
  --> src/main.rs:43:30
   |
43 | #[derive(Debug, Deserialize, PackedStruct)]
   |                              ^^^^^^^^^^^^ help: remove these parentheses

Moreover, clippy crashes when trying to lint the program. It shouldn't crash but it might unveil some flaws in the code of packed_struct.

For example, packed_struct prevents us from directly using error_chain! to handle errors, because of the following compile errors:

error[E0243]: wrong number of type arguments: expected 2, found 1
 --> src/units.rs:4:26
  |
4 | pub fn parse(s: &str) -> Result<u32> {
  |                          ^^^^^^^^^^^ expected 2 type arguments

error[E0244]: wrong number of type arguments: expected 1, found 2
  --> src/main.rs:43:30
   |
43 | #[derive(Debug, Deserialize, PackedStruct)]
   |                              ^^^^^^^^^^^^ expected 1 type argument

See also this issue on clippy: rust-lang/rust-clippy#2359

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