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

[Feature Request] fix clippy issues #265

Closed
sansyrox opened this issue Aug 17, 2022 · 6 comments · Fixed by #293
Closed

[Feature Request] fix clippy issues #265

sansyrox opened this issue Aug 17, 2022 · 6 comments · Fixed by #293

Comments

@sansyrox
Copy link
Member

sansyrox commented Aug 17, 2022

Current Behavior

Clippy has issues

Desired Behavior

Fix them


Screenshots / Mockups

Alternatives


@sansyrox sansyrox changed the title [Feature Request] fix: clippy issues [Feature Request] fix clippy issues Aug 17, 2022
@Overflow0xFFFF
Copy link

I took a look into this issue as part of Hacktoberfest. Clippy has an issue with PyO3 projects that appears will be fixed with Rust 1.65 (See rust-lang/rust-clippy#8971 (comment)). An initial run of cargo clippy -- -W clippy::all shows that 9 out of the 10 warnings relate to that issue and will potentially go away with Rust 1.65.

@sansyrox
Copy link
Member Author

sansyrox commented Oct 8, 2022

Ah, perfect. That is good news @Overflow0xFFFF :D

What is the 10th warning?

@Overflow0xFFFF
Copy link

@sansyrox: Using a match instead of if let due to an empty arm of the match statement throws this warning:

warning: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
   --> src/server.rs:457:5
    |
457 | /     match middleware_router.get_route("AFTER_REQUEST", req.uri().path()) {
458 | |         Some(((handler_function, number_of_params), route_params)) => {
459 | |             let x = handle_http_middleware_request(
460 | |                 handler_function,
...   |
471 | |         None => {}
472 | |     };
    | |_____^
    |
    = note: `-W clippy::single-match` implied by `-W clippy::all`
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_match
help: try this
    |
457 ~     if let Some(((handler_function, number_of_params), route_params)) = middleware_router.get_route("AFTER_REQUEST", req.uri().path()) {
458 +         let x = handle_http_middleware_request(
459 +             handler_function,
460 +             number_of_params,
461 +             &headers_dup,
462 +             &mut payload,
463 +             &req,
464 +             route_params,
465 +             queries.clone(),
466 +         )
467 +         .await;
468 +         debug!("{:?}", x);
469 ~     };

@sansyrox
Copy link
Member Author

Perfect, thanks @Overflow0xFFFF . Do you want to create a PR for this ?

@Overflow0xFFFF
Copy link

I'm going to work with a friend on installing the Rust toolchain and seeing them through their first Hacktoberfest. Expect a PR shortly!

@sansyrox
Copy link
Member Author

Hey @Overflow0xFFFF ,

Thank you for helping out new contributors to the repo. I really appreciate it 😊😊

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

Successfully merging a pull request may close this issue.

2 participants