-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Replace iterator structures with impl Trait
.
#48699
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Conversation
(rust_highfive has picked a reviewer for you, use r? to override) |
impl Trait
.impl Trait
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice cleanup! Let's go ahead and do the other cases, too!
self.edges | ||
.iter() | ||
.enumerate() | ||
.map(|(idx, e)| (EdgeIndex(idx), e)) | ||
} | ||
|
||
pub fn each_node<'a, F>(&'a self, mut f: F) -> bool |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can use impl trait too -- mut f: impl FnMut(NodeIndex, &'a Node<N>) -> bool
{ | ||
//! Iterates over all edges defined in the graph. | ||
self.enumerated_nodes().all(|(node_idx, node)| f(node_idx, node)) | ||
self.enumerated_nodes() | ||
.all(|(node_idx, node)| f(node_idx, node)) | ||
} | ||
|
||
pub fn each_edge<'a, F>(&'a self, mut f: F) -> bool |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same
588f88f
to
d8172b0
Compare
@nikomatsakis comments have been addressed! |
there are travis errors here, I think because we need to remove a now unused type parameter (which was migrated to an |
pub fn each_node<'a, F>(&'a self, mut f: F) -> bool | ||
where F: FnMut(NodeIndex, &'a Node<N>) -> bool | ||
{ | ||
pub fn each_node<'a, F>(&'a self, mut f: impl FnMut(NodeIndex, &'a Node<N>) -> bool) -> bool { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
F is not used
pub fn each_edge<'a, F>(&'a self, mut f: F) -> bool | ||
where F: FnMut(EdgeIndex, &'a Edge<E>) -> bool | ||
{ | ||
pub fn each_edge<'a, F>(&'a self, mut f: impl FnMut(EdgeIndex, &'a Edge<E>) -> bool) -> bool { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same
d8172b0
to
08a0182
Compare
@bors r+ |
📌 Commit 08a0182 has been approved by |
…omatsakis Replace iterator structures with `impl Trait`. Two commits: * Replace iterator structures with `impl Trait`. * Run rustfmt on `src/librustc_data_structures/graph/mod.rs`.
Two commits:
impl Trait
.src/librustc_data_structures/graph/mod.rs
.