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

chore: activate clippy::manual_let_else lint #4770

Merged
merged 21 commits into from
Nov 14, 2023

Conversation

eserilev
Copy link
Contributor

@eserilev eserilev commented Oct 30, 2023

Description

Refactor let else usage to align w/ idiomatic usage of Rust by activating clippy::manual_let_else lint, and resolving all the warning messages.

Resolves: #4741.

Notes & open questions

Change checklist

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • A changelog entry has been made in the appropriate crates

@eserilev eserilev marked this pull request as ready for review October 30, 2023 11:39
Copy link
Contributor

@thomaseizinger thomaseizinger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice! I made some comments where I think we can be more idiomatic with combinators :)

core/src/transport/memory.rs Outdated Show resolved Hide resolved
transports/tcp/src/lib.rs Outdated Show resolved Hide resolved
core/src/transport/memory.rs Outdated Show resolved Hide resolved
protocols/autonat/src/behaviour/as_client.rs Outdated Show resolved Hide resolved
protocols/mdns/src/behaviour/iface/query.rs Outdated Show resolved Hide resolved
protocols/mdns/src/behaviour/iface/query.rs Outdated Show resolved Hide resolved
protocols/mdns/src/behaviour/iface/query.rs Outdated Show resolved Hide resolved
protocols/mdns/src/behaviour/iface/query.rs Outdated Show resolved Hide resolved
protocols/relay/src/protocol/inbound_hop.rs Outdated Show resolved Hide resolved
transports/tls/src/upgrade.rs Outdated Show resolved Hide resolved
Copy link
Contributor

mergify bot commented Oct 31, 2023

This pull request has merge conflicts. Could you please resolve them @eserilev? 🙏

Copy link
Contributor

@thomaseizinger thomaseizinger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

A few more minor comments :)

core/src/transport/memory.rs Outdated Show resolved Hide resolved
protocols/autonat/src/protocol.rs Outdated Show resolved Hide resolved
protocols/dcutr/src/behaviour.rs Show resolved Hide resolved
protocols/mdns/src/behaviour/iface/query.rs Outdated Show resolved Hide resolved
transports/quic/src/transport.rs Outdated Show resolved Hide resolved
transports/tls/src/upgrade.rs Outdated Show resolved Hide resolved
transports/webrtc/src/tokio/transport.rs Outdated Show resolved Hide resolved
Copy link
Contributor

mergify bot commented Nov 2, 2023

This pull request has merge conflicts. Could you please resolve them @eserilev? 🙏

@eserilev
Copy link
Contributor Author

eserilev commented Nov 4, 2023

I pushed up some changes based on your feedback

@mxinden
Copy link
Member

mxinden commented Nov 5, 2023

Thank you for the work here. I am in favor of the refactorings. Will defer to @thomaseizinger. Let me know if you need something from my end.

Copy link
Contributor

@thomaseizinger thomaseizinger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work!

If I run cargo clippy --all-targets --all-features locally, it is still coming up with several instances of the lint and CI does too! :)

https://github.com/libp2p/rust-libp2p/actions/runs/6754481746/job/18362004203

protocols/dcutr/src/behaviour.rs Outdated Show resolved Hide resolved
protocols/dcutr/src/behaviour.rs Outdated Show resolved Hide resolved
@thomaseizinger thomaseizinger changed the title feat(libp2p): Activate clippy::manual_let_else feat: activate clippy::manual_let_else lint Nov 12, 2023
@eserilev
Copy link
Contributor Author

I resolved the additional lints, had to update my local clippy to use the nightly toolchain to catch those. I also made some changes based on your feedback. Thanks!

@thomaseizinger thomaseizinger changed the title feat: activate clippy::manual_let_else lint chore: activate clippy::manual_let_else lint Nov 13, 2023

This comment was marked as resolved.

Copy link
Contributor

@thomaseizinger thomaseizinger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome stuff! Just one more suggestions, otherwise I think this is ready :)

transports/webrtc-websys/src/connection.rs Outdated Show resolved Hide resolved
@mergify mergify bot merged commit e151ecb into libp2p:master Nov 14, 2023
71 checks passed
umgefahren pushed a commit to umgefahren/rust-libp2p that referenced this pull request Mar 8, 2024
Refactor let else usage to align w/ idiomatic usage of Rust by activating `clippy::manual_let_else` lint, and resolving all the warning messages.

Resolves: libp2p#4741.

Pull-Request: libp2p#4770.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Activate clippy::manual_let_else lint
3 participants