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

standard_library_types/iterators2.rs, wrong ::? #199

Closed
lromor opened this issue Jul 27, 2019 · 1 comment
Closed

standard_library_types/iterators2.rs, wrong ::? #199

lromor opened this issue Jul 27, 2019 · 1 comment

Comments

@lromor
Copy link

lromor commented Jul 27, 2019

Hi,

I'm new to rust, but I couldn't really find a solution to this line

Could the collect() round brackets be a typo and the original code should be instead:

.collect::<String>() + c.as_str()

If it's not the case, could you provide a hint on how to solve the exercise with .collect()::<String>()?

Thank you,

-l

@nkanderson
Copy link
Contributor

+1, I got hung up on this one for a bit as well. The resulting error message is a bit confusing, in my opinion, for those of us new to the syntax.

I would support either removing () after collect as suggested above, or removing the ::<String>() type annotation and guiding the user through the addition of a turbofish annotation.

@bors bors closed this as completed in 4cde866 Aug 11, 2019
xymopen pushed a commit to xymopen/rustlings-solutions that referenced this issue Oct 14, 2019
pedantic79 pushed a commit to pedantic79/rustlings that referenced this issue Apr 11, 2020
ppp3 pushed a commit to ppp3/rustlings that referenced this issue May 23, 2022
dmoore04 pushed a commit to dmoore04/rustlings that referenced this issue Sep 11, 2022
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

No branches or pull requests

2 participants