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

kad: Avoid from/into IteratorIndex. #1623

Merged
merged 1 commit into from
Jun 23, 2020
Merged

Conversation

twittner
Copy link
Contributor

Type inference failed previously:

error[E0283]: type annotations needed for `(usize, &mut query::peers::closest::ClosestPeersIter)`
   --> /usr/local/cargo/registry/src/gitpro.ttaallkk.top-1ecc6299db9ec823/libp2p-kad-0.20.0/src/query/peers/closest/disjoint.rs:117:22
    |
116 |             for (i, iter) in &mut self.iters.iter_mut().enumerate() {
    |                              -------------------------------------- the element type for this iterator is not specified
117 |                 if i != (*initiated_by).into() {
    |                      ^^ cannot infer type for type `usize`
    |
    = note: cannot satisfy `usize: std::cmp::PartialEq<_>`
error[E0283]: type annotations needed for `(usize, &mut query::peers::closest::ClosestPeersIter)`
   --> /usr/local/cargo/registry/src/gitpro.ttaallkk.top-1ecc6299db9ec823/libp2p-kad-0.20.0/src/query/peers/closest/disjoint.rs:165:22
    |
164 |             for (i, iter) in &mut self.iters.iter_mut().enumerate() {
    |                              -------------------------------------- the element type for this iterator is not specified
165 |                 if i != (*initiated_by).into() {
    |                      ^^ cannot infer type for type `usize`
    |
    = note: cannot satisfy `usize: std::cmp::PartialEq<_>`

This caused problems with type inference.
@twittner twittner requested a review from mxinden June 23, 2020 08:37
Copy link
Member

@mxinden mxinden left a comment

Choose a reason for hiding this comment

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

Thanks for fixing this!

@twittner twittner merged commit 32cb0a5 into libp2p:master Jun 23, 2020
@twittner twittner deleted the iterindex branch June 23, 2020 09:28
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 this pull request may close these issues.

2 participants