SumoLogic/sumologic-kubernetes-tools

[receiver-mock] fix clippy warnings

Opened this issue · 0 comments

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).