Skip to content

Commit 25a20e0

Browse files
committed
Expose size_hint() for TokenStream's iterator
1 parent f427365 commit 25a20e0

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/lib.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1290,6 +1290,10 @@ pub mod token_stream {
12901290
fn next(&mut self) -> Option<TokenTree> {
12911291
self.inner.next()
12921292
}
1293+
1294+
fn size_hint(&self) -> (usize, Option<usize>) {
1295+
self.inner.size_hint()
1296+
}
12931297
}
12941298

12951299
impl Debug for IntoIter {

tests/test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -551,7 +551,7 @@ fn default_tokenstream_is_empty() {
551551
fn tokenstream_size_hint() {
552552
let tokens = "a b (c d) e".parse::<TokenStream>().unwrap();
553553

554-
assert_eq!(tokens.into_iter().size_hint(), (0, None)); // FIXME
554+
assert_eq!(tokens.into_iter().size_hint(), (4, Some(4)));
555555
}
556556

557557
#[test]

0 commit comments

Comments
 (0)