Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[receiver-mock] fix clippy warnings #421

Open
aboguszewski-sumo opened this issue Jan 12, 2023 · 0 comments
Open

[receiver-mock] fix clippy warnings #421

aboguszewski-sumo opened this issue Jan 12, 2023 · 0 comments

Comments

@aboguszewski-sumo
Copy link
Contributor

After running command cargo clippy, you get quite a lot of warnings, for example:

warning: redundant field names in struct initialization
   --> src/main.rs:125:9
    |
125 |         delay_time: delay_time,
    |         ^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `delay_time`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_field_names

warning: operator precedence can trip the unwary
   --> src/main.rs:248:59
    |
248 |             .app_data(web::PayloadConfig::default().limit(100 * 2 << 20))
    |                                                           ^^^^^^^^^^^^^ help: consider parenthesizing your expression: `(100 * 2) << 20`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#precedence
    = note: `#[warn(clippy::precedence)]` on by default

warning: unneeded `return` statement
  --> src/logs/mod.rs:25:9
   |
25 | /         return Self {
26 | |             total: LogStats {
27 | |                 message_count: 0,
28 | |                 byte_count: 0,
29 | |             },
30 | |             ipaddr: HashMap::new(),
31 | |         };
   | |_________^
   |
   = 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`

ideally, all of them should be fixed and then cargo clippy should be added to the CI.

Note: I've had some problems with clippy on MacOS in the history, but it worked for me on version clippy 0.1.66 (90743e72 2023-01-10).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant