-
Notifications
You must be signed in to change notification settings - Fork 598
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
feat(corelib): FromIterator takes IntoIterator instead of Iterator #7226
feat(corelib): FromIterator takes IntoIterator instead of Iterator #7226
Conversation
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.
Reviewed 8 of 8 files at r1, all commit messages.
Reviewable status: all files reviewed, 4 unresolved discussions (waiting on @julio4)
corelib/src/test/array_test.cairo
line 242 at r1 (raw file):
let arr = FromIterator::from_iter((0..5_u32)); assert_eq!(arr, array![0, 1, 2, 3, 4]); }
Suggestion:
fn test_array_from_iterator() {
assert_eq!(FromIterator::from_iter(0..5_u32), array![0, 1, 2, 3, 4]);
}
corelib/src/test/array_test.cairo
line 247 at r1 (raw file):
fn test_array_from_collect() { let arr: Array<u32> = (0..5_u32).into_iter().collect(); assert_eq!(arr, array![0, 1, 2, 3, 4]);
Suggestion:
assert_eq!((0..5_u32).into_iter().collect(), array![0, 1, 2, 3, 4]);
corelib/src/iter/traits/collect.cairo
line 22 at r1 (raw file):
/// /// ``` /// let v = FromIterator::from_iter((0..5_u32));
Suggestion:
/// let v = FromIterator::from_iter(0..5_u32);
corelib/src/test/byte_array_test.cairo
line 499 at r1 (raw file):
let arr: Array<u8> = array!['h', 'e', 'l', 'l', 'o']; let ba: ByteArray = FromIterator::from_iter(arr); assert_eq!(ba, "hello");
Suggestion:
let ba: ByteArray = FromIterator::from_iter(array!['h'_u8, 'e', 'l', 'l', 'o']);
assert_eq!(ba, "hello");
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.
Reviewable status: all files reviewed, 4 unresolved discussions (waiting on @orizi)
corelib/src/iter/traits/collect.cairo
line 22 at r1 (raw file):
/// /// ``` /// let v = FromIterator::from_iter((0..5_u32));
Done.
corelib/src/test/array_test.cairo
line 242 at r1 (raw file):
let arr = FromIterator::from_iter((0..5_u32)); assert_eq!(arr, array![0, 1, 2, 3, 4]); }
Done.
corelib/src/test/array_test.cairo
line 247 at r1 (raw file):
fn test_array_from_collect() { let arr: Array<u32> = (0..5_u32).into_iter().collect(); assert_eq!(arr, array![0, 1, 2, 3, 4]);
Done.
There's still the need for the <ByteArray>
type information.
corelib/src/test/byte_array_test.cairo
line 499 at r1 (raw file):
let arr: Array<u8> = array!['h', 'e', 'l', 'l', 'o']; let ba: ByteArray = FromIterator::from_iter(arr); assert_eq!(ba, "hello");
Done.
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.
Reviewed 3 of 3 files at r2, all commit messages.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on @julio4)
a discussion (no related file):
@gilbens-starkware for 2nd eye.
fe25d41
to
aac6cb8
Compare
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.
Reviewed 3 of 3 files at r3, all commit messages.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on @julio4)
a discussion (no related file):
Previously, orizi wrote…
@gilbens-starkware for 2nd eye.
ping
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.
Reviewed 4 of 8 files at r1, 1 of 3 files at r2, 3 of 3 files at r3, all commit messages.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on @julio4)
Currently,
FromIteratorTrait
takes anIterator
.This PR modify this to
+IntoIterator
(which is implemented by allIterator
s).This need some update on
Iterator::collect
(#7086) as well.And updated implementations for: